Skip to content

Commit

Permalink
Merge branch 'main' into prepare-v0530
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeitsperre authored Oct 17, 2024
2 parents 7eeb41a + 5562ac7 commit b5648cf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
8 changes: 4 additions & 4 deletions tests/test_indices.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,12 +494,12 @@ def test_effective_growing_degree_days(
class TestStandardizedIndices:
# gamma/APP reference results: Obtained with `monocongo/climate_indices` library
# MS/fisk/ML reference results: Obtained with R package `SPEI`
# Using the method `APP` in XClim matches the method from monocongo, hence the very low
# tolerance possible.
# Using the method `APP` in XClim matches the method from monocongo, hence the very low tolerance possible.
# Repeated tests with lower tolerance means we want a more precise comparison, so we compare
# the current version of XClim with the version where the test was implemented
# the current version of XClim with the version where the test was implemented.
# Additionally, xarray does not yet access "week" or "weekofyear" with groupby in a pandas-compatible way for cftime objects.
# See: https://github.com/pydata/xarray/discussions/6375
@pytest.mark.slow
@pytest.mark.filterwarnings("ignore:dt.weekofyear and dt.week have been deprecated")
@pytest.mark.parametrize(
"freq, window, dist, method, values, diff_tol",
[
Expand Down
1 change: 0 additions & 1 deletion tests/test_sdba/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ def test_grouper_get_index(tas_series, group, interp, val90):

# xarray does not yet access "week" or "weekofyear" with groupby in a pandas-compatible way for cftime objects.
# See: https://github.com/pydata/xarray/discussions/6375
@pytest.mark.filterwarnings("ignore:dt.weekofyear and dt.week have been deprecated")
@pytest.mark.slow
@pytest.mark.parametrize(
"group,n",
Expand Down
2 changes: 1 addition & 1 deletion xclim/indices/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ def reindex_time(da, da_ref, group):
da = da.rename(month="time").reindex(time=da_ref.time.dt.month)
da["time"] = da_ref.time
elif group == "time.week":
da = da.rename(week="time").reindex(time=da_ref.time.dt.week)
da = da.rename(week="time").reindex(time=da_ref.time.dt.isocalendar().week)
da["time"] = da_ref.time
# I don't think rechunking is necessary here, need to check
return da if not uses_dask(da) else da.chunk({"time": -1})
Expand Down

0 comments on commit b5648cf

Please sign in to comment.