cerfacs-globc / icclim

icclim: Python library for climate indices and climate indicators calculation.
https://icclim.readthedocs.io/en/latest/
Apache License 2.0
80 stars 32 forks source link

Make RXXpTOT indices accept both "%" (ETCCDI) and "mm" (ECA&D) as output unit. #73

Open jackaranda opened 3 years ago

jackaranda commented 3 years ago

The calculation of R90pTOT and R95pTOT use the generic function RXXpTOT defined in util/calc.py. This function calculates the sum of rainfall exceeding the percentile values provided but should calculate the ratio of this relative to the total rainfall values.

I have implemented a fix which I can contribute.

pagecp commented 3 years ago

If you look at the definition of RxxpTOT, we have: https://www.rdocumentation.org/packages/climdex.pcic/versions/1.1-11/topics/climdex.r95ptot

This function takes a climdexInput object as input and computes the climdex index R95pTOT: the annual sum of precipitation in days where daily precipitation exceeds the 95th percentile of daily precipitation in the base period.

And from the icclim documentation:

out_unit

Percentile-based indices (TX10p, TX90p, TN10p, TN90p, TG10p, TG90p, R75p, R95p and R99p) could be returned as number of days (out_unit = “days”) or as percentage of days (out_unit = “%”).

So we should have % only in the case we have out_unit as %.

jackaranda commented 3 years ago

Yes, I think there are some different definitions. In https://www.ecad.eu/documents/atbd.pdf which is referenced in the icclim documentation it is definied as the precipitation fraction. But I agree, in the original http://etccdi.pacificclimate.org/list_27_indices.shtml is defined as the sum, as you describe above. Up to you which one we stick to!

R95pTOT Precipitation fraction due to very wet days (>95th percentile) (%)

Let RRj be the sum of daily precipitation amount for period j and let RRwj be the daily precipitation amount at wet day w(RR≥1.0 mm) of period j and RRwn95 the 95th percentile of precipitation at wet days in the1961–1990 period. ThenR95pT OTjis determined as:

R95pTOTj= 100×∑Ww=1RRwj, where RRwj> RRwn95RRj

Sorry, copy from PDF doesn't work very well!

pagecp commented 3 years ago

Hmmm very good question! If I change it now it may break things for some users. I think initially the ETCCDI definition was taken, but I should put a warning somewhere about it because it differs from ECAD... So for now I think I would leave it as not in % unless the out_unit is %.

jackaranda commented 3 years ago

Yes, okay, makes sense not to risk breaking things for others. Though just to note, as far as I can see, out_unit only applies to RXXp indices, not RXXpTOT. The units for RXXpTOT should be mm, which it currently is.

pagecp commented 3 years ago

Maybe I should extend that to RxxpTOT so that users can choose if they want % instead of the default mm

jackaranda commented 3 years ago

That is a nice solution actually. Happy to have a look at implementing it.

pagecp commented 3 years ago

Yes, if you want you can have a look at implementing it!

bzah commented 2 years ago

With icclim 5.0.0 we now follow the ECA&D definition of RxxpTot. I think we should keep this issue open for now because it is unclear which definition will be sanctified in the end.

BTW, re-adding the ETCCDI definition would likely need a PR on xclim if we still want to have both.

pagecp commented 2 years ago

We need to wait for the decisions that will take place within the next week with other international partners. Those standards will impact this issue.

bzah commented 2 years ago

Cross references

xclim: https://github.com/Ouranosinc/xclim/issues/1035 clix-meta: https://github.com/clix-meta/clix-meta/issues/53 climpact: https://github.com/ARCCSS-extremes/climpact/issues/87

Zeitsperre commented 7 months ago

Hey, we were wondering what the status is with this issue. Any news?

bzah commented 7 months ago

Hi @Zeitsperre, For now, on icclim, we only provide the ECAD equivalent of R75pTOT (or 95p, 99p) via the generic index fraction_of_total.

I don't think anyone has worked on this topic across the different packages. I have updated my "cross ref" comment above with the related issues for xclim, climpact and clix-meta. @pagecp are you aware of something new regarding these indices ?

pagecp commented 7 months ago

There is nothing new on these indices. The latest discussions we had were pointing out to have a different name for the RxxpTOT indice if the output unit is different. This is what I recall from the other point of vue.

On Mar 13, 2024, at 3:51 PM, Abel Aoun @.***> wrote:

Hi @Zeitsperre https://github.com/Zeitsperre, For now, on icclim, we only provide the ECAD equivalent of R75pTOT (or 95p, 99p) via the generic index fraction_of_total.

I don't think anyone has worked on this topic across the different packages. I have updated my "cross ref" comment above with the related issues for xclim, climpact and clix-meta. @pagecp https://github.com/pagecp are you aware of something new regarding these indices ?

— Reply to this email directly, view it on GitHub https://github.com/cerfacs-globc/icclim/issues/73#issuecomment-1994579108, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABXZ3SRVM7HLHBWQ5CX36CTYYBRVRAVCNFSM5ACICMLKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJZGQ2TOOJRGA4A. You are receiving this because you were mentioned.