changing standard and longname
Added by Ruth Cerezo almost 14 years ago
Dear all,
I need to change the standard name and long_name of several files. I have been trying to do so with chname but it does not work.
Example:
rcerezo@trac01:/data1/2nc$ ncdump -h test2.nc
netcdf test2 {
dimensions:
lon = 194 ;
lat = 201 ;
blht_1 = 1 ;
time = UNLIMITED ; // (12 currently)
variables:
float lon(lon) ;
lon:long_name = "longitude" ;
lon:units = "degrees_east" ;
lon:standard_name = "longitude" ;
float lat(lat) ;
lat:long_name = "latitude" ;
lat:units = "degrees_north" ;
lat:standard_name = "latitude" ;
float blht_1(blht_1) ;
blht_1:units = "m" ;
blht_1:axis = "z" ;
double time(time) ;
time:units = "days since 1989-01-01 00:00:00" ;
time:calendar = "standard" ;
float blht(time, blht_1, lat, lon) ;
blht:long_name = "BOUNDARY LAYER DEPTH AFTER TIMESTEP" ;
blht:units = "m" ;
blht:_FillValue = 2.e+20f ;
blht:source = "Unified Model Output:" ;
blht:name = "blht" ;
blht:title = "BOUNDARY LAYER DEPTH AFTER TIMESTEP" ;
blht:date = "01/01/89" ;
blht:time = "00:00" ;
blht:valid_min = 62.4895477294922 ;
blht:valid_max = 1396.91638183594 ;
what I am interested is to change:
blth:name = blth for blth:atmosphere_height_layer
and
blth:long_name = BOUNDARY LAYER DEPTH AFTER TIMESTEP for blth: Height of Boundary Layer
if I do:
cdo chname,blht,atmospheric_boundary_layer_thickness test.nc test2.nc
I got:
dimensions:
lon = 194 ;
lat = 201 ;
blht_1 = 1 ;
time = UNLIMITED ; // (12 currently)
variables:
float lon(lon) ;
lon:long_name = "longitude" ;
lon:units = "degrees_east" ;
lon:standard_name = "longitude" ;
float lat(lat) ;
lat:long_name = "latitude" ;
lat:units = "degrees_north" ;
lat:standard_name = "latitude" ;
float blht_1(blht_1) ;
blht_1:units = "m" ;
blht_1:axis = "z" ;
double time(time) ;
time:units = "days since 1989-01-01 00:00:00" ;
time:calendar = "standard" ;
float atmospheric_boundary_layer_thickness(time, blht_1, lat, lon) ;
atmospheric_boundary_layer_thickness:long_name = "BOUNDARY LAYER DEPTH AFTER TIMESTEP" ;
atmospheric_boundary_layer_thickness:units = "m" ;
atmospheric_boundary_layer_thickness:_FillValue = 2.e+20f ;
atmospheric_boundary_layer_thickness:source = "Unified Model Output:" ;
atmospheric_boundary_layer_thickness:name = "blht" ;
atmospheric_boundary_layer_thickness:title = "BOUNDARY LAYER DEPTH AFTER TIMESTEP" ;
atmospheric_boundary_layer_thickness:date = "01/01/89" ;
atmospheric_boundary_layer_thickness:time = "00:00" ;
atmospheric_boundary_layer_thickness:valid_min = 62.4895477294922 ;
atmospheric_boundary_layer_thickness:valid_max = 1396.91638183594 ;
help please!
Ruth
Replies (2)
RE: changing standard and longname - Added by Uwe Schulzweida almost 14 years ago
Hi Ruth,
Name in the CDO operator name chname means the name of the variable. You want to change the attribute with the name name. However its not possible to change attributes with CDO. You will have more luck with the NCO function ncatted. Here an example to change the attribute name of the variable blht:
ncatted -a name,blht,o,c,"atmospheric_boundary_layer_thickness" ifile ofile
Best regards,
Uwe
RE: changing standard and longname - Added by Ruth Cerezo almost 14 years ago
thanks for the tip (i am using it now and it works!)