Project

General

Profile

Problem with chname

Added by Clement Tisseuil almost 14 years ago

Dear all,

It seems that the chname function does not work.

Exemple:
clem@clem-laptop:~$ cdo chname,var192,dlwsfc /dlwsfc.gdas.197901.grb2 /dlwsfc.gdas.197901_2.grb2
cdo chname: Processed 20570112 values from 1 variable over 31 timesteps. ( 0.96s )
clem@clem-laptop:~$ cdo showname /dlwsfc.gdas.197901_2.grb2
var192
cdo showname: Processed 1 variable. ( 0.06s )

Thanks in advance

Clem


Replies (4)

RE: Problem with chname - Added by Clement Tisseuil almost 14 years ago

Sorry for the unreadable code...

clem@clem-laptop:~$ cdo chname,"var192","dlwsfc" /dlwsfc.gdas.197901.grb2 /dlwsfc.gdas.197901_2.grb2
cdo chname: Processed 20570112 values from 1 variable over 31 timesteps. ( 0.96s )
clem@clem-laptop:~$ cdo showname /dlwsfc.gdas.197901_2.grb2
var192
cdo showname: Processed 1 variable. ( 0.06s )

RE: Problem with chname - Added by Rob Nicholas almost 14 years ago

Clem,

Any chance you could post a small sample of a file on which this fails? I use chname daily on NetCDF files and have never had any problems, so perhaps this is a GRIB-only issue.

~Rob

RE: Problem with chname - Added by Clement Tisseuil almost 14 years ago

Of course, here is a sample of the file...

cdo chname,var193,toto file.grb2 file2.grb2
cdo showname file2.grb2

Regards

Clem

file.grb2 (14.3 KB) file.grb2

RE: Problem with chname - Added by Uwe Schulzweida almost 14 years ago

It is not possible to store the variable name in a GRIB file. So the operator chname is only useful if you store the result to netCDF or use the result with the current CDO command:

cdo showname -chname,var193,toto file.grb2

GRIB2 is using the identifiers discipline, parameterCategory and parameterNumber to read the variable name from external parameter tables. CDO uses the ECMWF grib_api to encode and decode GRIB2 messages. The general concept to change or set the variable name of a GRIB2 message is to add new or change existing parameter tables. I have never tested this with the grib_api. I only know that the GRIB2 parameter tables are located in: GRIB_DEFINITION_PATH/grib2
Please read the ECMWF GRIB_API documentation for more details: http://www.ecmwf.int/publications/manuals/grib_api

The CDO internal concept for parameter tables works unfortunately only for one file. That means you have to set parameter tables for each input file. Here is an example:

cdo partab -chname,var193,toto file.grb2 > mypartab
cdo showname -setpartab,mypartab file.grb2

Regards,
Uwe

    (1-4/4)