Duplicating data set numerous times to single output.
Added by Holly Ayres over 5 years ago
Hello,
A seemingly easy question (I am still getting to grips with CDO), I have a 12 month data set, I want to create a new file that repeats this exact data set for 30 years (a new file with 360 months). What operator would be best for this?
Thank you,
Holly
Replies (1)
RE: Duplicating data set numerous times to single output. - Added by Karin Meier-Fleischer over 5 years ago
Hi Holly,
what do you want to do with the file afterwards? Same data for 30 years continuing timesteps?
You can use the cat operator to concatenate the file in a loop 30times, but you will have the same timesteps for all 30 years. If you want to have continuing timesteps, year1, year2, ..., year30, than you have to write a little script and shift the time for each year.
Snippet of ksh-script:
cdo copy infile.nc infile_cat.nc for i in $(seq 1 30) do shift="${i}year" cdo -shifttime,${shift} infile.nc next_year.nc cdo -cat infile_cat.nc next_year.nc tmp.nc mv tmp.nc infile_cat.nc done
-Karin