Project

General

Profile

Analysis of extreme indices over monthly basis over years?

Added by ankit bhandari over 3 years ago

I have written the code for calculating extreme indices over monthly basis for every year, but my code is running infinity over the period? As I am having 4 years and i want to calculate in on monthly for every year. I want to know where is the mistake in code.

infile=RCP2021-2024.nc

times=$(cdo -s showyear $infile)
times1=$(cdo -s showmon $infile)

for year in ${times}
do
for month in ${times1}
do

cdo eca_cdd,1  -selyear,$year -selmon,$month  $infile fd_${year}_${month}.nc
done
done
exit

cdo mergetime fd_*.nc RCP2021-2024_merge.nc

exit

Please reply?

RCP2021-2024.nc (14.9 MB) RCP2021-2024.nc Input file

Replies (1)

RE: Analysis of extreme indices over monthly basis over years? - Added by Karin Meier-Fleischer over 3 years ago

Hi Ankit,

I can't reproduce the problem using your script with the given file. I've got 24 fd_ files
and 48 time steps in RCP2021-2024_merge.nc after deleting the first exit below the second done.
But you shouldn't loop over the times1 months because it includes multiples of '4 5 6 7 8 9'
use 'for month in 4 5 6 7 8 9' instead.

-Karin

    (1-1/1)