Project

General

Profile

Variable names for GRIB2 files

Added by Antonio Rodriges over 4 years ago

Hello,

Consider the following grib2 file from the CFSR reanalysis:
https://nomads.ncdc.noaa.gov/data/cfsr/200508/wnd10m.gdas.200508.grb2

The output for ncdump and Java NetCDF is below with variable names
u-component_of_wind_height_above_ground
v-component_of_wind_height_above_ground

However,
CDO reports varible names are
10u
10v

The question is:
why CDO names variable like this?
is it possible to make CDO use the following names
u-component_of_wind_height_above_ground
v-component_of_wind_height_above_ground
?

netcdf file wnd10m.gdas.200508.grb2 {
dimensions:
lon = 1152;
lat = 576;
reftime = 124;
time = 7;
height_above_ground = 1;
variables:
int GaussLatLon_Projection;
:grid_mapping_name = "latitude_longitude";
:earth_radius = 6371229.0; // double
:_CoordinateTransformType = "Projection";
:_CoordinateAxisTypes = "GeoX GeoY";

float u-component_of_wind_height_above_ground(reftime=124, time=7, height_above_ground=1, lat=576, lon=1152);
:long_name = "u-component of wind @ Specified height level above ground";
:units = "m/s";
:abbreviation = "UGRD";
:missing_value = NaNf; // float
:grid_mapping = "GaussLatLon_Projection";
:coordinates = "reftime time height_above_ground lat lon ";
:Grib_Variable_Id = "VAR_0-2-2_L103";
:Grib2_Parameter = 0, 2, 2; // int
:Grib2_Parameter_Discipline = "Meteorological products";
:Grib2_Parameter_Category = "Momentum";
:Grib2_Parameter_Name = "u-component of wind";
:Grib2_Level_Type = 103; // int
:Grib2_Level_Desc = "Specified height level above ground";
:Grib2_Generating_Process_Type = "Forecast";
float v-component_of_wind_height_above_ground(reftime=124, time=7, height_above_ground=1, lat=576, lon=1152);
:long_name = "v-component of wind @ Specified height level above ground";
:units = "m/s";
:abbreviation = "VGRD";
:missing_value = NaNf; // float
:grid_mapping = "GaussLatLon_Projection";
:coordinates = "reftime time height_above_ground lat lon ";
:Grib_Variable_Id = "VAR_0-2-3_L103";
:Grib2_Parameter = 0, 2, 3; // int
:Grib2_Parameter_Discipline = "Meteorological products";
:Grib2_Parameter_Category = "Momentum";
:Grib2_Parameter_Name = "v-component of wind";
:Grib2_Level_Type = 103; // int
:Grib2_Level_Desc = "Specified height level above ground";
:Grib2_Generating_Process_Type = "Forecast";
float lat(lat=576);
:units = "degrees_north";
:_CoordinateAxisType = "Lat";
float lon(lon=1152);
:units = "degrees_east";
:_CoordinateAxisType = "Lon";
double reftime(reftime=124);
:units = "Hour since 2005-08-01T00:00:00Z";
:standard_name = "forecast_reference_time";
:long_name = "GRIB reference time";
:calendar = "proleptic_gregorian";
:_CoordinateAxisType = "RunTime";
double time(reftime=124, time=7);
:units = "Hour since 2005-08-01T00:00:00Z";
:standard_name = "time";
:long_name = "GRIB forecast or observation time";
:calendar = "proleptic_gregorian";
:_CoordinateAxisType = "Time";
float height_above_ground(height_above_ground=1);
:units = "m";
:long_name = "Specified height level above ground";
:positive = "up";
:Grib_level_type = 103; // int
:datum = "ground";
:_CoordinateAxisType = "Height";
:_CoordinateZisPositive = "up";
// global attributes:
:Originating_or_generating_Center = "US National Weather Service, National Centres for Environmental Prediction (NCEP)";
:Originating_or_generating_Subcenter = "0";
:GRIB_table_version = "2,1";
:Type_of_generating_process = "Forecast";
:Analysis_or_forecast_generating_process_identifier_defined_by_originating_centre = "Analysis from GDAS (Global Data Assimilation System)";
:file_format = "GRIB-2";
:Conventions = "CF-1.6";
:history = "Read using CDM IOSP GribCollection v3";
:featureType = "GRID";
:_CoordSysBuilder = "ucar.nc2.dataset.conv.CF1Convention";
}

Replies (3)

RE: Variable names for GRIB2 files - Added by Karin Meier-Fleischer over 4 years ago

Hi Antonio,

I'm not an expert on GRIB data but I would say that the GRIB table which CDO uses causes the renaming of the variable. If you want to change the variable names you can write your own parameter table (see https://code.mpimet.mpg.de/projects/cdo/embedded/index.html#x1-2120002.6.2).

my.partab

&parameter
  name      = "u10" 
  out_name  = "u-component_of_wind_height_above_ground" 
/
&parameter
  name      = "v10" 
  out_name  = "v-component_of_wind_height_above_ground" 
/

cdo setpartab,my.partab -selname,u10,v10 infile outfile

This should do what you want. But remember that naming conventions given in parameter tables have their meaning.

-Karin

RE: Variable names for GRIB2 files - Added by Antonio Rodriges over 4 years ago

Thank you for the good answer, but I have rather automatic process.
I call CDO from a piece of software that uses NetCDF-Java/NCO libraries.
I scan the file and find out that the variable name is "u-component_of_wind_height_above_ground", but CDO requires a very strange "10u".

Is there any way to programmatically extract names
"10u", "10v" and match them with
"u-component_of_wind_height_above_ground" and "v-component_of_wind_height_above_ground"?

RE: Variable names for GRIB2 files - Added by Ralf Mueller over 4 years ago

hi Antonio!

Just as side-note: There are no free variable names in GRIB 1/2 files. Those are saved in grib-tables (part of your GRIB2 library installation (usually grib_api or eccodes). Hence in order to identify variables in a netcdf file with variables encodes in GRIB, the variables names in the netcdf file have to match those in the grib standard. From the grib-point-of-view "10u" is valid and "u-component_of_wind_height_above_ground" just isn't

hth
ralf

    (1-3/3)