From 5afd8729ab83e9d814bf9fa627afa6cc2901d55a Mon Sep 17 00:00:00 2001 From: Aaron Zuspan Date: Tue, 19 Aug 2025 19:16:49 -0700 Subject: [PATCH 1/2] Replace deprecated utcfromtimestamp with tz-aware timestamp --- test/test_utils.py | 4 +++- wxee/utils.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/test/test_utils.py b/test/test_utils.py index 74301e9..2c9648a 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -255,7 +255,9 @@ def test_normalize(): def test_millis_to_datetime(): """Test that a datetime can be correctly converted from milliseconds""" test_millis = 1594535594000 - test_datetime = datetime.datetime(2020, 7, 12, 6, 33, 14) + test_datetime = datetime.datetime( + 2020, 7, 12, 6, 33, 14, 0, tzinfo=datetime.timezone.utc + ) result = wxee.utils._millis_to_datetime(test_millis) diff --git a/wxee/utils.py b/wxee/utils.py index 03ba38c..42edaf8 100644 --- a/wxee/utils.py +++ b/wxee/utils.py @@ -206,7 +206,9 @@ def _parse_time(time: str) -> Union[datetime.datetime, str]: def _millis_to_datetime(millis: str) -> datetime.datetime: """Convert a timestamp in UTC milliseconds (e.g. from Earth Engine) to a datetime object.""" - return datetime.datetime.utcfromtimestamp(int(millis) / 1000.0) + return datetime.datetime.fromtimestamp( + int(millis) / 1000.0, tz=datetime.timezone.utc + ) def _replace_if_null(val: Union[ee.String, ee.Number], replacement: Any) -> Any: From 2e9e103024f3103209c264ce0e0039c996687c18 Mon Sep 17 00:00:00 2001 From: Aaron Zuspan Date: Tue, 19 Aug 2025 19:17:31 -0700 Subject: [PATCH 2/2] Xarray deprecation and import fixes --- wxee/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wxee/utils.py b/wxee/utils.py index 42edaf8..bd74bc1 100644 --- a/wxee/utils.py +++ b/wxee/utils.py @@ -142,10 +142,10 @@ def _dataset_from_files(files: List[str], masked: bool, nodata: int) -> xr.Datas try: # Allow conflicting values if one is null, take the non-null value - merged = xr.merge(das, compat="no_conflicts") - except xr.core.merge.MergeError: + merged = xr.merge(das, join="outer", compat="no_conflicts") + except xr.MergeError: # If non-null conflicting values occur, take the first value and warn the user - merged = xr.merge(das, compat="override") + merged = xr.merge(das, join="outer", compat="override") warnings.warn( "Different non-null values were encountered for the same variable at the same time coordinate. The first value was taken." )