dk.dmi.jog
Class Grid

java.lang.Object
  extended bydk.dmi.jog.Grid

public class Grid
extends Object

A 4-dimensional grid (x,y,z,t). Missing values are represented by Float.NaN.


Method Summary
 boolean equals(Object o)
          Compares this Grid to the specified Object.
 float[][][][] getData()
          Returns the data array of this Grid.
 Date[] getDates()
          Returns the time steps of this Grid.
 String getGridName()
          Returns the name of this Grid.
static Grid getInstance(String par, float[] z, float x0, float y0, float dx, float dy, Date[] t, float[][][][] d)
          Returns a Grid representation of the arguments.
static Grid getInstance(String par, float[] z, float x0, float y0, float dx, float dy, int nx, int ny, Date[] dates, Station[] stations)
          Returns a Grid representation of the arguments by inserting the Station array into the Grid.
 float getOriginX()
          Returns the longitude of the origin of this Grid.
 float getOriginY()
          Returns the latitude of the origin of this Grid.
 float getResolutionX()
          Returns the longitudinal resolution of this Grid.
 float getResolutionY()
          Returns the latitudinal resolution of this Grid.
 int getSizeT()
          Returns the size of the time dimension of this Grid.
 int getSizeX()
          Returns the size of the x-dimension of this Grid.
 int getSizeY()
          Returns the size of the y-dimension of this Grid.
 int getSizeZ()
          Returns the number of vertical levels in this Grid.
 float[] getVerticalLevels()
          Returns the vertical levels of this Grid.
 int hashCode()
           
 Grid mask(Grid g)
          Returns this Grid with data values masked out where the argument Grid has Float.NaN.
 Grid merge(Grid g, float w)
          Returns this Grid merged with the argument Grid.
 String toString()
          Returns a String representation of this Grid.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

equals

public boolean equals(Object o)
Compares this Grid to the specified Object. The result is true if and only if the argument is not null and is a Grid which is identical to this Grid.

Parameters:
o - the Object to be compared for equality with this Grid.
Returns:
true if the objects are identical; false otherwise.

getData

public float[][][][] getData()
Returns the data array of this Grid.

Returns:
the data array of this Grid.

getDates

public Date[] getDates()
Returns the time steps of this Grid.

Returns:
the time steps of this Grid.

getGridName

public String getGridName()
Returns the name of this Grid.

Returns:
the name of this Grid.

getInstance

public static Grid getInstance(String par,
                               float[] z,
                               float x0,
                               float y0,
                               float dx,
                               float dy,
                               Date[] t,
                               float[][][][] d)
Returns a Grid representation of the arguments.

Parameters:
par - array containing parameter names in this Grid.
z - array containing the vertical levels for this Grid.
x0 - longitude of the origin of this Grid.
y0 - latitude of the origin of this Grid.
dx - longitudinal resolution of this Grid.
dy - longitudinal resolution of this Grid.
t - times of this Grid.
Returns:
a Grid representation of the arguments.

getInstance

public static Grid getInstance(String par,
                               float[] z,
                               float x0,
                               float y0,
                               float dx,
                               float dy,
                               int nx,
                               int ny,
                               Date[] dates,
                               Station[] stations)
Returns a Grid representation of the arguments by inserting the Station array into the Grid.

Parameters:
par - parameter to be gridded and thus parameter name for data in this Grid.
z - array containing the vertical levels for this Grid.
x0 - longitude of the origin of this Grid.
y0 - latitude of the origin of this Grid.
dx - longitudinal resolution of this Grid.
dy - longitudinal resolution of this Grid.
dates - dates of this Grid (Stations will be put into the time step closest to their own).
stations - to be gridded.
Returns:
a Grid representation of the arguments.

getOriginX

public float getOriginX()
Returns the longitude of the origin of this Grid.

Returns:
the longitude of the origin of this Grid.

getOriginY

public float getOriginY()
Returns the latitude of the origin of this Grid.

Returns:
the latitude of the origin of this Grid.

getResolutionX

public float getResolutionX()
Returns the longitudinal resolution of this Grid.

Returns:
the longitudinal resolution of this Grid.

getResolutionY

public float getResolutionY()
Returns the latitudinal resolution of this Grid.

Returns:
the latitudinal resolution of this Grid.

getSizeT

public int getSizeT()
Returns the size of the time dimension of this Grid.

Returns:
the size of the time dimension of this Grid.

getSizeX

public int getSizeX()
Returns the size of the x-dimension of this Grid.

Returns:
the size of the x-dimension of this Grid.

getSizeY

public int getSizeY()
Returns the size of the y-dimension of this Grid.

Returns:
the size of the y-dimension of this Grid.

getSizeZ

public int getSizeZ()
Returns the number of vertical levels in this Grid.

Returns:
the number of vertical levels in this Grid.

getVerticalLevels

public float[] getVerticalLevels()
Returns the vertical levels of this Grid.

Returns:
the vertical levels of this Grid.

hashCode

public int hashCode()

mask

public Grid mask(Grid g)
Returns this Grid with data values masked out where the argument Grid has Float.NaN. The Grids must have equal dimensions except for time where only the first time step of the argument Grid is used.

Parameters:
g - Grid to mask out values of this Grid;
Returns:
this Grid with data values masked out where the argument Grid has Float.NaN.

merge

public Grid merge(Grid g,
                  float w)
Returns this Grid merged with the argument Grid. The Grids must be identical except for the data they contain.

Parameters:
g - Grid to merge with this Grid;
w - weight of the argument Grid. A weight of 0.5 corresponds to equal weigthing of the Grids.
Returns:
this Grid merged with the argument Grid.

toString

public String toString()
Returns a String representation of this Grid.

Returns:
a String representation of this Grid.