From 35fe4adb436fa9ae8355d67a9b4b985325bb9d42 Mon Sep 17 00:00:00 2001 From: kamangir Date: Thu, 25 Jul 2024 18:44:59 -0700 Subject: [PATCH] refactor - kamangir/bolt#746 --- blue_geo/.abcli/catalog/browse.sh | 2 +- blue_geo/.abcli/{datacube => catalog}/firms/README.md | 0 .../catalog/{browse/firms.sh => firms/browse.sh} | 10 +++++----- .../catalog/{ingest/firms.sh => firms/ingest.sh} | 2 +- .../.abcli/catalog/{query/firms.sh => firms/query.sh} | 6 ++++-- blue_geo/.abcli/catalog/query.sh | 2 +- blue_geo/__init__.py | 2 +- notebooks/firms-area-api.ipynb | 2 +- 8 files changed, 14 insertions(+), 12 deletions(-) rename blue_geo/.abcli/{datacube => catalog}/firms/README.md (100%) rename blue_geo/.abcli/catalog/{browse/firms.sh => firms/browse.sh} (61%) rename blue_geo/.abcli/catalog/{ingest/firms.sh => firms/ingest.sh} (90%) rename blue_geo/.abcli/catalog/{query/firms.sh => firms/query.sh} (80%) diff --git a/blue_geo/.abcli/catalog/browse.sh b/blue_geo/.abcli/catalog/browse.sh index 619369a7..15033e20 100644 --- a/blue_geo/.abcli/catalog/browse.sh +++ b/blue_geo/.abcli/catalog/browse.sh @@ -12,7 +12,7 @@ function blue_geo_catalog_browse() { local catalog=$(abcli_option "$options" $blue_geo_catalog_list firms) abcli_log "@catalog: browsing $catalog ..." - blue_geo_catalog_${catalog}_browse "${@:2}" + blue_geo_catalog_browse_${catalog} "${@:2}" } abcli_source_path - caller,suffix=/browse diff --git a/blue_geo/.abcli/datacube/firms/README.md b/blue_geo/.abcli/catalog/firms/README.md similarity index 100% rename from blue_geo/.abcli/datacube/firms/README.md rename to blue_geo/.abcli/catalog/firms/README.md diff --git a/blue_geo/.abcli/catalog/browse/firms.sh b/blue_geo/.abcli/catalog/firms/browse.sh similarity index 61% rename from blue_geo/.abcli/catalog/browse/firms.sh rename to blue_geo/.abcli/catalog/firms/browse.sh index 63511b90..4ba7b980 100644 --- a/blue_geo/.abcli/catalog/browse/firms.sh +++ b/blue_geo/.abcli/catalog/firms/browse.sh @@ -1,23 +1,23 @@ #! /usr/bin/env bash -function blue_geo_datacube_firms_browse() { +function blue_geo_catalog_firms_browse() { local options=$1 if [ $(abcli_option_int "$options" help 0) == 1 ]; then options="|map_key|area" - abcli_show_usage "@datacube browse firms$ABCUL$options" \ + abcli_show_usage "@catalog browse firms$ABCUL$options" \ "browse firms." return fi local do_map_key=$(abcli_option_int "$options" map_key 0) - local do_area_api=$(abcli_option_int "$options" area 0) + local api=$(abcli_option_choice "$options" area area) local url="https://firms.modaps.eosdis.nasa.gov/" [[ "$do_map_key" == 1 ]] && url="https://firms.modaps.eosdis.nasa.gov/api/map_key/" - [[ "$do_area_api" == 1 ]] && - url="https://firms.modaps.eosdis.nasa.gov/api/area/" + [[ -z "$api" ]] && + url="https://firms.modaps.eosdis.nasa.gov/api/$api/" abcli_browse $url } diff --git a/blue_geo/.abcli/catalog/ingest/firms.sh b/blue_geo/.abcli/catalog/firms/ingest.sh similarity index 90% rename from blue_geo/.abcli/catalog/ingest/firms.sh rename to blue_geo/.abcli/catalog/firms/ingest.sh index 9dca6aa9..a45dbd0d 100644 --- a/blue_geo/.abcli/catalog/ingest/firms.sh +++ b/blue_geo/.abcli/catalog/firms/ingest.sh @@ -6,7 +6,7 @@ function blue_geo_catalog_ingest_firms() { if [ $(abcli_option_int "$options" help 0) == 1 ]; then options=$blue_geo_datacube_ingest_options "$EOP~copy_template,dryrun,$EOPE" - abcli_show_usage "blue_geo ingest firms$ABCUL[$options]$ABCUL[.|]$ABCUL" \ + abcli_show_usage "@catalog ingest firms$ABCUL[$options]$ABCUL[.|]$ABCUL" \ "firms -ingest-> ." return fi diff --git a/blue_geo/.abcli/catalog/query/firms.sh b/blue_geo/.abcli/catalog/firms/query.sh similarity index 80% rename from blue_geo/.abcli/catalog/query/firms.sh rename to blue_geo/.abcli/catalog/firms/query.sh index 6d2a0c93..77cc453a 100644 --- a/blue_geo/.abcli/catalog/query/firms.sh +++ b/blue_geo/.abcli/catalog/firms/query.sh @@ -4,7 +4,7 @@ function blue_geo_catalog_query_firms() { local options=$1 if [ $(abcli_option_int "$options" help 0) == 1 ]; then - options="dryrun" + options="area,dryrun" local date=$(abcli_string_timestamp_short \ --include_time 0 \ @@ -21,12 +21,13 @@ function blue_geo_catalog_query_firms() { local args="[--date $date]$ABCUL[--depth 1]$ABCUL[--area $area]$ABCUL[--source $source]$ABCUL[--log 1]" - abcli_show_usage "@datacube query firms_area$ABCUL[$blue_geo_catalog_query_options]$ABCUL[-|]$ABCUL[$options]$ABCUL$args" \ + abcli_show_usage "@catalog query firms$ABCUL[$blue_geo_catalog_query_options]$ABCUL[-|]$ABCUL[$options]$ABCUL$args" \ "firms -query-> ." return fi local do_dryrun=$(abcli_option_int "$options" dryrun 0) + local api=$(abcli_option_choice "$options" area area) local object_name=$(abcli_clarify_object $2 -) @@ -34,6 +35,7 @@ function blue_geo_catalog_query_firms() { python3 -m blue_geo.datacube.firms \ query \ --object_name $object_name \ + --api $api \ "${@:3}" return 0 diff --git a/blue_geo/.abcli/catalog/query.sh b/blue_geo/.abcli/catalog/query.sh index 2f5db8d6..c6b93f46 100644 --- a/blue_geo/.abcli/catalog/query.sh +++ b/blue_geo/.abcli/catalog/query.sh @@ -33,7 +33,7 @@ function blue_geo_catalog_query() { fi if [[ $(abcli_option_int "$options" help 0) == 1 ]]; then - blue_geo_catalog_${catalog}_query "${@:2}" + blue_geo_catalog_query_${catalog} "${@:2}" return fi diff --git a/blue_geo/__init__.py b/blue_geo/__init__.py index 8e5a5187..9f1c5bd1 100644 --- a/blue_geo/__init__.py +++ b/blue_geo/__init__.py @@ -4,7 +4,7 @@ DESCRIPTION = f"{ICON} AI for precise geospatial data analysis and visualization." -VERSION = "4.146.1" +VERSION = "4.147.1" REPO_NAME = "blue-geo" diff --git a/notebooks/firms-area-api.ipynb b/notebooks/firms-area-api.ipynb index bad5ccb5..178368c2 100644 --- a/notebooks/firms-area-api.ipynb +++ b/notebooks/firms-area-api.ipynb @@ -7,7 +7,7 @@ "source": [ "# FIRMS Area API\n", "\n", - "https://github.com/kamangir/blue-geo/blob/main/blue_geo/.abcli/datacube/firms/README.md" + "https://github.com/kamangir/blue-geo/blob/main/blue_geo/.abcli/catalog/firms/README.md" ] }, {