net.sourceforge.jgrib
Class GribGDSPolarStereo

java.lang.Object
  extended by net.sourceforge.jgrib.GribRecordGDS
      extended by net.sourceforge.jgrib.GribGDSPolarStereo

public class GribGDSPolarStereo
extends GribRecordGDS

A class that represents the grid definition section (GDS) of a GRIB record.

Version:
2.0 Modified 4 Sep 02 to be constructed by GribGDSFactory - Richard D. Gonzalez
Author:
Benjamin Stark, Capt Richard D. Gonzalez

Field Summary
protected  int grid_proj_center
          Projection Center Flag.
protected  double grid_startx
          starting x value using this projection.
protected  double grid_starty
          starting y value using this projection.
protected  double latitude_ts
          Latitude of Center - assumed 60 N or 60 S based on note 2 of table D
protected  double SCALE_FACTOR
          Central Scale Factor.
 
Fields inherited from class net.sourceforge.jgrib.GribRecordGDS
EARTH_RADIUS, grid_dx, grid_dy, grid_lat1, grid_lat2, grid_latsp, grid_lon1, grid_lon2, grid_lonsp, grid_mode, grid_nx, grid_ny, grid_rotang, grid_scan, grid_type, length
 
Constructor Summary
GribGDSPolarStereo(BitInputStream in, int[] header)
          Constructs a GribRecordGDS object from a bit input stream.
 
Method Summary
 int compare(GribRecordGDS gds)
          rdg - added this method to be used in a comparator for sorting while extracting records.
 boolean equals(java.lang.Object obj)
          Method overrides GribRecordGDS.equals, which in turn overrides the default Object.equals method.
 double getGrid_startx()
           
 double getGrid_starty()
           
 double getGridCenterLat()
          Get the Latitude of the circle where grid lengths are defined
 double getGridCenterLon()
           
 double[] getGridCoords()
          Get grid coordinates in longitude/latitude adapted from J.P.
 double getGridDX()
          Get x-increment/distance between two grid points.
 double getGridDY()
          Get y-increment/distance between two grid points.
 double getGridLat1()
          Get y-coordinate/latitude of grid start point.
 double getGridLon1()
          Get x-coordinate/longitude of grid start point.
 double getGridLov()
          Get East longitude parallel to y-axis
 int getGridMode()
          Get grid mode.
 int getGridNX()
          Get number of grid columns.
 int getGridNY()
          Get number of grid rows.
 int getGridScanmode()
          Get scan mode (sign of increments).
 int getGridType()
          Get type of grid.
 double getLatitudeTrueScale()
           
 int getLength()
          Get length in bytes of this section.
 int getProjCenterFlag()
          Get projection center flag.
 double[] getXCoords()
          Get all longitude coordinates
 double[] getYCoords()
          Get all latitude coordinates
 int hashCode()
          Overides method from GribRecordGDS
 boolean isUVEastNorth()
          Table J.Resolution and Component Flags, bit 5 (from left) = 2^(8-5) = 8 = 0x08 : false = u and v components are relative to east, north true = u and v components are relative to grid x,y direction (i,j)
 java.lang.String toString()
          Get a string representation of this GDS.
 
Methods inherited from class net.sourceforge.jgrib.GribRecordGDS
getGridLat2, getGridLatSP, getGridLon2, getGridLonSP, getGridRotAngle
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

grid_proj_center

protected int grid_proj_center
Projection Center Flag.


grid_startx

protected double grid_startx
starting x value using this projection. This is not a Longitude, but an x value based on the projection


grid_starty

protected double grid_starty
starting y value using this projection. This is not a Latitude, but a y value based on the projection


SCALE_FACTOR

protected final double SCALE_FACTOR
Central Scale Factor. Assumed 1.0

See Also:
Constant Field Values

latitude_ts

protected double latitude_ts
Latitude of Center - assumed 60 N or 60 S based on note 2 of table D

Constructor Detail

GribGDSPolarStereo

public GribGDSPolarStereo(BitInputStream in,
                          int[] header)
                   throws java.io.IOException,
                          NoValidGribException,
                          NotSupportedException
Constructs a GribRecordGDS object from a bit input stream.

Parameters:
in - bit input stream with GDS content
header - - int array with first six octets of the GDS
Throws:
java.io.IOException - if stream can not be opened etc.
NoValidGribException - if stream contains no valid GRIB file
NotSupportedException
Method Detail

isUVEastNorth

public boolean isUVEastNorth()
Description copied from class: GribRecordGDS
Table J.Resolution and Component Flags, bit 5 (from left) = 2^(8-5) = 8 = 0x08 : false = u and v components are relative to east, north true = u and v components are relative to grid x,y direction (i,j)

Specified by:
isUVEastNorth in class GribRecordGDS
Returns:
true/false
See Also:
GribRecordGDS.isUVEastNorth()

compare

public int compare(GribRecordGDS gds)
Description copied from class: GribRecordGDS
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.

Specified by:
compare in class GribRecordGDS
Parameters:
gds - - GribRecordGDS
Returns:
- -1 if gds is "less than" this, 0 if equal, 1 if gds is "greater than" this.
See Also:
GribRecordGDS.compare(net.sourceforge.jgrib.GribRecordGDS)

hashCode

public int hashCode()
Overides method from GribRecordGDS

Specified by:
hashCode in class GribRecordGDS
Returns:
integer value of hashCode
See Also:
GribRecordGDS.hashCode()

equals

public boolean equals(java.lang.Object obj)
Method overrides GribRecordGDS.equals, which in turn overrides the default Object.equals method.

Specified by:
equals in class GribRecordGDS
Returns:
true/false if objects are equal
See Also:
GribRecordGDS.equals(java.lang.Object)

getLength

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

Specified by:
getLength in class GribRecordGDS
Returns:
length in bytes of this section

getGridType

public int getGridType()
Get type of grid.

Specified by:
getGridType in class GribRecordGDS
Returns:
type of grid

getGridNX

public int getGridNX()
Get number of grid columns.

Specified by:
getGridNX in class GribRecordGDS
Returns:
number of grid columns

getGridNY

public int getGridNY()
Get number of grid rows.

Specified by:
getGridNY in class GribRecordGDS
Returns:
number of grid rows.

getGridLat1

public double getGridLat1()
Get y-coordinate/latitude of grid start point.

Specified by:
getGridLat1 in class GribRecordGDS
Returns:
y-coordinate/latitude of grid start point

getGridLon1

public double getGridLon1()
Get x-coordinate/longitude of grid start point.

Specified by:
getGridLon1 in class GribRecordGDS
Returns:
x-coordinate/longitude of grid start point

getGridMode

public int getGridMode()
Get grid mode. Only 128 (increments given) supported so far.

Specified by:
getGridMode in class GribRecordGDS
Returns:
grid mode

getGridLov

public double getGridLov()
Get East longitude parallel to y-axis

Returns:
longitude

getGridDX

public double getGridDX()
Get x-increment/distance between two grid points.

Specified by:
getGridDX in class GribRecordGDS
Returns:
x-increment

getGridDY

public double getGridDY()
Get y-increment/distance between two grid points.

Specified by:
getGridDY in class GribRecordGDS
Returns:
y-increment

getProjCenterFlag

public int getProjCenterFlag()
Get projection center flag.

Returns:
projection center flag

getGridScanmode

public int getGridScanmode()
Get scan mode (sign of increments). Only 64, 128 and 192 supported so far.

Specified by:
getGridScanmode in class GribRecordGDS
Returns:
scan mode

getGridCenterLon

public double getGridCenterLon()

getGridCenterLat

public double getGridCenterLat()
Get the Latitude of the circle where grid lengths are defined

Returns:
grid_center_lat

getLatitudeTrueScale

public double getLatitudeTrueScale()

getXCoords

public double[] getXCoords()
Get all longitude coordinates

Specified by:
getXCoords in class GribRecordGDS
Returns:
longitude as double

getYCoords

public double[] getYCoords()
Get all latitude coordinates

Specified by:
getYCoords in class GribRecordGDS
Returns:
latitude as double

getGridCoords

public double[] getGridCoords()
Get grid coordinates in longitude/latitude adapted from J.P. Snyder, Map Projections - A Working Manual, U.S. Geological Survey Professional Paper 1395, 1987 Maintained his symbols, so the code matches his work. Somewhat hard to follow, if interested, suggest looking up quick reference at http://mathworld.wolfram.com/PolarStereoConicProjection.html assumes scale factor of 1.0 rdg - may not be correct yet - did not align with display software I was using, but they implemented using a center point, vice LOV TODO verify projection implementation

Specified by:
getGridCoords in class GribRecordGDS
Returns:
longitide/latitude as doubles
See Also:
GribRecordGDS.getGridCoords()

getGrid_startx

public double getGrid_startx()
Returns:
Value of x start point as double

getGrid_starty

public double getGrid_starty()
Returns:
Value of y start point as double

toString

public java.lang.String toString()
Get a string representation of this GDS. TODO - ensure this returns PS specific info - probably still a copy of LC

Specified by:
toString in class GribRecordGDS
Returns:
string representation of this GDS
See Also:
Object.toString()