dk.dmi.jog
Class GridInterpolation

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

public class GridInterpolation
extends Object

A 4-dimensional grid (x,y,z,t) with interpolation methods. The class extends the Grid class (through composition) with interpolation methods. Missing values are represented by Float.NaN.


Method Summary
 boolean equals(Object o)
           
 GridInterpolation fillMissingValues()
          Returns a horizontally interpolated version of this GridInterpolation.
 GridInterpolation fillMissingValues(int radius)
          Returns a horizontally interpolated version of this GridInterpolation.
 GridInterpolation filterAsselin()
          Returns a smoothed version of this GridInterpolation.
 GridInterpolation gaussianGridInterpolation(int n, float radius, float c)
          Returns a horizontally interpolated version of this GridInterpolation using Gaussian weights.
 float[][][][] getData()
           
 Date[] getDates()
           
 String getGridName()
           
static GridInterpolation getInstance(Grid g)
           
static GridInterpolation getInstance(String par, float[] z, float x0, float y0, float dx, float dy, Date[] t, float[][][][] d)
           
static GridInterpolation getInstance(String par, float[] z, float x0, float y0, float dx, float dy, int nx, int ny, Date[] dates, Station[] stations)
           
 float getOriginX()
           
 float getOriginY()
           
 float getResolutionX()
           
 float getResolutionY()
           
 int getSizeT()
           
 int getSizeX()
           
 int getSizeY()
           
 int getSizeZ()
           
 float[] getVerticalLevels()
           
 int hashCode()
           
 GridInterpolation interpolateLinearDepth(float[] levels)
          Returns a vertically interpolated GridInterpolation based on this GridInterpolation.
 GridInterpolation regridBoxAverage(float x0, float y0, float dx, float dy, int nxn, int nyn)
          Returns a regridded version of this GridInterpolation.
 GridInterpolation regridLinear(float x0, float y0, float dx, float dy, int nxn, int nyn)
          Returns a regridded version of this GridInterpolation.
 GridInterpolation regridLinear(Grid g)
          Returns a regridded version of this GridInterpolation.
 Grid toGrid()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

equals

public boolean equals(Object o)

fillMissingValues

public GridInterpolation fillMissingValues()
Returns a horizontally interpolated version of this GridInterpolation. A search radius of 3 is used.

Returns:
a horizontally interpolated version of this GridInterpolation.

fillMissingValues

public GridInterpolation fillMissingValues(int radius)
Returns a horizontally interpolated version of this GridInterpolation. After the interpolation no missing values remain.

Parameters:
radius - number of surrounding grid points which are used in the interpolation of missing values..
Returns:
a horizontally interpolated version of this GridInterpolation.

filterAsselin

public GridInterpolation filterAsselin()
Returns a smoothed version of this GridInterpolation. The applied filter is a two dimensional Asselin filter.

Returns:
a smoothed version of this GridInterpolation.

gaussianGridInterpolation

public GridInterpolation gaussianGridInterpolation(int n,
                                                   float radius,
                                                   float c)
Returns a horizontally interpolated version of this GridInterpolation using Gaussian weights. After the interpolation no missing values remain. It is recommended that this method is only used for interpolating Grids containing a limited number of non-missing values.

Parameters:
n - number of points used in the calculation of one grid point.
radius - radius of influence. This method only searches for data points within the radius of influence. If less than n are available only these points are used.
c - correlation length.
Returns:
a horizontally interpolated version of this GridInterpolation using Gaussian weights.

getData

public float[][][][] getData()

getDates

public Date[] getDates()

getGridName

public String getGridName()

getInstance

public static GridInterpolation getInstance(Grid g)

getInstance

public static GridInterpolation getInstance(String par,
                                            float[] z,
                                            float x0,
                                            float y0,
                                            float dx,
                                            float dy,
                                            Date[] t,
                                            float[][][][] d)

getInstance

public static GridInterpolation getInstance(String par,
                                            float[] z,
                                            float x0,
                                            float y0,
                                            float dx,
                                            float dy,
                                            int nx,
                                            int ny,
                                            Date[] dates,
                                            Station[] stations)

getOriginX

public float getOriginX()

getOriginY

public float getOriginY()

getResolutionX

public float getResolutionX()

getResolutionY

public float getResolutionY()

getSizeT

public int getSizeT()

getSizeX

public int getSizeX()

getSizeY

public int getSizeY()

getSizeZ

public int getSizeZ()

getVerticalLevels

public float[] getVerticalLevels()

hashCode

public int hashCode()

interpolateLinearDepth

public GridInterpolation interpolateLinearDepth(float[] levels)
Returns a vertically interpolated GridInterpolation based on this GridInterpolation.

Parameters:
levels - depth levels to interpolate to.
Returns:
a vertically interpolated GridInterpolation based on this GridInterpolation.

regridBoxAverage

public GridInterpolation regridBoxAverage(float x0,
                                          float y0,
                                          float dx,
                                          float dy,
                                          int nxn,
                                          int nyn)
Returns a regridded version of this GridInterpolation. The regridding is a simple box average. The resulting GridInterpolation must have a coarser resolution than this GridInterpolation. Missing values are returned where the new grid definition extends the old.

Parameters:
x0 - longitude of the origin of this GridInterpolation.
y0 - latitude of the origin of this GridInterpolation.
dx - longitudinal resolution of this GridInterpolation.
dy - latitudinal resolution of this GridInterpolation.
nxn - number of grid points in longitudinal direction.
nyn - number of grid points in latitudinal direction.
Returns:
a simple box average regridded version of this GridInterpolation.

regridLinear

public GridInterpolation regridLinear(float x0,
                                      float y0,
                                      float dx,
                                      float dy,
                                      int nxn,
                                      int nyn)
Returns a regridded version of this GridInterpolation. The regridding is bi-linear. Missing values are returned where the new grid definition extends the old.

Parameters:
x0 - longitude of the origin of this GridInterpolation.
y0 - latitude of the origin of this GridInterpolation.
dx - longitudinal resolution of this GridInterpolation.
dy - latitudinal resolution of this GridInterpolation.
nxn - number of grid points in longitudinal direction.
nyn - number of grid points in latitudinal direction.
Returns:
a bi-linearly regridded version of this GridInterpolation.

regridLinear

public GridInterpolation regridLinear(Grid g)
Returns a regridded version of this GridInterpolation. The regridding is bi-linear. Missing values are returned where the new grid definition extends the old.

Parameters:
g - GridInterpolation to extract grid parameters to interpolate to.
Returns:
a bi-linearly regridded version of this GridInterpolation.

toGrid

public Grid toGrid()

toString

public String toString()