Skip to content

Commit

Permalink
order
Browse files Browse the repository at this point in the history
  • Loading branch information
juliettelavoie committed Jan 6, 2025
1 parent 31b73c9 commit 0887677
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/xclim/ensembles/_partitioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,9 @@ def general_partition(
# Mean projection:
# This is not part of the original algorithm,
# but we want all partition algos to have similar outputs.
g = sm.mean(dim=all_types)
g = sm.mean(dim=all_types[0])
for dim in all_types[1:]:
g = g.mean(dim=dim)

return g, uncertainty

Expand Down
5 changes: 5 additions & 0 deletions tests/test_partitioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ def test_general_partition(lafferty_sriver_ds):
var_first=["model", "downscaling"],
mean_first=["scenario"],
weights=["model", "downscaling"],
sm="poly",
)
# fix order
u2 = u2.sel(
uncertainty=["model", "scenario", "downscaling", "variability", "total"]
)

assert u1.equals(u2)
Expand Down

0 comments on commit 0887677

Please sign in to comment.