Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sdba Grouper.get_coordinate after xarray update #2038

Merged
merged 3 commits into from
Jan 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/xclim/sdba/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import xarray as xr
from boltons.funcutils import wraps

from xclim.core.calendar import get_calendar
from xclim.core.calendar import get_calendar, max_doy
from xclim.core.options import OPTIONS, SDBA_ENCODE_CF
from xclim.core.utils import uses_dask

Expand Down Expand Up @@ -195,10 +195,8 @@ def get_coordinate(self, ds: xr.Dataset | None = None) -> xr.DataArray:
if self.prop == "dayofyear":
if ds is not None:
cal = get_calendar(ds, dim=self.dim)
mdoy = max(
xr.coding.calendar_ops._days_in_year(yr, cal)
for yr in np.unique(ds[self.dim].dt.year)
)
# TODO : Change this to `ds[self.dim].dt.days_in_year.max().item()` when minimum xarray is 2024.09
mdoy = max_doy[cal]
aulemahal marked this conversation as resolved.
Show resolved Hide resolved
else:
mdoy = 365
return xr.DataArray(
Expand Down
Loading