Skip to content

Commit

Permalink
More small changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamJCrawford committed Nov 13, 2023
1 parent 409db67 commit 219b98e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion eedl/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.2023.11.8"
__version__ = "0.2023.11.13"
4 changes: 2 additions & 2 deletions eedl/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand Down Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions examples/get_gridmet_eto.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -20,7 +20,7 @@ def get_days(month, year):
'12': 31
}

return days[month]
return days[input_month]


years = (2019, 2020, 2021)
Expand Down
15 changes: 8 additions & 7 deletions examples/scv_et_rework.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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, )


Expand All @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 219b98e

Please sign in to comment.