net.sourceforge.jgrib
Class GribRecord

java.lang.Object
  extended by net.sourceforge.jgrib.GribRecord

public class GribRecord
extends java.lang.Object

A class representing a single GRIB record. A record consists of five sections: indicator section (IS), product definition section (PDS), grid definition section (GDS), bitmap section (BMS) and binary data section (BDS). The sections can be obtained using the getIS, getPDS, ... methods.

Version:
1.0
Author:
Benjamin Stark

Field Summary
protected  GribRecordBDS bds
          The binary data section.
protected  GribRecordBMS bms
          The bitmap section.
protected  GribRecordGDS gds
          The grid definition section.
protected  GribRecordIS is
          The indicator section.
protected  GribRecordPDS pds
          The product definition section.
 
Constructor Summary
GribRecord(BitInputStream in)
          Constructs a GribRecord object from a bit input stream.
GribRecord(GribRecordLight grl)
          Constructs a GribRecord object from a bit input stream.
 
Method Summary
 GribRecordBDS getBDS()
          Get the binary data section of this GRIB record.
 GribRecordBMS getBMS()
          Get the bitmap section of this GRIB record.
 java.lang.String getDescription()
          Get a more detailed description of the parameter.
 GribRecordGDS getGDS()
          Get the grid definition section of this GRIB record.
 double[] getGridCoords()
          Get grid coordinates in longitude/latitude
 GribRecordIS getIS()
          Get the indicator section of this GRIB record.
 int getLength()
          Get the byte length of this GRIB record.
 java.lang.String getLevel()
          Get the level (height or pressure).
 GribRecordPDS getPDS()
          Get the product definition section of this GRIB record.
 java.util.Calendar getTime()
          Get the analysis or forecast time of this GRIB record.
 java.lang.String getType()
          Get the parameter type of this GRIB record.
 java.lang.String getUnit()
          Get the unit for the parameter.
 float getValue(int i, int j)
          Get a single value from the BDS using i/x, j/y index.
 float[] getValues()
          Get data/parameter values as an array of float.
 java.lang.String toString()
          Get a string representation of this GRIB record.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

is

protected GribRecordIS is
The indicator section.


pds

protected GribRecordPDS pds
The product definition section.


gds

protected GribRecordGDS gds
The grid definition section.


bms

protected GribRecordBMS bms
The bitmap section.


bds

protected GribRecordBDS bds
The binary data section.

Constructor Detail

GribRecord

public GribRecord(BitInputStream in)
           throws java.io.IOException,
                  NotSupportedException,
                  NoValidGribException
Constructs a GribRecord object from a bit input stream.

Parameters:
in - bit input stream with GRIB record content
Throws:
java.io.IOException - if stream can not be opened etc.
NotSupportedException
NoValidGribException - if stream contains no valid GRIB file

GribRecord

public GribRecord(GribRecordLight grl)
           throws java.io.IOException,
                  NoValidGribException,
                  NotSupportedException
Constructs a GribRecord object from a bit input stream.

Parameters:
grl - - a light grib record
Throws:
java.io.IOException - if stream can not be opened etc.
NoValidGribException - if stream contains no valid GRIB file
NotSupportedException
Method Detail

getLength

public int getLength()
Get the byte length of this GRIB record.

Returns:
length in bytes of GRIB record

getIS

public GribRecordIS getIS()
Get the indicator section of this GRIB record.

Returns:
indicator section object

getPDS

public GribRecordPDS getPDS()
Get the product definition section of this GRIB record.

Returns:
product definition section object

getGDS

public GribRecordGDS getGDS()
Get the grid definition section of this GRIB record.

Returns:
grid definition section object

getBMS

public GribRecordBMS getBMS()
Get the bitmap section of this GRIB record.

Returns:
bitmap section object

getBDS

public GribRecordBDS getBDS()
Get the binary data section of this GRIB record.

Returns:
binary data section object

getGridCoords

public double[] getGridCoords()
Get grid coordinates in longitude/latitude

Returns:
longitide/latituide as doubles

getValues

public float[] getValues()
Get data/parameter values as an array of float.

Returns:
array of parameter values

getValue

public float getValue(int i,
                      int j)
               throws NoValidGribException
Get a single value from the BDS using i/x, j/y index. Retrieves using a row major indexing.

Parameters:
i -
j -
Returns:
array of parameter values
Throws:
NoValidGribException

getType

public java.lang.String getType()
Get the parameter type of this GRIB record.

Returns:
name of parameter

getDescription

public java.lang.String getDescription()
Get a more detailed description of the parameter.

Returns:
description of parameter

getUnit

public java.lang.String getUnit()
Get the unit for the parameter.

Returns:
name of unit

getLevel

public java.lang.String getLevel()
Get the level (height or pressure).

Returns:
description of level

getTime

public java.util.Calendar getTime()
Get the analysis or forecast time of this GRIB record.

Returns:
analysis or forecast time

toString

public java.lang.String toString()
Get a string representation of this GRIB record.

Overrides:
toString in class java.lang.Object
Returns:
string representation of this GRIB record