Skip to content

Commit 43e9fd1

Browse files
authored
Merge pull request #378 from ClimateImpactLab/dependabot/pip/xarray-2025.1.2
Bump xarray from 2024.3.0 to 2025.1.2 with associated fixes to make sure tests pass.
2 parents 4294b90 + a4d819d commit 43e9fd1

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This is used to build the CI test environment and so Github can track dependencies.
2-
xarray==2024.3.0
2+
xarray==2025.1.2
33
pandas==2.2.3
44
numpy==1.26.4
55
matplotlib==3.10.1

src/dscim/preprocessing/input_damages.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,7 @@ def prep_mortality_damages(
715715

716716
# longest-string gcm has to be processed first so the coordinate is the right str length
717717
gcms = sorted(gcms, key=len, reverse=True)
718+
max_gcm_len = len(gcms[0])
718719

719720
if mortality_version == 0:
720721
scaling_deaths = "epa_scaled"
@@ -808,6 +809,8 @@ def prep(
808809
if damages[v].dtype == object:
809810
damages[v] = damages[v].astype("unicode")
810811

812+
damages["gcm"] = damages["gcm"].astype("U" + str(max_gcm_len))
813+
811814
if i == 0:
812815
damages.to_zarr(
813816
f"{outpath}/impacts-darwin-montecarlo-damages-v{mortality_version}.zarr",

tests/test_main_recipe.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,11 +258,11 @@ def test_weitzman_min(menu_instance):
258258
diff = censored_values_slower[0:index] - censored_values[0:index]
259259
assert all(x > 0 for x in diff)
260260
as_share = menu_instance.weitzman_min(
261-
[20, 50, 100], [5, 30, 60], as_share
261+
np.array([20, 50, 100]), np.array([5, 30, 60]), as_share
262262
) # the first value only should be censored
263263
assert as_share[0] != 5 and [as_share[1], as_share[2]] == [30, 60]
264264
all_cons = menu_instance.weitzman_min(
265-
[20, 50, 100], [5, 30, 60], all_cons
265+
np.array([20, 50, 100]), np.array([5, 30, 60]), all_cons
266266
) # all values should be changed
267267
assert all([x != 0 for x in all_cons - [5, 30, 60]])
268268

0 commit comments

Comments
 (0)