net.sourceforge.jgrib
Class GribRecordGDS

Object
  extended by GribRecordGDS
Direct Known Subclasses:
GribGDSLambert, GribGDSLatLon, GribGDSPolarStereo, GribGDSRotatedLatLon

public abstract class GribRecordGDS
extends Object

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

Author:
Benjamin Stark, Capt Richard D. Gonzalez, USAF, Simone Giannecchini

Field Summary
protected  boolean adiacent_i
          Adiacent rows?
 double EARTH_RADIUS
          Radius of earth used in calculating projections
protected  double grid_dx
          x-distance between two grid points can be delta-Lon or delta x.
protected  double grid_dy
          y-distance of two grid points can be delta-Lat or delta y.
protected  double grid_lat1
          Latitude of grid start point.
protected  double grid_lat2
          Latitude of grid end point.
protected  double grid_latsp
          y-coordinate/latitude of south pole of a rotated lat/lon grid.
protected  double grid_lon1
          Longitude of grid start point.
protected  double grid_lon2
          Longitude of grid end point.
protected  double grid_lonsp
          x-coordinate/longitude of south pole of a rotated lat/lon grid.
protected  int grid_mode
          Mode of grid (See table 7) only 128 supported == increments given)
protected  int grid_nx
          Number of grid columns.
protected  int grid_ny
          Number of grid rows.
protected  double grid_rotang
          Rotation angle of rotated lat/lon grid.
protected  int grid_scan
          Scanning mode (See table 8).
protected  int grid_type
          Type of grid (See table 6)
protected  int length
          Length in bytes of this section.
 
Constructor Summary
GribRecordGDS()
          GribRecordGDS
GribRecordGDS(int[] header)
          New constructor created for child classes.
 
Method Summary
 int compare(GribRecordGDS gds)
          rdg - added this method to be used in a comparator for sorting while extracting records.
 boolean equals(Object obj)
           
 double[] getGridCoords()
          Get grid coordinates in longitude/latitude
 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 getGridLat2()
          Get y-coordinate/latitude of grid end point.
 double getGridLatSP()
          Get y-coordinate/latitude of south pole of a rotated latitude/longitude grid.
 double getGridLon1()
          Get x-coordinate/longitude of grid start point.
 double getGridLon2()
          Get x-coordinate/longitude of grid end point.
 double getGridLonSP()
          Get x-coordinate/longitude of south pole of a rotated latitude/longitude grid.
 int getGridMode()
          Get grid mode.
 int getGridNX()
          Get number of grid columns.
 int getGridNY()
          Get number of grid rows.
 double getGridRotAngle()
          Get grid rotation angle of a rotated latitude/longitude grid.
 int getGridScanmode()
          Get scan mode (sign of increments).
 int getGridType()
          Get type of grid.
 int getLength()
          Get length in bytes of this section.
 int hashCode()
           
 boolean isAdiacent_i_Or_j()
          isAdiacent_i_Or_j
 void setGridDX(double grid_dx)
          Set delta-Lon between two grid points.
 void setGridDY(double grid_dy)
          Set delta-Lat between two grid points.
 void setGridLat1(double grid_lat1)
          set latitude of grid start point.
 void setGridLat2(double grid_lat2)
          set latitude of grid end point.
 void setGridLatSP(double grid_latsp)
          set y-coordinate/latitude of south pole of a rotated latitude/longitude grid.
 void setGridLon1(double grid_lon1)
          set longitude of grid start point.
 void setGridLon2(double grid_lon2)
          set longitude of grid end point.
 void setGridLonSP(double grid_lonsp)
          set x-coordinate/longitude of south pole of a rotated latitude/longitude grid.
 void setGridMode(int grid_mode)
           
 void setGridNX(int grid_nx)
          set number of grid columns.
 void setGridNY(int grid_ny)
          set number of grid rows.
 void setGridRotAngle(double grid_rotang)
          Set grid rotation angle of a rotated latitude/longitude grid.
 void setGridScanmode(boolean plus_i, boolean plus_j, boolean adiacents_i)
          Set scan mode (sign of increments).
 void setGridType(int grid_type)
          Set type of grid.
 void setLength(int length)
           
 String toString()
          Get a string representation of this GDS.
abstract  void writeTo(OutputStream out)
          writeTo
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

length

protected int length
Length in bytes of this section.


adiacent_i

protected boolean adiacent_i
Adiacent rows?


grid_type

protected int grid_type
Type of grid (See table 6)


grid_nx

protected int grid_nx
Number of grid columns. (Also Ni)


grid_ny

protected int grid_ny
Number of grid rows. (Also Nj)


grid_lat1

protected double grid_lat1
Latitude of grid start point.


grid_lon1

protected double grid_lon1
Longitude of grid start point.


grid_mode

protected int grid_mode
Mode of grid (See table 7) only 128 supported == increments given)


grid_lat2

protected double grid_lat2
Latitude of grid end point.


grid_lon2

protected double grid_lon2
Longitude of grid end point.


grid_dx

protected double grid_dx
x-distance between two grid points can be delta-Lon or delta x.


grid_dy

protected double grid_dy
y-distance of two grid points can be delta-Lat or delta y.


grid_scan

protected int grid_scan
Scanning mode (See table 8).


grid_latsp

protected double grid_latsp
y-coordinate/latitude of south pole of a rotated lat/lon grid.


grid_lonsp

protected double grid_lonsp
x-coordinate/longitude of south pole of a rotated lat/lon grid.


grid_rotang

protected double grid_rotang
Rotation angle of rotated lat/lon grid.


EARTH_RADIUS

public final double EARTH_RADIUS
Radius of earth used in calculating projections

See Also:
Constant Field Values
Constructor Detail

GribRecordGDS

public GribRecordGDS(int[] header)
New constructor created for child classes.

Parameters:
header - - integer array of header data (octets 1-6) read in GribGDSFactory exceptions are thrown in children and passed up

GribRecordGDS

public GribRecordGDS()
GribRecordGDS

Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

compare

public int compare(GribRecordGDS gds)
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.

Parameters:
gds - - the GribRecordGDS to compare to
Returns:
- -1 if gds is "less than" this, 0 if equal, 1 if gds is "greater than" this.

getLength

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

Returns:
length in bytes of this section

getGridType

public int getGridType()
Get type of grid. Only 0 (lat/lon grid) and 10 (rot lat/lon grid) supported so far.

Returns:
type of grid

setGridType

public void setGridType(int grid_type)
Set type of grid. This is type 0.

Parameters:
grid_type - DOCUMENT ME!

getGridNX

public int getGridNX()
Get number of grid columns.

Returns:
number of grid columns

setGridNX

public void setGridNX(int grid_nx)
set number of grid columns.

Parameters:
grid_nx - DOCUMENT ME!

getGridNY

public int getGridNY()
Get number of grid rows.

Returns:
number of grid rows.

setGridNY

public void setGridNY(int grid_ny)
set number of grid rows.

Parameters:
grid_ny - DOCUMENT ME!

getGridLat1

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

Returns:
y-coordinate/latitude of grid start point

setGridLat1

public void setGridLat1(double grid_lat1)
set latitude of grid start point.

Parameters:
grid_lat1 - DOCUMENT ME!

getGridLon1

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

Returns:
x-coordinate/longitude of grid start point

setGridLon1

public void setGridLon1(double grid_lon1)
set longitude of grid start point.

Parameters:
grid_lon1 - DOCUMENT ME!

getGridMode

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

Returns:
grid mode

setGridMode

public void setGridMode(int grid_mode)

getGridLat2

public double getGridLat2()
Get y-coordinate/latitude of grid end point.

Returns:
y-coordinate/latitude of grid end point

setGridLat2

public void setGridLat2(double grid_lat2)
set latitude of grid end point.

Parameters:
grid_lat2 - DOCUMENT ME!

getGridLon2

public double getGridLon2()
Get x-coordinate/longitude of grid end point.

Returns:
x-coordinate/longitude of grid end point

setGridLon2

public void setGridLon2(double grid_lon2)
set longitude of grid end point.

Parameters:
grid_lon2 - DOCUMENT ME!

getGridDX

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

Returns:
x-increment

setGridDX

public void setGridDX(double grid_dx)
Set delta-Lon between two grid points.

Parameters:
grid_dx - DOCUMENT ME!

getGridDY

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

Returns:
y-increment

setGridDY

public void setGridDY(double grid_dy)
Set delta-Lat between two grid points.

Parameters:
grid_dy - DOCUMENT ME!

getGridScanmode

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

Returns:
scan mode

setGridScanmode

public void setGridScanmode(boolean plus_i,
                            boolean plus_j,
                            boolean adiacents_i)
Set scan mode (sign of increments). Only 64, 128 and 192 supported so far.

Parameters:
plus_i - DOCUMENT ME!
plus_j - DOCUMENT ME!
adiacents_i - DOCUMENT ME!

getGridLatSP

public double getGridLatSP()
Get y-coordinate/latitude of south pole of a rotated latitude/longitude grid.

Returns:
latitude of south pole

setGridLatSP

public void setGridLatSP(double grid_latsp)
set y-coordinate/latitude of south pole of a rotated latitude/longitude grid.

Parameters:
grid_latsp - DOCUMENT ME!

getGridLonSP

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

Returns:
longitude of south pole

setGridLonSP

public void setGridLonSP(double grid_lonsp)
set x-coordinate/longitude of south pole of a rotated latitude/longitude grid.

Parameters:
grid_lonsp - DOCUMENT ME!

getGridRotAngle

public double getGridRotAngle()
Get grid rotation angle of a rotated latitude/longitude grid.

Returns:
rotation angle

setGridRotAngle

public void setGridRotAngle(double grid_rotang)
Set grid rotation angle of a rotated latitude/longitude grid.

Parameters:
grid_rotang - DOCUMENT ME!

getGridCoords

public double[] getGridCoords()
Get grid coordinates in longitude/latitude

Returns:
longitide/latituide as doubles

toString

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

Overrides:
toString in class Object
Returns:
string representation of this GDS

writeTo

public abstract void writeTo(OutputStream out)
                      throws IOException
writeTo

Parameters:
out - OutputStream
Throws:
IOException - DOCUMENT ME!

isAdiacent_i_Or_j

public boolean isAdiacent_i_Or_j()
isAdiacent_i_Or_j

Returns:
DOCUMENT ME!

setLength

public void setLength(int length)
Parameters:
length - The length to set.


Copyright © 2006-2010 GeoSolutions. All Rights Reserved.