Skip to content

How to calculate the frequency for SPEI-6 index? #1594

Answered by aulemahal
CGL5230 asked this question in Questions
Discussion options

You must be logged in to vote

Hi @CGL5230 !

Your draft has the basic idea. The simplest way I see to make this calculation would be without xclim, with only xarray basics:

is_drought = (spi6 < drought_threshold)
drought_freq = 100 * is_drought.resample(time='YS').sum() / spi6.notnull().resample(time='YS').sum()
drought_freq.attrs.update(long_name='Drought frequency', units='%')

Instead other counting the number of elements in the timeseries directly like you did, I counted the number of "non-null" (valid) values of SPI6. For usual climate simulation data, this makes almost no difference, but it would be more robust in the case of observations, IMO.

Also, I computed the annual drought freq. You could always aggregate t…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by CGL5230
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants