monocongo/climate_indices

SPEI calculation

Yassminaa opened this issue · 2 comments

Hi @monocongo

i wonder why the code add 1000 to the P_minus_pet in SPEI calculation?

additionally, i face an issue in calculating SPEI using W5E5 data. the error is (ValueError: Unable to calculate Pearson Type III parameters due to invalid L-moments)

The error was fixed when i removed 1000 from the index calculation in terms of running the code but i have a lot of masked values over the map.
any suggestion?

Thanks

Hi @Yassminaa

When we first developed the SPEI it was necessary to add an offset to make sure we always have a positive value, so we went with 1000. There must be a more elegant approach and apparently it's not necessary in your case.

If you post a link to your data I may be able to work out what's happening to cause your error. Please post the stack trace that shows where/how it croaked.

Thanks @monocongo for your reply

and is this offset value not affect the result?

regarding the data the temp here: https://data.isimip.org/datasets/96369b63-4fbf-4b90-8b58-79e5f50a385a/
and precipitation is here: https://data.isimip.org/datasets/a5f9441d-92e4-42ca-bb57-c9997c9a89b4/

the pet, spi is correctly calculated but the error is in SPEI.