net.sourceforge.jgrib
Class GribGDSLatLon

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

public class GribGDSLatLon
extends GribRecordGDS

A class that represents the grid definition section (GDS) of a GRIB record with a Lat/Lon grid projection.

Version:
1.0
Author:
Richard Gonzalez based heavily on the original GribRecordGDS

Field Summary
 
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
GribGDSLatLon(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)
          Overrides Object.equals() - perfect for testing
 double[] getGridCoords()
          Get grid coordinates in longitude/latitude pairs Longitude is returned in the range +/- 180 degrees
 double getGridDX()
          Get delta-Lon between two grid points.
 double getGridDY()
          Get delta-Lat between two grid points.
 double getGridLat1()
          Get latitude of grid start point.
 double getGridLat2()
          Get latitude of grid end point.
 double getGridLon1()
          Get longitude of grid start point.
 double getGridLon2()
          Get longitude of grid end point.
 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.
 int getLength()
          Get length in bytes of this section.
 double[] getXCoords()
          Get longitide coordinates converted to the range +/- 180
 double[] getXCoords(boolean convertTo180)
          Get longitide coordinates
 double[] getYCoords()
          Get all latitude coordinates
 int hashCode()
          Overrides Object.hashCode() to be used in hashTables
 boolean isRotatedGrid()
           
 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
getGridLatSP, getGridLonSP, getGridRotAngle
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GribGDSLatLon

public GribGDSLatLon(BitInputStream in,
                     int[] header)
              throws java.io.IOException,
                     NoValidGribException,
                     NotSupportedException
Constructs a GribRecordGDS object from a bit input stream. See Table D of NCEP Office Note 388 for details

Parameters:
in - bit input stream with GDS content
header -
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()
Description copied from class: GribRecordGDS
Overrides Object.hashCode() to be used in hashTables

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

equals

public boolean equals(java.lang.Object obj)
Description copied from class: GribRecordGDS
Overrides Object.equals() - perfect for testing

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. This is type 0.

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

isRotatedGrid

public boolean isRotatedGrid()
Returns:
true/false

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 latitude of grid start point.

Specified by:
getGridLat1 in class GribRecordGDS
Returns:
latitude of grid start point

getGridLon1

public double getGridLon1()
Get longitude of grid start point.

Specified by:
getGridLon1 in class GribRecordGDS
Returns:
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

getGridLat2

public double getGridLat2()
Get latitude of grid end point.

Overrides:
getGridLat2 in class GribRecordGDS
Returns:
latitude of grid end point

getGridLon2

public double getGridLon2()
Get longitude of grid end point.

Overrides:
getGridLon2 in class GribRecordGDS
Returns:
longitude of grid end point

getGridDX

public double getGridDX()
Get delta-Lon between two grid points.

Specified by:
getGridDX in class GribRecordGDS
Returns:
Lon increment

getGridDY

public double getGridDY()
Get delta-Lat between two grid points.

Specified by:
getGridDY in class GribRecordGDS
Returns:
Lat increment

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

getXCoords

public double[] getXCoords()
Get longitide coordinates converted to the range +/- 180

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

getXCoords

public double[] getXCoords(boolean convertTo180)
Get longitide coordinates

Parameters:
convertTo180 -
Returns:
longtitude 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 pairs Longitude is returned in the range +/- 180 degrees

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

toString

public java.lang.String toString()
Get a string representation of this GDS. TODO include more information about this projection

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