Project

General

Profile

varibale name?

Added by Jure Praznikar almost 13 years ago

I converted nc file in grb format.
cdo -f grb copy test.nc test.grb

Then I covert grb file back to nc format.
cdo -f nc copy test.grb test_new.nc

In first nc file variables have correct names, but in
grb as well as in second nc file (test_new.nc) variables have names:
var1, var2, var3, ....var83

What I'm doing wrong? Why are variable name lost?

test.nc (12 MB) test.nc

Replies (3)

RE: varibale name? - Added by Uwe Schulzweida almost 13 years ago

The variable names are lost because it is not possible to store variable names in GRIB format. A workaround for this problem is to store the variable names to an ASCII file and reuse this information when converting from GRIB to netCDF:

cdo vardes test.nc > varnames
cdo -f grb copy test.nc test.grb
cdo -f nc setpartab,varnames test.grb test_new.nc
Here are the first lines of the file varnames:
  -1  LU_INDEX    
  -2  U           
  -3  V           
  -4  W           
  -5  PH          
You have to delete the minus sign with your prefered editor before using this file.

RE: variable name? - Added by Neil Best over 11 years ago

In the .grb format is this accomplished with the .inv file? e.g.:[[http://nomads.ncdc.noaa.gov/data/narr/197901/19790101/]] Apparently the .ctl is some kind of template that contains metadata as well. I will continue to research this and report back if I learn anything useful, but maybe someone here has some ideas.

RE: variable name? - Added by Neil Best over 11 years ago

When I run gdalinfo on one of these .grb files in the absence of any corresponding .inv or .ctl file there is plenty of metadata, so it seems that it is embedded in the .grb file itself to some extent, no?

    (1-3/3)