'showattribute' does not work for some attributes
Added by Yanchun He almost 6 years ago
Hi,
I found cdo showattributes,varname@attributes only show some attributes, but not others. For example,
$ ncdump -h avgtmp.nc
netcdf avgtmp {
dimensions:
time = UNLIMITED ; // (1 currently)
y = 385 ;
x = 360 ;
variables:
short sst(time, y, x) ;
sst:_FillValue = -32768s ;
sst:valid_range = -32767s, 32767s ;
sst:actual_range = -1.82587709157577, 31.0985797623512 ;
sst:scale_factor = 0.000502402674244315 ;
sst:add_offset = 14.6363513353877 ;
sst:units = "degC" ;
sst:long_name = "Ocean surface temperature" ;
sst:coordinates = "plon plat" ;
sst:cell_measures = "area: parea" ;
double time(time) ;
time:long_name = "time" ;
time:units = "days since 1001-01-01 00:00" ;
time:calendar = "noleap" ;
// global attributes:
:NCO = "4.6.9" ;
$ cdo --no_warning -s showattribute,sst@long_name avgtmp.nc
sst:
long_name = "Ocean surface temperature"
$ cdo -s --no_warning showattribute,sst@coordinates avgtmp.nc
sst:
cdo showattribute (Abort): Could not find variable attribute coordinates in infile.
$ cdo -s --no_warning showattsvar avgtmp.nc
sst:
long_name = "Ocean surface temperature"
units = "degC"
missing_value = "-3.276800e+04"
actual_range = -1.825877e+00
cell_measures = "area: parea"
If anyone has ideas why only some of the attributes are supported? Many thanks!
Yanchun
Replies (4)
RE: 'showattribute' does not work for some attributes - Added by Yanchun He almost 6 years ago
...sorry, forget to attache the sample nc file.
RE: 'showattribute' does not work for some attributes - Added by Karin Meier-Fleischer almost 6 years ago
Hi Yanchun,
the coordinates plon and plat are missing, there should be a warning message. Turn on warnings.
-Karin
RE: 'showattribute' does not work for some attributes - Added by Yanchun He almost 6 years ago
Thanks Karin,
Yes, I am aware there are warning of the missing plot/plat, but that seems not matter.
Again, I attached the nc file with plat/plon included. And the coordinates, as well as for example scale_factor can not be parsed.
$ ncdump -h avgtmp.nc
netcdf avgtmp {
dimensions:
time = UNLIMITED ; // (1 currently)
y = 385 ;
x = 360 ;
variables:
short sst(time, y, x) ;
sst:_FillValue = -32768s ;
sst:valid_range = -32767s, 32767s ;
sst:actual_range = -1.82587709157577, 31.0985797623512 ;
sst:scale_factor = 0.000502402674244315 ;
sst:add_offset = 14.6363513353877 ;
sst:units = "degC" ;
sst:long_name = "Ocean surface temperature" ;
sst:coordinates = "plon plat" ;
sst:cell_measures = "area: parea" ;
double time(time) ;
time:long_name = "time" ;
time:units = "days since 1001-01-01 00:00" ;
time:calendar = "noleap" ;
double plat(y, x) ;
plat:units = "degrees_north" ;
plat:long_name = "Latitude at p-points" ;
plat:corners = "pclat" ;
double plon(y, x) ;
plon:units = "degrees_east" ;
plon:long_name = "Longitude at p-points" ;
plon:corners = "pclon" ;
// global attributes:
:NCO = "4.6.9" ;
}
$ cdo showattsvar,sst avgtmp.nc
sst:
long_name = "Ocean surface temperature"
units = "degC"
missing_value = "-3.276800e+04"
actual_range = -1.825877e+00
cell_measures = "area: parea"
cdo showattsvar: Processed 1 variable ( 0.02s 23MB )
cdo showattribute,sst@scale_factor avgtmp.nc
sst:
cdo showattribute (Abort): Could not find variable attribute scale_factor in infile.
RE: 'showattribute' does not work for some attributes - Added by Jay Su almost 6 years ago
Similar error here:
cdo showattribute,history infile
=> cdo showattribute (Abort): Could not find global attribute history in infile.
Where infile is created by CDO and should have the history attribute by default.