diff --git a/blue_geo/__init__.py b/blue_geo/__init__.py index 92e00164..e8cae999 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.47.1" +VERSION = "4.48.1" REPO_NAME = "blue-geo" diff --git a/blue_geo/firms/api/area/__main__.py b/blue_geo/firms/api/area/__main__.py index 824034de..fa9af453 100644 --- a/blue_geo/firms/api/area/__main__.py +++ b/blue_geo/firms/api/area/__main__.py @@ -20,14 +20,14 @@ parser.add_argument( "--source", type=str, - default=Source.default.name, - help="|".join(Source.default.values), + default=Source.default().name, + help="|".join(Source.values()), ) parser.add_argument( "--area", type=str, - default=Area.default.name, - help="|".join(Area.default.values), + default=Area.default().name, + help="|".join(Area.values()), ) parser.add_argument( "--date", diff --git a/blue_geo/firms/api/area/classes.py b/blue_geo/firms/api/area/classes.py index 3613521d..9d5e39d0 100644 --- a/blue_geo/firms/api/area/classes.py +++ b/blue_geo/firms/api/area/classes.py @@ -8,8 +8,8 @@ class APIRequest: def __init__( self, - source: Source = Source.default, - area: Area = Area.default, + source: Source = Source.default(), + area: Area = Area.default(), date: str = "", day_range: int = 1, log: bool = True, @@ -38,8 +38,16 @@ def as_str(self) -> str: self.source.description, ) - def ingest(object_name: str) -> bool: - logger.info(f"🪄 -> {object_name}") + def ingest(self, object_name: str) -> bool: + logger.info( + "{}.{} -> {}".format( + NAME, + self.__class__.__name__, + object_name, + ) + ) + + logger.info("🪄") return True diff --git a/blue_geo/firms/api/area/enums.py b/blue_geo/firms/api/area/enums.py index 774f7729..e159370f 100644 --- a/blue_geo/firms/api/area/enums.py +++ b/blue_geo/firms/api/area/enums.py @@ -8,12 +8,12 @@ class Area(Enum): WEST = auto() WORLD = auto() - @property - def default(): + @classmethod + def default(cls): return Area.WORLD - @property - def values(): + @classmethod + def values(cls): return [area.name.lower() for area in Area] @@ -50,10 +50,10 @@ class Source(Enum): def __init__(self, _, description): self.description = description - @property - def default(): + @classmethod + def default(cls): return Source.MODIS_NRT - @property - def values(): + @classmethod + def values(cls): return [source.name for source in Source] diff --git a/blue_geo/tests/test_firms_api_area.py b/blue_geo/tests/test_firms_api_area.py index 43fbe1d0..3f389ddb 100644 --- a/blue_geo/tests/test_firms_api_area.py +++ b/blue_geo/tests/test_firms_api_area.py @@ -8,8 +8,8 @@ ["area", "source"], [ [ - enums.Area.default, - enums.Source.default, + enums.Area.default(), + enums.Source.default(), ], ], ) diff --git a/notebooks/firms-area-api.ipynb b/notebooks/firms-area-api.ipynb index 78c5f0a3..4b16858e 100644 --- a/notebooks/firms-area-api.ipynb +++ b/notebooks/firms-area-api.ipynb @@ -31,7 +31,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "🌐 abcli-9.163.1, built on 15 July 2024, 20:45:12\n" + "🌐 abcli-9.163.1, built on 15 July 2024, 21:43:51\n" ] } ], @@ -39,7 +39,6 @@ "from abcli import fullname\n", "from abcli import string\n", "from abcli.modules import objects\n", - "from abcli.plugins import seed\n", "from blue_geo.firms.api.area.classes import APIRequest\n", "from blue_geo.logger import logger\n", "\n", @@ -50,27 +49,9 @@ "cell_type": "code", "execution_count": 3, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "🌐 blue_geo.firms.api.area.APIRequest, area:world, source: MODIS_NRT (MODIS Near Real-Time, Real-Time and Ultra Real-Time)\n" - ] - } - ], - "source": [ - "api_request = APIRequest()" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": {}, "outputs": [], "source": [ - "object_name = f\"firms-{string.timestamp()}\"\n", - "object_path = objects.object_path(object_name)" + "object_name = f\"firms-{string.timestamp()}\"" ] }, { @@ -83,19 +64,22 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "🌐 Hello World! 🪄\n" + "🌐 blue_geo.firms.api.area.APIRequest, area:world, source: MODIS_NRT (MODIS Near Real-Time, Real-Time and Ultra Real-Time)\n", + "🌐 blue_geo.firms.api.area.APIRequest -> firms-2024-07-15-21-43-51-94618\n", + "🌐 🪄\n" ] } ], "source": [ - "logger.info(\"Hello World! 🪄\")" + "api_request = APIRequest()\n", + "assert api_request.ingest(object_name)" ] }, { @@ -108,7 +92,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -121,15 +105,15 @@ "\u001b[0;36m📜 awesome-bash-cli: abcli/config.env: 13 env var(s)\u001b[0m\n", "\u001b[0;36m🔋 gpu: not found.\u001b[0m\n", "\u001b[0;36m🚀 abcli-9.163.1.current\u001b[0m\n", - "\u001b[0;36mconfirmed: firms-2024-07-15-20-45-12-54457 does not exist.\u001b[0m\n", - "\u001b[0;36mfirms-2024-07-15-20-45-12-54457 open upload started.\u001b[0m\n" + "\u001b[0;36mconfirmed: firms-2024-07-15-21-43-51-94618 does not exist.\u001b[0m\n", + "\u001b[0;36mfirms-2024-07-15-21-43-51-94618 open upload started.\u001b[0m\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ - ":: firms-2024-07-15-20-45-12-54457 += #open.\n" + ":: firms-2024-07-15-21-43-51-94618 += #open.\n" ] } ], @@ -144,7 +128,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [