net.sourceforge.jgrib
Class GribRecordBDS

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

public class GribRecordBDS
extends java.lang.Object

A class representing the binary data section (BDS) of a GRIB record.

Version:
1.0
Author:
Benjamin Stark

Field Summary
protected  int binscale
          Binary scale factor.
protected  boolean isConstant
          rdg - added this to prevent a divide by zero error if variable data empty Indicates whether the BMS is represented by a single value - Octet 12 is empty, and the data is represented by the reference value.
protected  int length
          Length in bytes of this BDS.
protected  float maxvalue
          Maximal parameter value in grid.
protected  float minvalue
          Minimal parameter value in grid.
protected  int numbits
          Number of bits per value.
protected  float refvalue
          Reference value, the base for all parameter values.
static float UNDEFINED
          Constant value for an undefined grid value.
protected  float[] values
          Array of parameter values.
 
Constructor Summary
GribRecordBDS(BitInputStream in, int decimalscale)
          Constructs a GribRecordBDS object from a bit input stream.
GribRecordBDS(BitInputStream in, int decimalscale, GribRecordBMS bms)
          Constructs a GribRecordBDS object from a bit input stream.
 
Method Summary
 int getBinaryScale()
          Get the binary scale factor.
 boolean getIsConstant()
          Get whether this BDS is single valued
 int getLength()
          Get the length in bytes of this section.
 float getMaxValue()
          Get maximum value
 float getMinValue()
          Get minimum value
 int getNumBits()
          Get number of bits used per parameter value.
 float getReferenceValue()
          Get the reference value all data values are based on.
 float getValue(int index)
          Get data/parameter value as a float.
 float[] getValues()
          Get data/parameter values as an array of float.
 java.lang.String toString()
          Get a string representation of this BDS.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNDEFINED

public static final float UNDEFINED
Constant value for an undefined grid value.

See Also:
Constant Field Values

length

protected int length
Length in bytes of this BDS.


binscale

protected int binscale
Binary scale factor.


refvalue

protected float refvalue
Reference value, the base for all parameter values.


numbits

protected int numbits
Number of bits per value.


values

protected float[] values
Array of parameter values.


minvalue

protected float minvalue
Minimal parameter value in grid.


maxvalue

protected float maxvalue
Maximal parameter value in grid.


isConstant

protected boolean isConstant
rdg - added this to prevent a divide by zero error if variable data empty Indicates whether the BMS is represented by a single value - Octet 12 is empty, and the data is represented by the reference value.

Constructor Detail

GribRecordBDS

public GribRecordBDS(BitInputStream in,
                     int decimalscale)
              throws java.io.IOException,
                     NotSupportedException
Constructs a GribRecordBDS object from a bit input stream. A bit map which indicates grid points where no parameter value is defined is not available.

Parameters:
in - - bit input stream with BDS content
decimalscale - - the exponent of the decimal scale
Throws:
java.io.IOException - - if stream can not be opened etc.
NotSupportedException

GribRecordBDS

public GribRecordBDS(BitInputStream in,
                     int decimalscale,
                     GribRecordBMS bms)
              throws java.io.IOException,
                     NotSupportedException
Constructs a GribRecordBDS object from a bit input stream. A bit map indicates the grid points where no parameter value is defined.

Parameters:
in - - bit input stream with BDS content
decimalscale - - the exponent of the decimal scale
bms - - bit map section of GRIB record
Throws:
java.io.IOException - - if stream can not be opened etc.
NotSupportedException
Method Detail

getLength

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

Returns:
length in bytes of this section

getBinaryScale

public int getBinaryScale()
Get the binary scale factor.

Returns:
binary scale factor

getIsConstant

public boolean getIsConstant()
Get whether this BDS is single valued

Returns:
isConstant

getReferenceValue

public float getReferenceValue()
Get the reference value all data values are based on.

Returns:
reference value

getNumBits

public int getNumBits()
Get number of bits used per parameter value.

Returns:
number of bits used per parameter value

getValues

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

Returns:
array of parameter values

getValue

public float getValue(int index)
               throws NoValidGribException
Get data/parameter value as a float.

Parameters:
index -
Returns:
array of parameter values
Throws:
NoValidGribException

getMinValue

public float getMinValue()
Get minimum value

Returns:
mimimum value

getMaxValue

public float getMaxValue()
Get maximum value

Returns:
maximum value

toString

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

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