net.sourceforge.jgrib
Class GribRecordPDS

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

public class GribRecordPDS
extends java.lang.Object

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

Version:
1.0
Author:
Benjamin Stark

Field Summary
protected  java.util.Calendar baseTime
          Model Run/Analysis/Reference time.
protected  boolean bms_exists
          True, if BMS exists.
protected  java.lang.String connector
          String used in building a string to represent the time(s) for this PDS See the decoder for octet 21 to get an understanding
protected  int decscale
          Exponent of decimal scale.
protected  java.util.Calendar forecastTime
          Forecast time.
protected  java.util.Calendar forecastTime2
          Ending time when times represent a period
protected  boolean gds_exists
          True, if GDS exists.
protected  int grid_id
          ID of grid type.
protected  int length
          Length in bytes of this PDS.
protected  GribPDSLevel level
          Class containing the information about the level.
protected  GribPDSParameter parameter
          The parameter as defined in the Parameter Table
protected  java.lang.String timeRange
          String used in building a string to represent the time(s) for this PDS See the decoder for octet 21 to get an understanding
 
Constructor Summary
GribRecordPDS(BitInputStream in)
          Constructs a GribRecordPDS object from a bit input stream.
 
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(java.lang.Object obj)
          rdg - added an equals method here
 boolean gdsExists()
          Check if GDS exists.
 int getCenterId()
           
 int getDecimalScale()
          Get the exponent of the decimal scale used for all data values.
 java.lang.String getDescription()
          Get a descritpion of the parameter.
 java.util.Calendar getGMTBaseTime()
          Get the base (analysis) time of the forecast in GMT.
 java.util.Calendar getGMTForecastTime()
          Get the time of the forecast.
 int getLength()
          Get the byte length of this section.
 java.lang.String getLevel()
          Get the level of the forecast/analysis.
 java.lang.String getLevelDesc()
          Get the long description for this level of the forecast/analysis.
 java.lang.String getLevelName()
          Get the name for the type of level for this forecast/analysis.
 java.lang.String getLevelUnits()
          Get the units for the level of the forecast/analysis.
 float getLevelValue()
          Get the numeric value for this level.
 float getLevelValue2()
          Get value 2 (if it exists) for this level.
 java.util.Calendar getLocalBaseTime()
          Get the base (analysis) time of the forecast in local time zone.
 java.util.Calendar getLocalForecastTime()
          Get the time of the forecast in local time zone.
 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 getProcessId()
           
 int getSubcenterId()
           
 int getTableVersion()
           
 java.lang.String getType()
          Get the type of the parameter.
 java.lang.String getUnit()
          Get the name of the unit of the parameter.
 java.lang.String headerToString()
          Get a string representation of this Header information for this PDS.
 java.lang.String toString()
          Get a string representation of this PDS.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

length

protected int length
Length in bytes of this PDS.


decscale

protected int decscale
Exponent of decimal scale.


grid_id

protected int grid_id
ID of grid type.


gds_exists

protected boolean gds_exists
True, if GDS exists.


bms_exists

protected boolean bms_exists
True, if BMS exists.


parameter

protected GribPDSParameter parameter
The parameter as defined in the Parameter Table


level

protected GribPDSLevel level
Class containing the information about the level. This helps to actually use the data, otherwise the string for level will have to be parsed.


baseTime

protected java.util.Calendar baseTime
Model Run/Analysis/Reference time.


forecastTime

protected java.util.Calendar forecastTime
Forecast time. Also used as starting time when times represent a period


forecastTime2

protected java.util.Calendar forecastTime2
Ending time when times represent a period


timeRange

protected java.lang.String timeRange
String used in building a string to represent the time(s) for this PDS See the decoder for octet 21 to get an understanding


connector

protected java.lang.String connector
String used in building a string to represent the time(s) for this PDS See the decoder for octet 21 to get an understanding

Constructor Detail

GribRecordPDS

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

Parameters:
in - bit input stream with PDS content
Throws:
java.io.IOException - if stream can not be opened etc.
NotSupportedException
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 java.lang.String getType()
Get the type of the parameter.

Returns:
type of parameter

getDescription

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

Returns:
descritpion of parameter

getUnit

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

Returns:
name of the unit of the parameter

getLevel

public java.lang.String getLevel()
Get the level of the forecast/analysis.

Returns:
name of level (height or pressure)

getLevelName

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

Returns:
name of level (height or pressure)

getLevelDesc

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

Returns:
name of level (height or pressure)

getLevelUnits

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

Returns:
name of level (height or pressure)

getLevelValue

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

Returns:
name of level (height or pressure)

getLevelValue2

public float 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)

getCenterId

public int getCenterId()
Returns:
center_id

getSubcenterId

public int getSubcenterId()
Returns:
subcenter_id

getTableVersion

public int getTableVersion()
Returns:
table version

getProcessId

public int getProcessId()
Returns:
process_id

getParamTable

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

Returns:
GribPDSParamTable containing parameter table that defined this parameter

getLocalBaseTime

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

Returns:
date and time

getLocalForecastTime

public java.util.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 java.util.Calendar getGMTBaseTime()
Get the base (analysis) time of the forecast in GMT.

Returns:
date and time

getGMTForecastTime

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

Returns:
date and time

toString

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

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

headerToString

public java.lang.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(java.lang.Object obj)
rdg - added an equals method here

Overrides:
equals in class java.lang.Object
Parameters:
obj - - to test
Returns:
true/false
See Also:
Object.equals(java.lang.Object)

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 - - GribRecordPDS object
Returns:
- -1 if pds is "less than" this, 0 if equal, 1 if pds is "greater than" this.