CDO setyear does not change date
Added by James King about 3 years ago
Hi all,
I am setting up some climate model experiments. I have input files for the year 2010 of an artificial tracer (so the year of the data is not important). For the model to run, these files need to be for the year 2050. I tried cdo setyear,2050 -selyear,2010
but this did not work. Doing
ncdump -v date
shows that the date remains unchanged:
date = 20100115, 20100215, 20100315, 20100415, 20100515, 20100615, 20100715,
20100815, 20100915, 20101015, 20101115, 20101215
which results in the model crashing. Is there a way to change the date in CDO? I need a seasonal cycle of data so I only want to change the year.
Thanks,
James
Replies (4)
RE: CDO setyear does not change date - Added by Karin Meier-Fleischer about 3 years ago
Hi James,
without the data it is hard to help. Can you upload the file?
-Karin
RE: CDO setyear does not change date - Added by James King about 3 years ago
Hi Karin,
File is attached.
Thanks,
James
E90_input_2010.nc (651 KB) E90_input_2010.nc |
RE: CDO setyear does not change date - Added by Karin Meier-Fleischer about 3 years ago
In the data file you are looking at the variable date which can't be changed with setyear because it is a variable not the time coordinate, but you can simply add 400000 to it.
Therefore you have to do three steps (which can be done in two)
- set time dimension to 2050
- select date variable and add 400000
- merge with variable emis_90
Step 1:
cdo -setyear,2050 E90_input_2010.nc out_2050.nc
Step 2 and 3:
cdo -O -merge -selname,emis_e90 outfile_2050.nc -addc,400000 -selname,date out_2050.nc outfile.nc
cdo infon outfile.nc -1 : Date Time Level Gridsize Miss : Minimum Mean Maximum : Parameter name 1 : 2050-01-15 00:00:00 0 13824 0 : 2.7731e+11 2.7731e+11 2.7731e+11 : emis_e90 2 : 2050-01-15 00:00:00 0 1 0 : 2.0500e+07 : date 3 : 2050-02-15 00:00:00 0 13824 0 : 2.7731e+11 2.7731e+11 2.7731e+11 : emis_e90 4 : 2050-02-15 00:00:00 0 1 0 : 2.0500e+07 : date 5 : 2050-03-15 00:00:00 0 13824 0 : 2.7731e+11 2.7731e+11 2.7731e+11 : emis_e90 6 : 2050-03-15 00:00:00 0 1 0 : 2.0500e+07 : date 7 : 2050-04-15 00:00:00 0 13824 0 : 2.7731e+11 2.7731e+11 2.7731e+11 : emis_e90 8 : 2050-04-15 00:00:00 0 1 0 : 2.0500e+07 : date 9 : 2050-05-15 00:00:00 0 13824 0 : 2.7731e+11 2.7731e+11 2.7731e+11 : emis_e90 10 : 2050-05-15 00:00:00 0 1 0 : 2.0501e+07 : date 11 : 2050-06-15 00:00:00 0 13824 0 : 2.7731e+11 2.7731e+11 2.7731e+11 : emis_e90 12 : 2050-06-15 00:00:00 0 1 0 : 2.0501e+07 : date 13 : 2050-07-15 00:00:00 0 13824 0 : 2.7731e+11 2.7731e+11 2.7731e+11 : emis_e90 14 : 2050-07-15 00:00:00 0 1 0 : 2.0501e+07 : date 15 : 2050-08-15 00:00:00 0 13824 0 : 2.7731e+11 2.7731e+11 2.7731e+11 : emis_e90 16 : 2050-08-15 00:00:00 0 1 0 : 2.0501e+07 : date 17 : 2050-09-15 00:00:00 0 13824 0 : 2.7731e+11 2.7731e+11 2.7731e+11 : emis_e90 18 : 2050-09-15 00:00:00 0 1 0 : 2.0501e+07 : date 19 : 2050-10-15 00:00:00 0 13824 0 : 2.7731e+11 2.7731e+11 2.7731e+11 : emis_e90 20 : 2050-10-15 00:00:00 0 1 0 : 2.0501e+07 : date 21 : 2050-11-15 00:00:00 0 13824 0 : 2.7731e+11 2.7731e+11 2.7731e+11 : emis_e90 22 : 2050-11-15 00:00:00 0 1 0 : 2.0501e+07 : date 23 : 2050-12-15 00:00:00 0 13824 0 : 2.7731e+11 2.7731e+11 2.7731e+11 : emis_e90 24 : 2050-12-15 00:00:00 0 1 0 : 2.0501e+07 : date
ncdump -v date outfile.nc ... data: date = 20500115, 20500215, 20500315, 20500415, 20500515, 20500615, 20500715, 20500815, 20500915, 20501015, 20501115, 20501215 ;
RE: CDO setyear does not change date - Added by James King about 3 years ago
Thanks Karin, I will try this solution.