[netcdf-java] FW: Name lost in GRIB netcdf decoder

 

-----Original Message-----
From: Tor Christian Bekkvik 
Sent: 28. oktober 2008 16:17
To: 'support-netcdf-decoders@xxxxxxxxxxxxxxxx'
Cc: Kjell Røang
Subject: Name lost in GRIB netcdf decoder

It seems that the 'name' GRIB parameter is lost in the GRIB/netcdf decoder.. 

Example line from ncep grib table:
        2:PRMSL:Pressure reduced to MSL [Pa]
Here, name='PRMSL' and description='Pressure reduced to MSL'.


Debugging indicates that GRIB 'description' is used placed where 'name' seems 
more correct.
As a result, 'name' in 'new GribVariable (String name, String desc, ..)' is 
based on ucar.grib.Parameter.getDescription(), and I found no way to retreive 
the 'name' parameter via NetCDF reader.

Original code, from ucar.nc2.iosp.grib.Index2NC:
  static public String makeVariableName(Index.GribRecord gr, TableLookup 
lookup) {
        Parameter param = lookup.getParameter(gr);
        String levelName = makeLevelName( gr, lookup);
        return (levelName.length() == 0) ? param.getDescription() : 
param.getDescription() + "_" + levelName;
  }

  void open(...){
        ...
        String name = makeVariableName( gribRecord, lookup);
        GribVariable pv = (GribVariable) hcs.varHash.get(name); // combo gds, 
param name and level name
        if (null == pv) {
        String pname = lookup.getParameter(gribRecord).getDescription();
        pv = new GribVariable( name, pname, hcs, lookup);
        ...
  }

Suggested change:
        String shortname = param.getName();
        If (levelName.length() == 0)
        {
                shortname + "_" + levelName;    
        }
        pv = new GribVariable(shortname, pname, hcs, lookup);

Would this help ? 
(or could it give unwanted side-effects, since 'name' is also used for 
map-lookup ?)



Thanks,
Tor Chr Bekkvik




  • 2008 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: