net.sourceforge.jgrib
Class GribGDSLambert

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

public class GribGDSLambert
extends GribRecordGDS

A class that represents the Grid Definition Section (GDS) of a GRIB record using the Lambert Conformal projection.

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

Field Summary
protected  double grid_latin1
          Latin 1 - The first latitude from pole at which secant cone cuts the sperical earth.
protected  double grid_latin2
          Latin 2 - The second latitude from pole at which secant cone cuts the sperical earth.
protected  double grid_latsp
          latitude of south pole.
protected  double grid_lonsp
          longitude of south pole.
protected  double grid_startx
          starting x value using this projection.
protected  double grid_starty
          starting y value using this projection.
protected  int proj_center
          Projection Center Flag.
 
Fields inherited from class net.sourceforge.jgrib.GribRecordGDS
EARTH_RADIUS, grid_dx, grid_dy, grid_lat1, grid_lat2, grid_lon1, grid_lon2, grid_mode, grid_nx, grid_ny, grid_rotang, grid_scan, grid_type, length
 
Constructor Summary
GribGDSLambert(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[] getGridCoords()
          Get grid coordinates in latitude/longitude 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 getGridLatin1()
          Get first latitude from the pole at which cone cuts spherical earth - see note 8 of Table D
 double getGridLatin2()
          Get second latitude from the pole at which cone cuts spherical earth - see note 8 of Table D
 double getGridLatSP()
          Get latitude of south pole.
 double getGridLon1()
          Get x-coordinate/longitude of grid start point.
 double getGridLonSP()
          Get longitude of south pole of a rotated latitude/longitude grid.
 double getGridLov()
          Get orientation of the grid
 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 getProjCenter()
          Get Projection Center flag - see note 5 of Table D.
 double getStartX()
          Get starting x value for this grid - THIS IS NOT A LONGITUDE, but an x value calculated for this specific projection, based on an origin of latin1, lov.
 double getStartY()
          Get starting y value for this grid - THIS IS NOT A LATITUDE, but an y value calculated for this specific projection, based on an origin of latin1, lov.
 double[] getXCoords()
          Get all x Axis grid coordinates
 double[] getYCoords()
          Get all y Axis grid 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, getGridLon2, getGridRotAngle
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

proj_center

protected int proj_center
Projection Center Flag.


grid_latin1

protected double grid_latin1
Latin 1 - The first latitude from pole at which secant cone cuts the sperical earth. See Note 8 of ON388.


grid_latin2

protected double grid_latin2
Latin 2 - The second latitude from pole at which secant cone cuts the sperical earth. See Note 8 of ON388.


grid_latsp

protected double grid_latsp
latitude of south pole.


grid_lonsp

protected double grid_lonsp
longitude of south pole.


grid_startx

protected double grid_startx
starting x value using this projection. This is NOT a lat or lon, but a grid position in this projection


grid_starty

protected double grid_starty
starting y value using this projection. This is NOT a lat or lon, but a grid position in this projection

Constructor Detail

GribGDSLambert

public GribGDSLambert(BitInputStream in,
                      int[] header)
               throws java.io.IOException,
                      NoValidGribException
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
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 orientation of the grid

Returns:
east longitude value of meridian parallel to y axis.

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

getProjCenter

public double getProjCenter()
Get Projection Center flag - see note 5 of Table D.

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

getGridLatin1

public double getGridLatin1()
Get first latitude from the pole at which cone cuts spherical earth - see note 8 of Table D

Returns:
latitude of south pole

getGridLatin2

public double getGridLatin2()
Get second latitude from the pole at which cone cuts spherical earth - see note 8 of Table D

Returns:
latitude of south pole

getGridLatSP

public double getGridLatSP()
Get latitude of south pole.

Overrides:
getGridLatSP in class GribRecordGDS
Returns:
latitude of south pole

getGridLonSP

public double getGridLonSP()
Get longitude of south pole of a rotated latitude/longitude grid.

Overrides:
getGridLonSP in class GribRecordGDS
Returns:
longitude of south pole

getStartX

public double getStartX()
Get starting x value for this grid - THIS IS NOT A LONGITUDE, but an x value calculated for this specific projection, based on an origin of latin1, lov.

Returns:
x grid value of first point of this grid.

getStartY

public double getStartY()
Get starting y value for this grid - THIS IS NOT A LATITUDE, but an y value calculated for this specific projection, based on an origin of latin1, lov.

Returns:
y grid value of first point of this grid.

getXCoords

public double[] getXCoords()
Get all x Axis grid coordinates

Specified by:
getXCoords in class GribRecordGDS
Returns:
array of coordinates in the LC projection for the x axis. These are the LC coordinates that equate to the Longitudes along the x axis. rdg - modified to return in km, vice m

getYCoords

public double[] getYCoords()
Get all y Axis grid coordinates

Specified by:
getYCoords in class GribRecordGDS
Returns:
array of coordinates in the LC projection for the y axis. These are the LC coordinates that equate to the Latitudes along the y axis. rdg - converted to return km vice m

getGridCoords

public double[] getGridCoords()
Get grid coordinates in latitude/longitude 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/LambertConformalConicProjection.html Origin is where Lov intersects Latin1. Note: In GRIB table D, the first standard parallel (Latin1) is the one closest to the pole. In the mathematical formulas, the first standard parallel is the one closest to the equator. Therefore, the math looks backwards here, but it isn't.

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

toString

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

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