settaxis collapses time variable
Added by Angela Meyer over 10 years ago
Hi,
My 'time' variable in ifile.nc has values 0, 1, 2, ..., 754, 755. I'd like to convert them to values 1951-01-16,12:00; 1951-02-16,12:00; .. ; 2013-12-16,12:00.
After setting the time axis, my time dimension is collapsed to size 1 though (taking the value of only the first time step, 1951-01-16,12:00):
ncdump -v,time ifile.nc
results innetcdf ifile {
dimensions:
z = 756 ;
variables:
float data(z) ;
float time(z) ;
data:
time = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
...
752, 753, 754, 755 ;
}
Setting the time axis (cdo settaxis,1951-01-16,12:00,1mon ifile.nc ofile.nc
) results in:Warning (cdfDefVar) : Changed double entry of variable name 'time' to 'time_2'!
cdo settaxis: Processed 1512 values from 2 variables over 1 timestep ( 0.00s )
The resulting file ofile.nc has only one time step:ncdump -v,time ofile.nc
netcdf ofile {
dimensions:
x = 756 ;
time = UNLIMITED ; // (1 currently)
variables:
double time(time) ;
time:standard_name = "time" ;
time:units = "month as %Y%m.%f" ;
time:calendar = "proleptic_gregorian" ;
float data(time, x) ;
float time_2(time, x) ;
// global attributes:
:CDI = "Climate Data Interface version 1.6.4 (http://code.zmaw.de/projects/cdi)" ;
:Conventions = "CF-1.4" ;
data:
time = 195101.5 ;
}
Thanks for any hints on how to get my time axis right!
Replies (1)
RE: settaxis collapses time variable - Added by Uwe Schulzweida over 10 years ago
The variable with the name time in your example appears in CDO as a data variable. The CDO operator settaxis can only change the time axis if it is a coordinate variable. The minimum requirement of a coordinate variable is that the dimension has the same name as the variable. That means you have to rename the dimension z to time.
ncrename -d z,time filename.nc