How to work in water/hydrological year rather than calendar year to compute indices? #1588
-
Setup Information
Thank you for the great library! It might be a simple thing, bu I cannot figure out how to compute a number of the atmospheric indices (e.g. freezing degree day) for water years rather than calendar year? My focuses on winters and such options would very useful. Thank you. ContextNo response Code of Conduct
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
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 your need ? |
Beta Was this translation helpful? Give feedback.
-
Awesome! That was it! |
Beta Was this translation helpful? Give feedback.
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:
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…