Skip to content

How to work in water/hydrological year rather than calendar year to compute indices? #1588

Answered by aulemahal
ArcticSnow asked this question in Questions
Discussion options

You must be logged in to vote

Hi @ArcticSnow (cool name btw)

When it comes to "resampling frequencies", xclim follows xarray which itself follows a subset of pandas. This page of the doc shows a bunch of examples : https://docs.xarray.dev/en/stable/generated/xarray.cftime_range.html

Thus, a "year" is always 12 months, but you can choose the month it starts in. For example, for computing the freezing degree days accumulation from the 1st of October to the 31st of September, one would do:

import xclim as xc

# ... data stuff ...

out = xc.atmos.freezing_degree_days(tas=ds.tas, freq='AS-OCT')

Here the result has the accumulation from (say) "2022-10-01" to "2023-09-31" assigned to the date "2022-10-01".

Does this fill you…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Zeitsperre
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support Questions and help for users/developers
2 participants
Converted from issue

This discussion was converted from issue #1320 on January 10, 2024 18:27.