net.sourceforge.jgrib
Class GribRecordPDS

Object
  extended by GribRecordPDS

public final class GribRecordPDS
extends Object

A class representing the product definition section (PDS) of a GRIB record.

Author:
Benjamin Stark, Simone Giannecchini, GeoSolutions S.A.S.

Constructor Summary
GribRecordPDS(ImageInputStream in)
          Constructs a GribRecordPDS object from a bit input stream.
GribRecordPDS(int paramTableVersion, int centerID, int generatingProcessID, int gridID, boolean GDS, boolean BMS, int paramID, int levelID, double levelValue1, double levelValue2, Calendar referenceTime, int forecastTimeUnitID, int P1, int P2, int timeRangeID, int includedInAverage, int missingFromAverage, int subCenterID, int decimalScaleFactor)
          GribRecordPDS constructor.
 
Method Summary
 boolean bmsExists()
          Check if BMS exists.
 int compare(GribRecordPDS pds)
          rdg - added this method to be used in a comparator for sorting while extracting records.
 boolean equals(Object obj)
          rdg - added an equals method here
 boolean gdsExists()
          Check if GDS exists.
 int getDecimalScale()
          Get the exponent of the decimal scale used for all data values.
 String getDescription()
          Get a descritpion of the parameter.
 int getForecastTimeUnit()
          getForecastTimeUnit
 int getGeneratingProcessID()
          getGeneratingProcessID
 Calendar getGMTBaseTime()
          Get the base (analysis) time of the forecast in GMT.
 Calendar getGMTForecastTime()
          Get the time of the forecast.
 Calendar getGMTForecastTime2()
          getGMTForecastTime2
 int getGridID()
          getGridID
 int getLength()
          Get the byte length of this section.
 GribPDSLevel getLevel()
          Get the level of the forecast/analysis.
 String getLevelDesc()
          Get the long description for this level of the forecast/analysis.
 String getLevelName()
          Get the name for the type of level for this forecast/analysis.
 String getLevelUnits()
          Get the units for the level of the forecast/analysis.
 double getLevelValue()
          Get the numeric value for this level.
 double getLevelValue2()
          Get value 2 (if it exists) for this level.
 Calendar getLocalBaseTime()
          Get the base (analysis) time of the forecast in local time zone.
 Calendar getLocalForecastTime()
          Get the time of the forecast in local time zone.
 double getNumberIncludedInAverage()
          getNumberIncludedInAverage
 double getNumberMissingFromAverage()
          getNumberMissingFromAverage
 int getOriginatingCenterID()
          getOriginatingCenterID
 int getP1()
          getP1
 int getP2()
          getP2
 GribPDSParameter getParameter()
          Get the parameter for this pds.
 GribPDSParamTable getParamTable()
          Get the Parameter Table that defines this parameter.
 GribPDSLevel getPDSLevel()
          Get the level of the forecast/analysis.
 int getSubcenterID()
          getSubcenterID
 int getTableVersion()
          getTableVersion() We need this method because the version of the used table may be diferent from the one requested in case we do not have it.
 int getTimeRangeIndicator()
          getTimeRangeIndicator
 String getType()
          Get the type of the parameter.
 String getUnit()
          Get the name of the unit of the parameter.
 String headerToString()
          Get a string representation of this Header information for this PDS.
 String toString()
          Get a string representation of this PDS.
 void writeTo(OutputStream out)
          writeTo Writes the current section to an output stream as requested by the specifications on grib files.
 
Methods inherited from class Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GribRecordPDS

public GribRecordPDS(ImageInputStream in)
              throws IOException
Constructs a GribRecordPDS object from a bit input stream.

Parameters:
in - bit input stream with PDS content
Throws:
IOException - if stream can not be opened etc.

GribRecordPDS

public GribRecordPDS(int paramTableVersion,
                     int centerID,
                     int generatingProcessID,
                     int gridID,
                     boolean GDS,
                     boolean BMS,
                     int paramID,
                     int levelID,
                     double levelValue1,
                     double levelValue2,
                     Calendar referenceTime,
                     int forecastTimeUnitID,
                     int P1,
                     int P2,
                     int timeRangeID,
                     int includedInAverage,
                     int missingFromAverage,
                     int subCenterID,
                     int decimalScaleFactor)
GribRecordPDS constructor. This method allows the user to build a GribRecordPDS from scratch. GribFile class is responsible for presenting tbale to the user in oder to make choices about the various ids.

Parameters:
paramTableVersion - DOCUMENT ME!
centerID - DOCUMENT ME!
generatingProcessID - DOCUMENT ME!
gridID - DOCUMENT ME!
GDS - DOCUMENT ME!
BMS - DOCUMENT ME!
paramID - DOCUMENT ME!
levelID - DOCUMENT ME!
levelValue1 - DOCUMENT ME!
levelValue2 - DOCUMENT ME!
referenceTime - DOCUMENT ME!
forecastTimeUnitID - DOCUMENT ME!
P1 - DOCUMENT ME!
P2 - DOCUMENT ME!
timeRangeID - DOCUMENT ME!
includedInAverage - DOCUMENT ME!
missingFromAverage - DOCUMENT ME!
subCenterID - DOCUMENT ME!
decimalScaleFactor - DOCUMENT ME!
Method Detail

getLength

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

Returns:
length in bytes of this section

gdsExists

public boolean gdsExists()
Check if GDS exists.

Returns:
true, if GDS exists

bmsExists

public boolean bmsExists()
Check if BMS exists.

Returns:
true, if BMS exists

getDecimalScale

public int getDecimalScale()
Get the exponent of the decimal scale used for all data values.

Returns:
exponent of decimal scale

getType

public String getType()
Get the type of the parameter.

Returns:
type of parameter

getDescription

public String getDescription()
Get a descritpion of the parameter.

Returns:
descritpion of parameter

getUnit

public String getUnit()
Get the name of the unit of the parameter.

Returns:
name of the unit of the parameter

getLevel

public GribPDSLevel getLevel()
Get the level of the forecast/analysis.

Returns:
level (height or pressure)

getLevelName

public String getLevelName()
Get the name for the type of level for this forecast/analysis.

Returns:
name of level (height or pressure)

getLevelDesc

public String getLevelDesc()
Get the long description for this level of the forecast/analysis.

Returns:
name of level (height or pressure)

getLevelUnits

public String getLevelUnits()
Get the units for the level of the forecast/analysis.

Returns:
name of level (height or pressure)

getLevelValue

public double getLevelValue()
Get the numeric value for this level.

Returns:
name of level (height or pressure)

getLevelValue2

public double getLevelValue2()
Get value 2 (if it exists) for this level.

Returns:
name of level (height or pressure)

getPDSLevel

public GribPDSLevel getPDSLevel()
Get the level of the forecast/analysis.

Returns:
name of level (height or pressure)

getParamTable

public GribPDSParamTable getParamTable()
Get the Parameter Table that defines this parameter.

Returns:
GribPDSParamTable containing parameter table that defined this parameter

getLocalBaseTime

public Calendar getLocalBaseTime()
Get the base (analysis) time of the forecast in local time zone.

Returns:
date and time

getLocalForecastTime

public Calendar getLocalForecastTime()
Get the time of the forecast in local time zone.

Returns:
date and time

getParameter

public GribPDSParameter getParameter()
Get the parameter for this pds.

Returns:
date and time

getGMTBaseTime

public Calendar getGMTBaseTime()
Get the base (analysis) time of the forecast in GMT.

Returns:
date and time

getGMTForecastTime

public Calendar getGMTForecastTime()
Get the time of the forecast.

Returns:
date and time

toString

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

Overrides:
toString in class Object
Returns:
string representation of this PDS

headerToString

public String headerToString()
Get a string representation of this Header information for this PDS.

Returns:
string representation of the Header for this PDS

equals

public boolean equals(Object obj)
rdg - added an equals method here

Overrides:
equals in class Object
Parameters:
obj - DOCUMENT ME!
Returns:
DOCUMENT ME!

compare

public int compare(GribRecordPDS pds)
rdg - added this method to be used in a comparator for sorting while extracting records. Not currently used in the JGrib library, but is used in a library I'm using that uses JGrib. Compares numerous features from the PDS information to sort according to a time, level, level-type, y-axis, x-axis order

Parameters:
pds - - the GribRecordGDS to compare to
Returns:
- -1 if pds is "less than" this, 0 if equal, 1 if pds is "greater than" this.

writeTo

public void writeTo(OutputStream out)
             throws IOException
writeTo Writes the current section to an output stream as requested by the specifications on grib files.

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

getOriginatingCenterID

public int getOriginatingCenterID()
getOriginatingCenterID

Returns:
DOCUMENT ME!

getSubcenterID

public int getSubcenterID()
getSubcenterID

Returns:
DOCUMENT ME!

getGeneratingProcessID

public int getGeneratingProcessID()
getGeneratingProcessID

Returns:
DOCUMENT ME!

getP1

public int getP1()
getP1

Returns:
DOCUMENT ME!

getP2

public int getP2()
getP2

Returns:
DOCUMENT ME!

getTimeRangeIndicator

public int getTimeRangeIndicator()
getTimeRangeIndicator

Returns:
DOCUMENT ME!

getForecastTimeUnit

public int getForecastTimeUnit()
getForecastTimeUnit

Returns:
DOCUMENT ME!

getNumberIncludedInAverage

public double getNumberIncludedInAverage()
getNumberIncludedInAverage

Returns:
DOCUMENT ME!

getNumberMissingFromAverage

public double getNumberMissingFromAverage()
getNumberMissingFromAverage

Returns:
DOCUMENT ME!

getGMTForecastTime2

public Calendar getGMTForecastTime2()
getGMTForecastTime2

Returns:
DOCUMENT ME!

getGridID

public int getGridID()
getGridID

Returns:
DOCUMENT ME!

getTableVersion

public int getTableVersion()
getTableVersion() We need this method because the version of the used table may be diferent from the one requested in case we do not have it.

Returns:
DOCUMENT ME!


Copyright © 2006-2010 GeoSolutions. All Rights Reserved.