ucar.grib.grib2
Class Grib2Input

java.lang.Object
  extended by ucar.grib.grib2.Grib2Input

public final class Grib2Input
extends java.lang.Object

Uses a RandomAccessFile to scans a GRIB2 file to extract product information. A Grib record starts with the string GRIB. A GRIB record has 8 sections, the detailed information is at: http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc.shtml


Constructor Summary
Grib2Input(ucar.unidata.io.RandomAccessFile raf)
          Constructs a Grib2Input object from a raf.
 
Method Summary
 int getEdition()
          returns Grib file type, 1 or 2, or 0 not a Grib file.
 java.util.Map<java.lang.String,Grib2GridDefinitionSection> getGDSs()
          Get GDS's of the GRIB file.
 java.util.List<Grib2Product> getProducts()
          Get products of the GRIB file.
 java.util.List<Grib2Record> getRecords()
          Get records of the GRIB file.
 boolean scan(boolean getProductsOnly, boolean oneRecord)
          scans the Grib2 file obtaining Products or Records that contain all needed information for data extraction later.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Grib2Input

public Grib2Input(ucar.unidata.io.RandomAccessFile raf)
Constructs a Grib2Input object from a raf.

Parameters:
raf - with GRIB content
Method Detail

scan

public final boolean scan(boolean getProductsOnly,
                          boolean oneRecord)
                   throws NotSupportedException,
                          java.io.IOException
scans the Grib2 file obtaining Products or Records that contain all needed information for data extraction later. For most purposes, getProductsOnly should be set to true, it's lightweight of getRecords. It is possible that one Grib record can have multiple same sections, so the previous sections don't have to be repeated in another Grib record. An example is the data section is repeated only for U and V componet of Winds in some records.

Parameters:
getProductsOnly - get products verse get records
oneRecord - if true then return first record
Returns:
success was the read successfull
Throws:
NotSupportedException - NotSupportedException
java.io.IOException - on data read

getEdition

public final int getEdition()
                     throws java.io.IOException,
                            NotSupportedException
returns Grib file type, 1 or 2, or 0 not a Grib file.

Returns:
GribFileType
Throws:
java.io.IOException - on data read
NotSupportedException - NotSupportedException

getProducts

public final java.util.List<Grib2Product> getProducts()
Get products of the GRIB file.

Returns:
products

getRecords

public final java.util.List<Grib2Record> getRecords()
Get records of the GRIB file.

Returns:
records

getGDSs

public final java.util.Map<java.lang.String,Grib2GridDefinitionSection> getGDSs()
Get GDS's of the GRIB file.

Returns:
gdsHM