Skip to content

Commit

Permalink
@DataCube crop refactors - kamangir/bolt#746
Browse files Browse the repository at this point in the history
  • Loading branch information
kamangir committed Dec 9, 2024
1 parent 628ddd2 commit 76e40c0
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ pip install blue-geo

[![pylint](https://github.com/kamangir/blue-geo/actions/workflows/pylint.yml/badge.svg)](https://github.com/kamangir/blue-geo/actions/workflows/pylint.yml) [![pytest](https://github.com/kamangir/blue-geo/actions/workflows/pytest.yml/badge.svg)](https://github.com/kamangir/blue-geo/actions/workflows/pytest.yml) [![bashtest](https://github.com/kamangir/blue-geo/actions/workflows/bashtest.yml/badge.svg)](https://github.com/kamangir/blue-geo/actions/workflows/bashtest.yml) [![PyPI version](https://img.shields.io/pypi/v/blue-geo.svg)](https://pypi.org/project/blue-geo/) [![PyPI - Downloads](https://img.shields.io/pypi/dd/blue-geo)](https://pypistats.org/packages/blue-geo)

built by πŸŒ€ [`blue_options-4.173.1`](https://github.com/kamangir/awesome-bash-cli), based on 🌐 [`blue_geo-4.836.1`](https://github.com/kamangir/blue-geo).
built by πŸŒ€ [`blue_options-4.173.1`](https://github.com/kamangir/awesome-bash-cli), based on 🌐 [`blue_geo-4.837.1`](https://github.com/kamangir/blue-geo).
8 changes: 4 additions & 4 deletions blue_geo/.abcli/datacube/crop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function blue_geo_datacube_crop() {
$object_name \
$cropped_datacube_id

local crs=$(gdalsrsinfo -o epsg $cutline)
local crs=$(blue_geo_gdal_get_crs $cutline)
abcli_log "cutline crs: $crs"

local list_of_files=$(blue_geo_datacube_list $datacube_id \
Expand All @@ -38,7 +38,7 @@ function blue_geo_datacube_crop() {
for filename in $list_of_files; do
source_filename=$ABCLI_OBJECT_ROOT/$datacube_id/$filename

local source_filename_crs=$(gdalsrsinfo -o epsg $source_filename)
local source_filename_crs=$(blue_geo_gdal_get_crs $source_filename)
abcli_log "cropping $filename @ $source_filename_crs ..."

destination_filename=$ABCLI_OBJECT_ROOT/$cropped_datacube_id/$filename
Expand All @@ -53,8 +53,8 @@ function blue_geo_datacube_crop() {
$source_filename \
$destination_filename

local destination_filename_crs=$(gdalsrsinfo -o epsg $destination_filename)
abcli_log "output crs: $destination_filename - expected $crs."
local destination_filename_crs=$(blue_geo_gdal_get_crs $destination_filename)
abcli_log "output crs: $destination_filename_crs - expected $crs."
done

return 0
Expand Down
5 changes: 5 additions & 0 deletions blue_geo/.abcli/gdal/get_crs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#! /usr/bin/env bash

function blue_geo_gdal_get_crs() {
gdalsrsinfo -o epsg ${1:-void} | tr -d '\n'
}
12 changes: 12 additions & 0 deletions blue_geo/.abcli/tests/gdal_get_crs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#! /usr/bin/env bash

function test_blue_geo_gdal_get_crs() {
local options=$1

local object_name=$BLUE_GEO_WATCH_TARGET_LIST
abcli_download - $object_name

local crs=$(blue_geo_gdal_get_crs $ABCLI_OBJECT_ROOT/$object_name/target/shape.geojson)

abcli_assert "$crs" EPSG:4326
}
3 changes: 3 additions & 0 deletions blue_geo/.abcli/tests/help.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ function test_@geo_help() {
"@geo datacube list" \
\
"@geo gdal" \
"@geo gdal get_crs" \
"@geo gdal install" \
"@geo gdal version" \
\
"@geo ingest" \
\
Expand Down
2 changes: 1 addition & 1 deletion blue_geo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

DESCRIPTION = f"{ICON} AI for a Blue Planet."

VERSION = "4.836.1"
VERSION = "4.837.1"

REPO_NAME = "blue-geo"

Expand Down
16 changes: 16 additions & 0 deletions blue_geo/help/gdal.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@
from blue_options.terminal import show_usage


def help_get_crs(
tokens: List[str],
mono: bool,
) -> str:
return show_usage(
[
"@gdal",
"get_crs",
"<filename>",
],
"get <filename> crs.",
mono=mono,
)


def help_install(
tokens: List[str],
mono: bool,
Expand Down Expand Up @@ -32,6 +47,7 @@ def help_version(


help_functions = {
"get_crs": help_get_crs,
"install": help_install,
"version": help_version,
}
22 changes: 11 additions & 11 deletions blue_geo/watch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ watch the planet's story unfold.
<details>
<summary>🌐</summary>

![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-Cache-Creek-2x-wider-2024-11-05/geo-watch-Cache-Creek-2x-wider-2024-11-05-4X.gif?raw=true&random=vUKC0eYPFk139qAb)
![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-Cache-Creek-2x-wider-2024-11-05/geo-watch-Cache-Creek-2x-wider-2024-11-05-4X.gif?raw=true&random=uh3n2WZ9vNvGaK98)

</details>

Expand All @@ -155,7 +155,7 @@ watch the planet's story unfold.
<details>
<summary>🌐</summary>

![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-DrugSuperLab-2024-11-19-13954/geo-watch-DrugSuperLab-2024-11-19-13954-4X.gif?raw=true&random=iL4nSDuYXZxJVHvp)
![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-DrugSuperLab-2024-11-19-13954/geo-watch-DrugSuperLab-2024-11-19-13954-4X.gif?raw=true&random=naHgEGUXBnducN6r)

</details>

Expand All @@ -170,7 +170,7 @@ watch the planet's story unfold.
<details>
<summary>🌐</summary>

![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-2024-09-04-Fagradalsfjall-a/geo-watch-2024-09-04-Fagradalsfjall-a-2X.gif?raw=true&random=1UtkDbSHwtD3DXMw)
![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-2024-09-04-Fagradalsfjall-a/geo-watch-2024-09-04-Fagradalsfjall-a-2X.gif?raw=true&random=bhbT3A3RNmVEpMTO)

</details>

Expand All @@ -183,7 +183,7 @@ watch the planet's story unfold.
<details>
<summary>🌐</summary>

![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-Jasper-2024-11-03/geo-watch-Jasper-2024-11-03-2X.gif?raw=true&random=4bWns7IFk0bBoPVm)
![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-Jasper-2024-11-03/geo-watch-Jasper-2024-11-03-2X.gif?raw=true&random=ebCwHJ2H1aTO6iTu)

</details>

Expand All @@ -198,7 +198,7 @@ watch the planet's story unfold.
<details>
<summary>🌐</summary>

![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-2024-10-27-16-17-36-12059/geo-watch-2024-10-27-16-17-36-12059-4X.gif?raw=true&random=lnMcHhS3NmrWxQQD)
![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-2024-10-27-16-17-36-12059/geo-watch-2024-10-27-16-17-36-12059-4X.gif?raw=true&random=gS14DoV70KrcMZrq)

</details>

Expand All @@ -216,7 +216,7 @@ watch the planet's story unfold.
<details>
<summary>🌐</summary>

![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-2024-09-04-Mount-Etna-a/geo-watch-2024-09-04-Mount-Etna-a-2X.gif?raw=true&random=UK9wmEF4RgP4Kr3x)
![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-2024-09-04-Mount-Etna-a/geo-watch-2024-09-04-Mount-Etna-a-2X.gif?raw=true&random=VEaqmZhe6MpdH77K)

</details>

Expand All @@ -229,7 +229,7 @@ watch the planet's story unfold.
<details>
<summary>🌐</summary>

![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-Silver-Peak-2024-10-12-a/geo-watch-Silver-Peak-2024-10-12-a-4X.gif?raw=true&random=EO7nsfdNTYv9GueN)
![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-Silver-Peak-2024-10-12-a/geo-watch-Silver-Peak-2024-10-12-a-4X.gif?raw=true&random=zsrhhzw1WUSJbxTH)

</details>

Expand All @@ -243,7 +243,7 @@ watch the planet's story unfold.
<details>
<summary>🌐</summary>

![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-bellingcat-2024-09-27-nagorno-karabakh-6X-2024-10-06-a/geo-watch-bellingcat-2024-09-27-nagorno-karabakh-6X-2024-10-06-a-4X.gif?raw=true&random=LJuGrnetR81Lu1ep)
![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-bellingcat-2024-09-27-nagorno-karabakh-6X-2024-10-06-a/geo-watch-bellingcat-2024-09-27-nagorno-karabakh-6X-2024-10-06-a-4X.gif?raw=true&random=kMVnVdOm9RAR8UcL)

</details>

Expand All @@ -259,7 +259,7 @@ watch the planet's story unfold.
<details>
<summary>🌐</summary>

![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-2024-09-04-burning-man-2024-a/geo-watch-2024-09-04-burning-man-2024-a-2X.gif?raw=true&random=CHNdZrVocFdWEOpd)
![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-2024-09-04-burning-man-2024-a/geo-watch-2024-09-04-burning-man-2024-a-2X.gif?raw=true&random=2ZYCFMqFFVVuAhG6)

</details>

Expand All @@ -271,7 +271,7 @@ watch the planet's story unfold.
<details>
<summary>🌐</summary>

![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-Chilcotin-2024-11-03/geo-watch-Chilcotin-2024-11-03-4X.gif?raw=true&random=4su2oALMCbP6M8bM)
![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-Chilcotin-2024-11-03/geo-watch-Chilcotin-2024-11-03-4X.gif?raw=true&random=FT9AW7JRbN0JWKJu)

</details>

Expand All @@ -290,7 +290,7 @@ watch the planet's story unfold.
<details>
<summary>🌐</summary>

![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-elkhema-2024-2024-10-05-a-b/geo-watch-elkhema-2024-2024-10-05-a-b-4X.gif?raw=true&random=D7vhvBzFAu6enLZg)
![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-elkhema-2024-2024-10-05-a-b/geo-watch-elkhema-2024-2024-10-05-a-b-4X.gif?raw=true&random=opYiZGPC0887mvQU)

</details>

Expand Down

0 comments on commit 76e40c0

Please sign in to comment.