Time axis manipulations
Added by Kevin Havener almost 6 years ago
Trying to set a time axis from absolute to relative; calendar begins 1800-01-01, data begins 1891-01-01 and time value is first day of the month.
I used: cdo settunits,days -settaxis,1800-01-01,00:00:00,1month precip_climo.nc test1.nc
The metadata says the calendar starts in 1800-01-01, but the first values of the time axis are 0, 31, 59, ...; not 33237, 33268, 33296, ... as I expected.
How do I account for the offset between the calendar start and the data start?
Replies (7)
RE: Time axis manipulations - Added by Ralf Mueller almost 6 years ago
hi!
cdo -rwith any operator. docu is available with
cdo -h
hth
ralf
RE: Time axis manipulations - Added by Kevin Havener almost 6 years ago
Well, I also tried: cdo -r -f nc copy,settaxis,1800-01-01,00:00:00,1day precip_climo.nc test1.nc with the same result.
Sadly, the documentation doesn't help much because I am unable to ask the right question of it. I've been searching it for a couple of days now to try to understand what's going on, but there is some fundamental concept I must be missing. I a also unable to ask Google the right question, either.
RE: Time axis manipulations - Added by Ralf Mueller almost 6 years ago
cdo -r -f nc copy,settaxis,1800-01-01,00:00:00,1day precip_climo.nc test1.ncis worng.
copy
and settaxis
are two operators. the correct for only switching to a relative axis is cdo -r -f nc -copy precip_climo.nc test1.ncIf you want to set the dates, intervals and units with relative axis you use
cdo -r-f nc -settaxis,1800-01-01,00:00:00,1day precip_climo.nc test1.nc
you might upload the input file for further help
RE: Time axis manipulations - Added by Uwe Schulzweida almost 6 years ago
You have to combine settaxis with setreftime:
cdo setreftime,1800-01-01,00:00:00,days -settaxis,1891-01-01,00:00:00,1month infile outfile
RE: Time axis manipulations - Added by Kevin Havener almost 6 years ago
Well that was even worse, it just numbers the months from 1 to 1537. I am uploading the first year of the file. Even zipped it was too large to send the whole thing.
precip_climo_test.nc (2.97 MB) precip_climo_test.nc | First year of GPCC monthly precip climatology |
RE: Time axis manipulations - Added by Kevin Havener almost 6 years ago
I guess our conversation crossed paths. That syntax worked. Couldn't figure out the relationship between setreftime and settaxis. Thank you for clearing that up.
RE: Time axis manipulations - Added by Ralf Mueller almost 6 years ago
I used Uwe's call and upload the data:
double time(time) ; time:standard_name = "time" ; time:units = "days since 1800-1-1 00:00:00" ; time:calendar = "proleptic_gregorian" ; time:axis = "T" ; time = 33237, 33268, 33296, 33327, 33357, 33388, 33418, 33449, 33480, 33510, 33541, 33571 ;
I used cdo-1.9.6