Re: [netcdf-java] Configuring GRIB tables in NetCDF

  • To: Tor Christian Bekkvik <torc@xxxxxx>
  • Subject: Re: [netcdf-java] Configuring GRIB tables in NetCDF
  • From: Robb Kambic <rkambic@xxxxxxxxxxxxxxxx>
  • Date: Fri, 9 Oct 2009 10:43:52 -0600 (MDT)
On Thu, 8 Oct 2009, Tor Christian Bekkvik wrote:

Hi,
The GribPDSParamTable.addParameterUserLookup call did not seem to help
in my case; the resulting parameter names/units reported for my gribfile
was still not affected.
Probable cause:
The addParameterUserLookup call only applies to GRIB-1
(ucar.grib.grib1.GribPDSParamTable), while my gribfile triggered the
GRIB-2 parser in NetCDF (from NetcdfDataset.openDataset(grib2file);)



Questions:
-1) Could Netcdf be instructed/hinted to prefer the GRIB-1 reader, when
possible ?  (JGRIB, a grib-1 reader, was able to read my file)

Tor,

Grib 1 and Grib 2 structures are completely different that's why there are Grib 1 and Grib 2 readers.




-2) Is there another way to configure GRIB tables (or parameter
interpretation) in NetCDF which now would work for both GRIB-1 and
GRIB-2 ?


The Grib 1 and Grib 2 parameter tables use completely different tables and have different internal structures. Your previous message seem to be asking about Grib 1 tables so I sent that information. There is a similar call for the Grib 2 table, that permits one to add or overwrite Grib 2 parameters. The method call is:

ParameterTable.addParametersUser("C:/data/grib/tables/grib2userparameters.txt" 
);


The table syntax is:

# Sample Grib2 tables parameters that are read in externally
# Use static method: ParameterTable.addParametersUser(String UserGribTable)
# The fields are separated by tabs, Name cannot have spaces, use _
# fields:
# Discipline Category ParameterNumber Name Unit Description
0       1       223     Total_precipitation     kg/m2   Total precipitation in 
24 hours
0       2       1       Wind_speed      knots   Wind speed at 2 meters


For information about the above fields, look at:
http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table4-1.shtml

Robb...






Thanks,
-Tor C

-----Original Message-----
From: Robb Kambic [mailto:rkambic@xxxxxxxxxxxxxxxx]
Sent: 6. oktober 2009 21:02
To: Tor Christian Bekkvik
Cc: Gro Fonnes; netcdf-java; Kjell Røang
Subject: Re: Configuring GRIB tables in NetCDF

On Tue, 6 Oct 2009, Tor Christian Bekkvik wrote:

Hi, I have some questions regarding GRIB table configuration:
 
1) Is there a way to configure GRIBtables in NetCDF without
rebuilding
grib-6.0.jar in ncSrc-4.0.zip!\lib\release\ ?

Tor,

Yes, the following routine, in class GribPDSParamTable

/**
    * Reads in the list of tables available and stores them.
Does not actually
    * open the parameter tables files, nor store the list of
parameters, but
    * just stores the file names of the parameter tables.
    * Parameters for a table are read in when the table is
requested (in the
    * getParameterTable method).
    *
    * @param userGribTabList string of userlookup file
    * @throws IOException on read error
    */
   public static void addParameterUserLookup(String userGribTabList)


There is a sample file with the grib jar called
userlookup.lst, it has the same syntax as tablelookup.lst.
If the table name begins with /, http:, or file: then it
looks for the file with the full path name, otherwise it
assumes the table is in the resource directory. The tables
are loaded according to site ID, subsite ID and table version
number that's obtained from the data file.  If you load a new
table with the same configuration as one in tablelookup.lst
file, your new configuration will over write the original
configuration.

             GribPDSParamTable.addParameterUserLookup(
"/local/robb/trunk20090914/grib/resources/resources/grib/table
s/userlookup.lst");

2) Where can I find sourcecode for grib-6.0.jar (or later
versions) ? 
(the source will answer question 1, but is not included in
ncSrc-4.0.zip)
 

The source for the Grib decoder package is located on page:
http://www.unidata.ucar.edu/software/decoders/  unders downloads.

The Grib package has just went under a major refactor to
implement the Ensemble data processing, so some APIs have be
deprecated. The deprecated APIs are going to be removed in a
future release so I suggest looking at the javaDocs for the changes.

RObb...




 
We occasionally have gribfiles using gribtables not defined in
grib*.jar. The only solution I currently know, is to unzip the
grib*.jar file and modify gribtable definitions inside 
\resources\grib\tables\tablelookup.lst.  (tablelookup.lst points to 
*.tab files in the same directory) This is not very user
friendly, so 
perhaps there is a java property or method call where you
can override some gribtable settings?
 
 
 
Thanks,
Tor C Bekkvik
 
--

Tor Christian Bekkvik
Scientist
Christian Michelsen Research AS
Phone: +47 55 57 42 28




==============================================================
=================
Robb Kambic                                Unidata Program Center
Software Engineer III                      Univ. Corp for
Atmospheric Research
rkambic@xxxxxxxxxxxxxxxx                   WWW:
http://www.unidata.ucar.edu/
==============================================================
=================



===============================================================================
Robb Kambic                                Unidata Program Center
Software Engineer III                      Univ. Corp for Atmospheric Research
rkambic@xxxxxxxxxxxxxxxx                   WWW: http://www.unidata.ucar.edu/
===============================================================================
  • 2009 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: