From 219b98e3a81e9220d3c252e440dd90843952bfa2 Mon Sep 17 00:00:00 2001 From: Adam Crawford Date: Mon, 13 Nov 2023 10:41:09 -0800 Subject: [PATCH] More small changes. --- eedl/__init__.py | 2 +- eedl/image.py | 4 ++-- examples/get_gridmet_eto.py | 6 +++--- examples/scv_et_rework.py | 15 ++++++++------- setup.cfg | 2 +- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/eedl/__init__.py b/eedl/__init__.py index 117de8c..36fcc4d 100644 --- a/eedl/__init__.py +++ b/eedl/__init__.py @@ -1 +1 @@ -__version__ = "0.2023.11.8" +__version__ = "0.2023.11.13" diff --git a/eedl/image.py b/eedl/image.py index 9ce14a1..ddc0387 100644 --- a/eedl/image.py +++ b/eedl/image.py @@ -226,7 +226,7 @@ def wait_for_images(self, time.sleep(sleep_time) if len(self.failed_tasks) > 0: - message = f"{len(self.failed_tasks)} images failed to export. Example error message from first" \ + message = f"{len(self.failed_tasks)} image(s) failed to export. Example error message from first" \ f" failed image \"{self.failed_tasks[0].last_task_status['description']}\" was" \ f" \"{self.failed_tasks[0].last_task_status['error_message']}\"." \ f" Check https://code.earthengine.google.com/tasks in your web browser to see status and" \ @@ -373,7 +373,7 @@ def export(self, clip (Optional[ee.geometry.Geometry]): Defines the region of interest for export - does not perform a strict clip, which is often slower. Instead, it uses the Earth Engine export's "region" parameter to clip the results to the bounding box of the clip geometry. To clip to the actual geometry, set strict_clip to True. - strict_clip (Optional[bool]: When set to True, performs a true clip on the result so that it's not just the bounding box but also the + strict_clip (Optional[bool]): When set to True, performs a true clip on the result so that it's not just the bounding box but also the actual clipping geometry. Defaults to False. drive_root_folder (Optional[Union[str, Path]]): The folder for exporting if "drive" is selected. diff --git a/examples/get_gridmet_eto.py b/examples/get_gridmet_eto.py index 59828ab..e8f12f0 100644 --- a/examples/get_gridmet_eto.py +++ b/examples/get_gridmet_eto.py @@ -4,10 +4,10 @@ ee.Initialize() -def get_days(month, year): +def get_days(input_month: str, input_year: int) -> int: days = { '01': 31, - '02': 28 if not year == 2020 else 29, + '02': 28 if not input_year == 2020 else 29, '03': 31, '04': 30, '05': 31, @@ -20,7 +20,7 @@ def get_days(month, year): '12': 31 } - return days[month] + return days[input_month] years = (2019, 2020, 2021) diff --git a/examples/scv_et_rework.py b/examples/scv_et_rework.py index 19c1a9d..241cc41 100644 --- a/examples/scv_et_rework.py +++ b/examples/scv_et_rework.py @@ -1,17 +1,15 @@ import os -from typing import Iterable +from typing import Iterable, Optional import ee from ee import ImageCollection -# we should change the name of our Image class - it conflicts with the class image in the ee package, and people will -# likely be using both. Let's not cause confusion from eedl.image import EEDLImage import eedl ee.Initialize() -def scv_data_download_for_year(year, openet_collection=r"OpenET/ENSEMBLE/CONUS/GRIDMET/MONTHLY/v2_0", band="et_ensemble_mad") -> Iterable: +def scv_data_download_for_year(year: str, openet_collection: str = r"OpenET/ENSEMBLE/CONUS/GRIDMET/MONTHLY/v2_0", band: str = "et_ensemble_mad") -> Iterable[EEDLImage, EEDLImage]: geometry = ee.FeatureCollection("users/nrsantos/vw_extraction_mask").geometry() # so, we need two images per year - one is for all months, the other is for just the winter months @@ -52,7 +50,7 @@ def scv_data_download_for_year(year, openet_collection=r"OpenET/ENSEMBLE/CONUS/G folder="vw_et_update_2023" ) - return (annual_export_image, winter_export_image) + return annual_export_image, winter_export_image # return (annual_export_image, ) @@ -64,8 +62,11 @@ def scv_data_download_for_year(year, openet_collection=r"OpenET/ENSEMBLE/CONUS/G } -def download_updated_vw_et_images_by_year(download_folder=r"D:\vw_et_update_2023", - field_boundaries=field_boundaries_by_year) -> None: +def download_updated_vw_et_images_by_year(download_folder: str = r"D:\vw_et_update_2023", + field_boundaries: Optional[dict[str: str]] = None) -> None: + if field_boundaries is None: + field_boundaries = field_boundaries_by_year + exports_by_year = {} print("Running exports") diff --git a/setup.cfg b/setup.cfg index 3431f06..a6d9582 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,7 +7,7 @@ long_description_content_type=text/markdown long_description=file: README.md platforms = unix, linux, osx, cygwin, win32 url = https://github.com/water3d/eedl -version = 0.2023.11.8 +version = 0.2023.11.13 classifiers = Programming Language :: Python :: 3 Programming Language :: Python :: 3 :: Only