Previous: Overview Next: Adding new parameters to GRIB 2 table Table of contents Index Glossary Images Frames Java GRIB library documentation > Adding/Updating External Parameter Tables

1.1 Adding new GRIB1 tables

There are three methods of adding new tables for GRIB 1 files.

  • Use the GribPDSParamTable.addParameterUserLookup routine to add tables
  • Recompile distribution with new tables
  • Modify the distribution grib<version>.jar file

    All three methods require that a new parameter table be made using the NCEP format that is similar to the following table. Let's call our new table gwctab_2.tab.

    
    -1:57:-1:2
    0:var0:undefined
    1:PRES:Pressure [Pa]
    2:PRMSL:Pressure reduced to MSL [Pa]
    3:PTEND:Pressure tendency [Pa/s]
    4:PVORT:Pot. vorticity [km^2/kg/s]
    5:ICAHT:ICAO Standard Atmosphere Reference Height [m]
    6:GP:Geopotential [m^2/s^2]
    ...
    

    The first line in the sample table above:

    -1:57:-1:2
    

    The syntax is: it always starts with -1, the second number is the center number, the third number is the subcenter number or -1, and the forth number is the version number of the table. Many centers have different versions of the table depending on the dataset to be decoded so it's not unusual to have duplicate lines with the just the last number different.

    The rest of the lines in the file follows this format:

    0:var0:undefined
    1:PRES:Pressure [Pa]
    ...
    

    The first field is the parameter number, the second is the short parameter name, the third is a long parameter name, and the forth that is inside the square brackets if it exist is the parameter units that need to be Udunits compatible. The maximum number of parameters is 255 and not all numbers need to be present. The number 255 is designated for a missing parameter.

    First method: Using the GribPDSParamTable library routine

    This method requires one to create another table with the new tables names called grib1lookuptable.lst Then the table is read into the library using the addParameterUserLookup routine.

    The format of grib1lookuptable.lst is:

    <center>:<subcenter>:<version>:  <table location>
    

    so our sample above would look like:

    57:     1:      2:      gwctab_2.tab
    
    

    gwctab_2.tab can be a relative or absolute path. If the table name doesn't contain a path, it needs to be on the CLASSPATH and located at: resources/grib/tables/

    
    For our sample above, resources/grib/tables/gwctab_2.tab
     
    

    The calling routine would look like this in your code.

    
    GribPDSParamTable.addParameterUserLookup( "/<absolutePath>/grib1lookuptable.lst")
    

    This library does not read in the actual parameter table until it is requested and it will overwrite a previous defined table with the same center, sub-center, version number fields.

    Second method: Recompiling the library

    Since the distribution comes with the source files and a ant build.xml file, the distribution can be recompile easily.
    % cd "where the distribution was unpacked"
    % cd resources/resources/grib/tables 
    % edit tablelookup.lst adding your new table entry using above format
    copy your new table to this directory
    % cd ../../../..
    % ant
    
    

    The new jar file in now located in the build directory. At this point your new table can be access in the library without using any special calls.

    Third method: Modifying the grib<version>.jar file

    This method is similar to the second method but instead of recompiling the source code the jar file is modified using the jar file command. It involves replacing the file tablelookup.lst in the jar file and adding the new table to the jar file. This method would solve the problem where the distrbution is not available or it has a different version of the grib.jar.
    
    % cd "location of grib<version>.jar"
    The following directory structure is needed
    % mkdir resources/grib/tables 
    Extract  tablelookup.lst file
    % jar xvf grib<version>.jar  resources/grib/tables/tablelookup.lst
    % cd resources/grib/tables 
    % edit tablelookup.lst adding your new table entry using above format
    copy your new table to this directory
    % cd ../../../..
    % jar uvf grib<version>.jar resources/grib/tables/tablelookup.lst 
    % jar uvf grib<version>.jar resources/grib/tables/gwctab_2.tab 
    Check your jar file to see if the new table has been added.
    % jar tvf grib<version>.jar 
    
    

    At this point your new table can be access in the library without using any special calls.

     


    Previous: Overview Next: Adding new parameters to GRIB 2 table Table of contents Index Glossary Images Frames Java GRIB library documentation > Adding/Updating External Parameter Tables