Project

General

Profile

Regarding :eca_r95p indices for years

Added by jyoti lodha almost 4 years ago

Hello
I tried using eca_r95p indices on my precipitation data, but I am not getting the correct results, I am getting null values in the return.
I am attaching my script and my data. Please it is requested from you to look at my script where is the mistake.

1 : Date Time Level Gridsize Miss : Minimum Mean Maximum : Parameter name
1 : 2010-09-30 06:00:00 0 5325 2780 : 0.0000 0.0000 0.0000 : very_wet_days_wrt_95th_percentile_of_reference_period

My script:

#!/bin/ksh

infile=2007-2010_ERA_Daily.nc
times=$(cdo -s showyear $infile)

for year in ${times}
do
cdo -ydaypctl,95 -selyear,$year $infile -ydaymin $infile -ydaymax $infile day95_${year}.nc

cdo -gec,1 -selyear,$year $infile wetday_${year}.nc
cdo -setmissval,nan wetday_${year}.nc wetday1_${year}.nc

done

cdo mergetime wetday1*.nc wetdayall.nc

cdo mergetime day95*.nc day95all.nc

cdo eca_r95p wetdayall.nc day95all.nc fdall.nc

exit


Replies (4)

RE: Regarding :eca_r95p indices for years - Added by jyoti lodha almost 4 years ago

Dear
@Karin Meier-Fleischer or and Ralf Mueller Please reply. Is there any solution to my problem. As I am able to solve it in R language using the Climdex package as it requires a minimum of 3 years and it cannot perform on seasonal datasets. I am waiting for your reply.

RE: Regarding :eca_r95p indices for years - Added by Fabian Wachsmann almost 4 years ago

Dear jyoti lodha,

Null values is the correct result for your approach. Since you have only maximal 4 values per day, the 95th percentile is the maximum of the time series resulting in null values for the index. In general, I cannot see the point in what you are trying to do. You have a time series of 4 years - why would you like to calculate a percentile of 4 values per day?

On top of that, it is nonsense to put

 cdo -ydaypctl,95 -selyear,$year $infile -ydaymin $infile -ydaymax $infile day95_${year}.nc

in the time loop since "cdo info -sub -selyear,2007 $infile day95_2007.nc" is null...

You could extend the histogram for percentile-calculation by using a window i.e. using

cdo ydrunpctl

HOWEVER you still have very few values each day.

Please also consider:
  • The percentile should be calculated based on wet day precipitation. Therefore, you should set precip amounts lower than 1 to missval before calculating the percentile, e.g. by:
    cdo setrtomiss,0,1 $infile ${infile}wet
  • I do not understand cdo -gec,1 -selyear,$year $infile wetday_${year}.nc . Is this an approach for the latter point?
  • Check what method you like to use for percentile calculation - there are thousand.
  • You want to compare the resulting index with an index for another time period? Check if you need to do bootstrapping.

Best,
Fabi

RE: Regarding :eca_r95p indices for years - Added by jyoti lodha almost 4 years ago

Thanks, Fabi for your reply. I was eagerly waiting for this reply. :)

My aim is To compute the percentage of wet days where the daily precipitation amount is greater than the 95th
percentile of the daily precipitation amount on wet days for the historical period(2007-2010).

1) Step- I calcuate the wet days by
cdo -mul 2007-2010_ERA_Daily.nc -gec,1 2007-2010_ERA_Daily.nc wet_input.nc
2)Step-I calculated the days greater than zero.

cdo -ifthen -gtc,0 wet_input.nc wet_input.nc wet_days_precipitation.nc

3)After performing the above step I was step I was getting NAN values where I am getting zero precipitation and I am not able to perform :

cdo ydrunpctl,90,488 wet_days_precipitation.nc -ydrunmin wet_days_precipitation.nc -ydrunmax wet_days_precipitation.nc ofile

as I am getting segmentation fault error. and it is taking long hours to perform this step.

How I can solve this error, and replace NAN with 1, as I tried various options, setrtomiss,setvrange etc. But it could not work. Please help me out.
I will wait for your reply.

RE: Regarding :eca_r95p indices for years - Added by Fabian Wachsmann almost 4 years ago

Dear jyoti lodha,

are you really interested in percentiles for each day of a time series of 4 years?

If you try

cdo ydrunpctl,90,488

with 488 days, you take into account nearly the whole time series for each day.

I think this would be a different approach. The percentile would be be more reliable but you would calculate something different than the eca index.
In that case, do

cdo timpctl,90

instead of ydrunpctl.

and then count the days above that percentile.

If you however persist to calculate the eca index, decrease the number of days for the window in the pctl and also specify it for the ydrunmin and ydrunmax. I.e., do:

cdo ydrunpctl,90,10 wet_days_precipitation.nc -ydrunmin,10 wet_days_precipitation.nc -ydrunmax,10 wet_days_precipitation.nc ofile

The NANs in the wet_days should not be a problem for calculating the pctl. I could not reproduce it. My approach is:

cdo setrtomiss,0,1 infile wetdays.nc

Best,
Fabi

    (1-4/4)