net.sourceforge.jgrib
Class GribRecord

Object
  extended by GribRecord
All Implemented Interfaces:
Comparable<GribRecord>

public final class GribRecord
extends Object
implements Comparable<GribRecord>

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.

Author:
Benjamin Stark

Constructor Summary
GribRecord()
          GribRecord, default constructor.
GribRecord(GribRecordIS is, GribRecordPDS pds, GribRecordGDS gds, GribRecordBDS bds, GribRecordBMS bms)
          This function creates a GribRecord by providing all the sections needed to da that.
 
Method Summary
 int compareTo(GribRecord record)
           
 boolean equals(Object obj)
           
 GribRecordBDS getBDS()
          Get the binary data section of this GRIB record.
 GribRecordBMS getBMS()
          Get the bitmap section of this GRIB record.
 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.
 String getLevel()
          Get the level (height or pressure) description.
 GribRecordPDS getPDS()
          Get the product definition section of this GRIB record.
 Calendar getTime()
          Get the base time of this GRIB record.
 String getType()
          Get the parameter type of this GRIB record.
 String getUnit()
          Get the unit for the parameter.
 double getValue(int i, int j)
          Get a single value from the BDS using i/x, j/y index.
 WritableRaster getValues()
          Get data/parameter values as a writable raster of float.
 void setBDS(GribRecordBDS bds)
           
 void setBMS(GribRecordBMS bms)
          setBMS
 void setGDS(GribRecordGDS gds)
          Set the GDS for this record.
 void setIS(GribRecordIS is)
          Creates and set the IS for this record.
 void setPDS(GribRecordPDS pds)
          Set the PDs for the current record.
 String toString()
          Get a string representation of this GRIB record.
 void writeTo(OutputStream out)
          writeTo
 
Methods inherited from class Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GribRecord

public GribRecord()
GribRecord, default constructor.


GribRecord

public GribRecord(GribRecordIS is,
                  GribRecordPDS pds,
                  GribRecordGDS gds,
                  GribRecordBDS bds,
                  GribRecordBMS bms)
This function creates a GribRecord by providing all the sections needed to da that.

Parameters:
is - Indicator Section.
pds - Product Description Section.
gds - Grid Description Section.
bds - Binary Description Section.
bms - Binary Description Section.
Method Detail

getLength

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

Returns:
length in bytes of GRIB record

getIS

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

Returns:
indicator section object

getPDS

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

Returns:
product definition section object

getGDS

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

Returns:
grid definition section object

getBMS

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

Returns:
bitmap section object

getBDS

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

Returns:
binary data section object

getGridCoords

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

Returns:
longitide/latituide as doubles

getValues

public WritableRaster getValues()
                         throws IOException
Get data/parameter values as a writable raster of float.

Returns:
array of parameter values
Throws:
NoValidGribException
IOException

getValue

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

Parameters:
i - DOCUMENT ME!
j - DOCUMENT ME!
Returns:
array of parameter values
Throws:
NoValidGribException - DOCUMENT ME!
IOException

getType

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

Returns:
name of parameter

getDescription

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

Returns:
description of parameter

getUnit

public final String getUnit()
Get the unit for the parameter.

Returns:
name of unit

getLevel

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

Returns:
description of level

getTime

public Calendar getTime()
Get the base time of this GRIB record.

Returns:
analysis or forecast time

toString

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

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

writeTo

public void writeTo(OutputStream out)
             throws IOException
writeTo

Parameters:
out - OutputStream
Throws:
IOException - DOCUMENT ME!

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

setBDS

public void setBDS(GribRecordBDS bds)
            throws IOException
Parameters:
decimalScale -
datumPointLength -
raster -
isConstant -
max -
min -
d -
Throws:
IOException

setBMS

public void setBMS(GribRecordBMS bms)
setBMS

Parameters:
bms - boolean[]

setGDS

public void setGDS(GribRecordGDS gds)
Set the GDS for this record. This method should be used when adding a new record on a newly created grib file.

Parameters:
gds - GribRecordGDS The GDS record to assign to this record.

setPDS

public void setPDS(GribRecordPDS pds)
Set the PDs for the current record. This method should be used when adding a new record on a newly created grib file.

Parameters:
paramTableVersion -
centerID -
generatingProcessID -
gridID -
GDS -
BMS -
paramID -
levelID -
levelValue1 -
levelValue2 -
referenceTime -
forecastTimeUnitID -
P1 -
P2 -
timeRangeID -
includedInAvrage -
missingFromAverage -
subCenterID -
decimalScaleFactor -

setIS

public void setIS(GribRecordIS is)
Creates and set the IS for this record. This method should be used when creating a new record, in order to set the IS for it. It should be used only when adding a new record to a newly created grib file.

Parameters:
edition - int Edition number for this grib record. (We currently support 1)
PDS - int PDS length.
GDS - int GDS length.
BMS - int BMS length.
BDS - int BDS length.
Throws:
NotSupportedException

compareTo

public int compareTo(GribRecord record)
Specified by:
compareTo in interface Comparable<GribRecord>


Copyright © 2006-2010 GeoSolutions. All Rights Reserved.