ucar.grib.grib2
Class Grib2Input

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

public final class Grib2Input
extends Object

Uses a RandomAccessFile to scans a GRIB2 file to extract product information. A Grib record starts with the string GRIB.

Author:
rkambic

Constructor Summary
Grib2Input(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.
 Map<String,Grib2GridDefinitionSection> getGDSs()
          Get map of id -> GDS
 List<Grib2Product> getProducts()
          Get list of Grib2Product
 List<Grib2Record> getRecords()
          Get list of Grib2Record
static boolean isValidFile(RandomAccessFile raf)
           
 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Grib2Input

public Grib2Input(RandomAccessFile raf)
Constructs a Grib2Input object from a raf.

Parameters:
raf - with GRIB content
Method Detail

isValidFile

public static boolean isValidFile(RandomAccessFile raf)
                           throws IOException
Throws:
IOException

scan

public final boolean scan(boolean getProductsOnly,
                          boolean oneRecord)
                   throws 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
IOException - on data read

getEdition

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

Returns:
GribFileType
Throws:
IOException - on data read
NotSupportedException - NotSupportedException

getProducts

public final List<Grib2Product> getProducts()
Get list of Grib2Product

Returns:
list of Grib2Product

getRecords

public final List<Grib2Record> getRecords()
Get list of Grib2Record

Returns:
list of Grib2Record

getGDSs

public final Map<String,Grib2GridDefinitionSection> getGDSs()
Get map of id -> GDS

Returns:
map of id -> GDS


Copyright © 1999-2011 UCAR/Unidata. All Rights Reserved.