how to calculate monthly and yearly RX5day?Thanks.
Added by Wi Du almost 8 years ago
Anyone uses CDO to calculate climate extreme indices?
Here, I faced some problems.
For example:
how to calculate the monthly and yearly RX5day incides using cdo eca_rx5day ifile outfile. It is only got a value for this 50 years, but I need the monthly values for each year and yearly value for this 50 years.
Does anybody know this? Plese help me, thanks.
Replies (4)
RE: how to calculate monthly and yearly RX5day?Thanks. - Added by Alvaro Diaz over 7 years ago
Hello Wi Du,
I have the same problem, for another index (CDD), I used cdo eca_cdd ifile outfile, but I found a one value (30 years of data). I want the each year value to calculate the trends in my area.
How are you at dealing this problem?
I thank you in advance for the help.
RE: how to calculate monthly and yearly RX5day?Thanks. - Added by Karin Meier-Fleischer over 7 years ago
Hi Wi and Alvaro,
maybe a short Shell script is a solution. Here is an example using the Korn Shell:
#!/bin/ksh infile="in.nc" outfile="new_outfile.nc" nyears=$(cdo nyear $infile) #-- how many years in infile set -A years $(cdo -s showyear $infile) #-- retrieve the years y=${years[0]} #-- initialize start year i=1 for ((i=1; i<=$nyears-1; ++i)) #-- loop over all years do y=`expr $y + 1` #-- set year to be selected cdo -eca_rx5day -selyear,$y $infile out_${i}.nc #-- highest five day precipitation amount per selected year done cdo -cat out_*.nc $outfile #-- concatenate yearly output files to new_outfile.nc exit
Maybe this will help.
-Karin
RE: how to calculate monthly and yearly RX5day?Thanks. - Added by John Johnson over 4 years ago
Dear Karin,
I have similar problem. I m using CORDEX DATA and would like to compute rx5day for each month and year for the period of 2021/2050 but the result I am getting is for just one year (2050). I tried your script but there is an error here set -A years $(cdo -s showyear $infile). I got this error >>>set: -A: invalid option.
Has anyone has a solution on how can compute rx5day for each month and year?
Regards
John
RE: how to calculate monthly and yearly RX5day?Thanks. - Added by Ramaraj AP over 4 years ago
Dear karin,
Thanks a lot for the script, it works perfect for me