Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 19, 2024
1 parent 14b44bd commit 9d65ca1
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions xclim/indices/_agro.py
Original file line number Diff line number Diff line change
Expand Up @@ -1624,19 +1624,17 @@ def chill_units(tas: xarray.DataArray, freq: str = "YS") -> xarray.DataArray:
xr.DataArray
"""
tas = convert_units_to(tas, "degC")
cu = (
cu = xarray.where(
(tas <= 1.4) | ((tas > 12.4) & (tas <= 15.9)),
0,
xarray.where(
(tas <= 1.4) | ((tas > 12.4) & (tas <= 15.9)),
0,
((tas > 1.4) & (tas <= 2.4)) | ((tas > 9.1) & (tas <= 12.4)),
0.5,
xarray.where(
((tas > 1.4) & (tas <= 2.4)) | ((tas > 9.1) & (tas <= 12.4)),
0.5,
xarray.where(
(tas > 2.4) & (tas <= 9.1),
1,
xarray.where((tas > 15.9) & (tas <= 17.9), -0.5, -1),
),
(tas > 2.4) & (tas <= 9.1),
1,
xarray.where((tas > 15.9) & (tas <= 17.9), -0.5, -1),
),
)
),
)
return cu.resample(time=freq).sum().assign_attrs(units="")

0 comments on commit 9d65ca1

Please sign in to comment.