Seldate - removal of 0-dimension variables
Added by François Besson about 9 years ago
Hello,
I would like to select some dates in a nc file using seldate.
In this file two of my variables have no dimension (see below more details about the nc file)
After using seldate the output has no more 0-dimension variables.
Is there a way to keep the 0dimension variables in the output ?
Thanks
François
netcdf bdpe { dimensions: time = UNLIMITED ; // (25 currently) Number_of_points = 3878 ; variables: double time(time) ; time:_FillValue = -9999999. ; time:long_name = "time" ; time:units = "seconds since 2016-02-22 06:00:00" ; double LAT(Number_of_points) ; LAT:_FillValue = -9999999. ; LAT:long_name = "latitude" ; LAT:units = "degrees_north" ; double LON(Number_of_points) ; LON:_FillValue = -9999999. ; LON:long_name = "longitude" ; LON:units = "degrees_east" ; double FORC_TIME_STEP ; FORC_TIME_STEP:_FillValue = -9999999. ; FORC_TIME_STEP:long_name = "Forcing_Time_Step" ; FORC_TIME_STEP:units = "s" ; double FRC_TIME_STP ; FRC_TIME_STP:_FillValue = -9999999. ; FRC_TIME_STP:long_name = "Forcing_Time_Step" ; FRC_TIME_STP:units = "s" ; double Tair(time, Number_of_points) ; Tair:_FillValue = -9999999. ; Tair:long_name = "Near Surface Air Temperature" ; Tair:units = "K" ; ...
Replies (3)
RE: Seldate - removal of 0-dimension variables - Added by Ralf Mueller about 9 years ago
CDO is designed for handling data variables, which means 1d, 2d or 3d and related coordinates (vertical, horizontal, temporal). Note, that 1d has to have a horizontal single point grid do be recognized as a data variable.
What you describe here is a known limitation , that cannot easily be avoided for the variables FRC_TIME_STP
or FORC_TIME_STEP
. But LAT
and LON
get lost, because both are not connected to the Tair
field. Please use the coordinates
attribute to link them together. It should have the value "LON LAT". You can use the nco tool ncatted
for this. It should look like this
ncatted -a coordinates,Tair,c,c,"LON LAT" input.nc
hth
ralf
RE: Seldate - removal of 0-dimension variables - Added by François Besson about 9 years ago
Thanks for your response.
In my case LON and LAT are not lost using seldate.
Here is what I obtain with `cdo seldate,2016-02-22T07:00:00,2016-02-22T08:00:00 bdpe.nc bdpe_court.nc`
netcdf bdpe_court { dimensions: x = 3878 ; time = UNLIMITED ; // (2 currently) variables: double time(time) ; time:standard_name = "time" ; time:long_name = "time" ; time:units = "seconds since 2016-02-22 06:00:00" ; time:calendar = "standard" ; double LAT(x) ; LAT:long_name = "latitude" ; LAT:units = "degrees_north" ; LAT:_FillValue = -9999999. ; LAT:missing_value = -9999999. ; double LON(x) ; LON:long_name = "longitude" ; LON:units = "degrees_east" ; LON:_FillValue = -9999999. ; LON:missing_value = -9999999. ; double Tair(time, x) ; Tair:long_name = "Near Surface Air Temperature" ; Tair:units = "K" ; Tair:_FillValue = -9999999. ; Tair:missing_value = -9999999. ; ...
RE: Seldate - removal of 0-dimension variables - Added by Ralf Mueller about 9 years ago
If you want to have the doubles back into your result file, you have to use a different tool for it. For example, you could select the relevant variables in to a separate file and attach it to the results file (from the seldate operation). one of the NCOs should do this.