[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: decoders] Grib File Data Extraction



On Fri, 1 Aug 2008, Don McGregor wrote:

I'm looking for some examples of extracting data from grib files using
the Java decoders.
The Grib1Dump utility shows the output at the bottom of this message.
However, when I
load the file using the code below, I get zero records. I'm new to
grib files, and my understanding
is that there should be a record for each parameter.


Hiya,

GribDump is just to dump the headers of the Grib files, most Grib data is large so we use the index approach and a utility GribGetData ie

Grib(1|2)Indexer to index the records in the Grib file


# Grib(1|2)GetData to extract the data on a parameter basis.
# Parameter and level lookup routines. See Parameters

on the page:

http://www.unidata.ucar.edu/software/decoders/

there are Java docs that explain the routines in detail and what parameters to use.

Robb...



              ucar.unidata.io.RandomAccessFile raf = new
ucar.unidata.io.RandomAccessFile("data/seaTemp1","r");
              Grib1Input gribInput = new Grib1Input(raf);
              System.out.println("GRIB version is " +
gribInput.getEdition());

              List records = gribInput.getRecords();
              System.out.println("Number of records is " +
records.size());

Dump of the GRIB file:

                        Header : GRIB1
                    Discipline : 0 Meteorological Products
                  GRIB Edition : 1
                   GRIB length : 390002
            Originating Center : 58 U.S. Navy Fleet Numerical
Meteorology and Oceanography Center
        Originating Sub-Center : 0 WMO Secretariat
            Product Definition : 0 Forecast/Uninitialized Analysis/
Image Product
            Parameter Category : -1 Meteorological Parameters
                Parameter Name : 80 var80 temperature of sea  water
               Parameter Units : deg_K
                Reference Time : 2008-07-30T12:00:00Z
                    Time Units : hour
          Time Range Indicator : product valid at RT + P1
                   Time 1 (P1) : 0
                   Time 2 (P2) : 0
       Generating Process Type : 78 126 wave triangular, 28 layer
Spectral model from Medium Range Forecast run
                    Level Type : 1 surface
                 Level Value 1 : 0.0
                 Level Value 2 : 0.0
                    GDS Exists : true
                    BMS Exists : false
         Number of data points : 259920
                     Grid Name : Latitude/Longitude Grid
                     Grid Shape: 0 spherical
         Spherical earth radius: 6367.47
                            Nx : 720
                            Ny : 361
                           La1 : -90.0
                           Lo1 : 0.0
  Resolution & Component flags : 128
                         Winds : Relative
                           La2 : 90.0
                           Lo2 : -0.5
                            Dx : 0.5
                            Dy : 0.5
                 Scanning mode : 64


_______________________________________________
decoders mailing list
address@hidden
For list information or to unsubscribe,  visit: 
http://www.unidata.ucar.edu/mailing_lists/


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