I want to calculate heat wave occurence on the basis of percentiles. The maximum temperature has to be greater than the 90th percentile for at least three consecutive days. How can I calculate this part using cdo
.
I tried to solve it using the following approach
cdo ge infile.nc 90thpctl.nc 1.nc
cdo runsum,3 1.nc 2.nc
cdo gec,3 2.nc 3.nc
cdo timsum 3.nc ndays.nc
Is this the approach to include at least three consecutive days criteria?
So, if
tmax.nc
is your file of daily maximum temperature, then first of all we need to construct the heat wave event by getting a 1 for every day above your 90%tile threshold.We need to modify those approaches to use the percentile based on the time of year to account for seasonality, so we will use the
ydaypctl
function. Often this is smoothed using a 15 day window to make things less noisy when using daily data, so I will apply a 15 day running mean.We also need a long input file for good statistics. *I will assume that the * input file runs from 25th December 1980, to 7th January 2011 so that after I apply the 15 day running mean the daily file has dates that exactly cover 1981 to 2010.
Okay, so now we have a series of 1s for each day above the heatwave threshold, so now we want to look at the length of each and only keep events which are longer than 3 days, for this we can use the consects function