How to compute the Warm spell days index wrt 90th percentile of reference period for Italy
Added by Dino Biancolini about 1 year ago
Hello everyone,
I'm new to CDO and I'm trying to apply the functions eca_hwfi or etccdi_wsdi to a database of historical daily temperatures (https://dds.cmcc.it/#/dataset/climate-projections-8km-over-italy/historical), years 1979-2000, months 4-10. The final product that I need is a raster with the warm spell days index.
I've run into a series of problems in my attempts... Could you please illustrate me the procedure?
Please find attached a reduced version of the data (1998-2000) for your tests:
Thank you very much in advance.
Dino
Replies (5)
RE: How to compute the Warm spell days index wrt 90th percentile of reference period for Italy - Added by Karin Meier-Fleischer about 1 year ago
Hi Dino,
from the user 'Climate indices with CDO' documentation (https://code.mpimet.mpg.de/projects/cdo/embedded/cdo_eca.pdf):
eca_hwfi - Warm spell days index w.r.t. 90th percentile of reference period (default 6days)
infile=air_temperature_climate-projections-8km-over-italy_historical_318269.nc
cdo -timpctl,90 $infile -timselmin,5 $infile -timselmax,5 $infile tas_90pctl.nc
#-- to get rid of the error: cdo eca_hwfi (Abort): Input streams have different time values!
cdo -add tas_90pctl.nc -sub $infile $infile tas_90pctl_with_timesteps.nc
cdo eca_hwfi $infile tas_90pctl_with_timesteps.nc outfile.nc
RE: How to compute the Warm spell days index wrt 90th percentile of reference period for Italy - Added by Dino Biancolini about 1 year ago
Thank you very much Dr Meier-Fleischer.
The solution seems to work, however, I'm not sure that it produces what I need.
As the final product, I need a raster with the number of consecutive days above the 90th percentile.
I've tried to run your script for just one year (1979) and for the spring period (months 4-6).
cdo selmonth,4/6 air_temperature_climate-projections-8km-over-italy_historical_308464.nc spring.nc
infile=spring.nc
I've calculated the 90 percentile considering all years as you suggested.
cdo -timpctl,90 $infile -timselmin,5 $infile -timselmax,5 $infile tas_90pctl.nc
cdo -add tas_90pctl.nc -sub $infile $infile tas_90pctl_with_timesteps_spring.nc
Then I calculated the index just for the year 1998
cdo eca_hwfi -selyear,1998 $infile -selyear,1998 tas_90pctl_with_timesteps_spring.nc eca_hwfi_spring_1998.nc
tas_90pctl_with_timesteps_spring is above > 146 MB so here's a google drive link: https://drive.google.com/file/d/1tqBFUrXEibxC9tQx1cU-20gawWA79243/view?usp=sharing
The two variables that I get are:
1. Warm spell day index, ranging from 20 to 90
2. Warm spell periods per period, ranging from 1 to 4.
I'm perplexed about two things:
1. How can this index range from 10 to 80? This year there were up to 80 consecutive days above the 90th percentile? It seems absurd.
2. Also up to 5 warm spells in just 3 months seems a bit off.
I need to produce a final raster with the number of consecutive days > tas_90pctl averaged across the years 1979-2000. Is what am doing really producing what I need?
Thank you very much for your precious assistance.
Dino
RE: How to compute the Warm spell days index wrt 90th percentile of reference period for Italy - Added by Dino Biancolini about 1 year ago
Sorry if I come back at you again, I'm stuck on this issue. Could you please provide me with some guidance? Thanks.
RE: How to compute the Warm spell days index wrt 90th percentile of reference period for Italy - Added by Fabian Wachsmann about 1 year ago
Hi Dino,
here is another try using the more complex etccdi index. Note that usually the daily maximum temperature should be used for this index.
1. Calculate a running min and max :
cdo ydrunmin,5,rm=c $tasmax $tasmaxrunmin
cdo ydrunmax,5,rm=c $tasmax $tasmaxrunmax
you take 5 days into account and `rm=c` means that the last time steps are extending the 5 days for the first time steps of the time series as well as that the first time steps are extending the 5 days of the last time steps.
2. You then calculate the 90th percentile with a specific percentile method (r8) by using:
cdo ydrunpctl,90,5,pm=r8,rm=c $tasmax ${tasmaxrunmin} ${tasmaxrunmax} ${tx90thresh}
Note that cdo creates a histogram for calculating the percentile. If you do not have enough memory, the histogram is created by evenly divide the interval between tasmaxrunmin and tasmaxrunmax into iso-size bins. If you have enough memory to store all values of the entire grid in memory to create sorted histograms, you can set:
export CDO_PCTL_NBINS=$((5*(endyear-startyear+1)*2+2))
This means you need to hold 2 * 5 (window size) * the time series in memory (+2 to be sure) for each grid cell. In this case, tasmaxrunmin and tasmaxrunmax are not really needed for calculation.
3. Afterwards, you calculate the wsdi with:
cdo etccdi_wsdi $tasmax $tx90thresh $cdoWsdi
I hope you have better results with this approach.
Best,
Fabi
RE: How to compute the Warm spell days index wrt 90th percentile of reference period for Italy - Added by Maverick U 9 months ago
Hello Fabi,
I'm interested in calculating the WSDI for only the April to July (summer) months. I have data from 01-01-1980 until 31-12-2022. I'm including all the steps that I followed:
cdo selmonth,4,5,6,7 tmax.nc tmax_summer.nc
cdo ydrunmin,5,rm=c tmax_summer.nc tmax_summer_runmin.nc
cdo ydrunmax,5,rm=c tmax_summer.nc tmax_summer_runmax.nc
cdo ydrunpctl,90,5,pm=r8,rm=c tmax_summer.nc tmax_summer_runmin.nc tmax_summer_runmax.nc tx90thresh.nc
cdo etccdi_wsdi tmax_summer.nc tx90thresh.nc wsdi.nc
I followed exactly the steps you mentioned to calculate WSDI; however, when I did CDO SHOWDATE tx90thresh.nc, I found that the dates are from 01-04-2022 until 29-07-2022. However, the last two dates are from 30-07-2021 and 31-07-2021, which are from 2021. Could you tell me why this happened or if I am doing something wrong?