From bc3a0c906021c4c685478dba9301b8288d01f858 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 20 Feb 2025 00:44:30 +0000 Subject: [PATCH 1/3] Bump xarray from 2024.3.0 to 2025.1.2 Bumps [xarray](https://github.com/pydata/xarray) from 2024.3.0 to 2025.1.2. - [Release notes](https://github.com/pydata/xarray/releases) - [Changelog](https://github.com/pydata/xarray/blob/main/HOW_TO_RELEASE.md) - [Commits](https://github.com/pydata/xarray/compare/v2024.03.0...v2025.01.2) --- updated-dependencies: - dependency-name: xarray dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index da9e0ae0..436c3aac 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # This is used to build the CI test environment and so Github can track dependencies. -xarray==2024.3.0 +xarray==2025.1.2 pandas==2.2.3 numpy==1.26.4 matplotlib==3.10.0 From 72ab4f63d05db28421c1213f1c62775696c5ce2f Mon Sep 17 00:00:00 2001 From: Jonah Gilbert Date: Wed, 14 May 2025 13:51:32 -0500 Subject: [PATCH 2/3] More strictly define data types --- src/dscim/preprocessing/input_damages.py | 3 +++ tests/test_main_recipe.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/dscim/preprocessing/input_damages.py b/src/dscim/preprocessing/input_damages.py index e55f6bb0..d43beb87 100644 --- a/src/dscim/preprocessing/input_damages.py +++ b/src/dscim/preprocessing/input_damages.py @@ -715,6 +715,7 @@ def prep_mortality_damages( # longest-string gcm has to be processed first so the coordinate is the right str length gcms = sorted(gcms, key=len, reverse=True) + max_gcm_len = len(gcms[0]) if mortality_version == 0: scaling_deaths = "epa_scaled" @@ -808,6 +809,8 @@ def prep( if damages[v].dtype == object: damages[v] = damages[v].astype("unicode") + damages['gcm'] = damages['gcm'].astype("U" + str(max_gcm_len)) + if i == 0: damages.to_zarr( f"{outpath}/impacts-darwin-montecarlo-damages-v{mortality_version}.zarr", diff --git a/tests/test_main_recipe.py b/tests/test_main_recipe.py index e69c3958..28b0b3e2 100644 --- a/tests/test_main_recipe.py +++ b/tests/test_main_recipe.py @@ -258,11 +258,11 @@ def test_weitzman_min(menu_instance): diff = censored_values_slower[0:index] - censored_values[0:index] assert all(x > 0 for x in diff) as_share = menu_instance.weitzman_min( - [20, 50, 100], [5, 30, 60], as_share + np.array([20, 50, 100]), np.array([5, 30, 60]), as_share ) # the first value only should be censored assert as_share[0] != 5 and [as_share[1], as_share[2]] == [30, 60] all_cons = menu_instance.weitzman_min( - [20, 50, 100], [5, 30, 60], all_cons + np.array([20, 50, 100]), np.array([5, 30, 60]), all_cons ) # all values should be changed assert all([x != 0 for x in all_cons - [5, 30, 60]]) From 26bfb170734462f6790884f21df1544bc40069ed Mon Sep 17 00:00:00 2001 From: Jonah Gilbert Date: Wed, 14 May 2025 13:56:16 -0500 Subject: [PATCH 3/3] Add necessary requirement for current version of zarr --- requirements.txt | 1 + src/dscim/preprocessing/input_damages.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 436c3aac..f35043da 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,3 +15,4 @@ h5netcdf==1.5.0 impactlab-tools==0.6.0 p_tqdm==1.4.2 pyarrow==19.0.0 +numcodecs==0.15.1 diff --git a/src/dscim/preprocessing/input_damages.py b/src/dscim/preprocessing/input_damages.py index d43beb87..a5d71a35 100644 --- a/src/dscim/preprocessing/input_damages.py +++ b/src/dscim/preprocessing/input_damages.py @@ -809,7 +809,7 @@ def prep( if damages[v].dtype == object: damages[v] = damages[v].astype("unicode") - damages['gcm'] = damages['gcm'].astype("U" + str(max_gcm_len)) + damages["gcm"] = damages["gcm"].astype("U" + str(max_gcm_len)) if i == 0: damages.to_zarr(