org.ala.layers.intersect
Class Grid

java.lang.Object
  extended by org.ala.layers.intersect.Grid

public class Grid
extends java.lang.Object

Grid.java Created on June 24, 2005, 4:12 PM

Author:
Robert Hijmans, rhijmans@berkeley.edu Updated 15/2/2010, Adam Interface for .gri/.grd files for now

Field Summary
 java.lang.Boolean byteorderLSB
           
 java.lang.String datatype
           
 java.lang.String filename
           
protected  org.apache.log4j.Logger logger
          Log4j instance
 double maxval
           
 double minval
           
 int ncols
           
 double nodatavalue
           
 int nrows
           
 java.lang.String units
           
 java.lang.Boolean valid
           
 double[] values
           
 double xmax
           
 double xmin
           
 double xres
           
 double ymax
           
 double ymin
           
 double yres
           
 
Constructor Summary
Grid(java.lang.String fname)
          loads grd for gri file reference
 
Method Summary
 float[] calculatetMinMax()
           
 int getcellnumber(double x, double y)
           
 float[] getGrid()
           
static Grid getGrid(java.lang.String filename)
           
static Grid getGridStandardized(java.lang.String filename)
           
static Grid getLoadedGrid(java.lang.String filename)
           
 float[] getValues(double[][] points)
           
 float[] getValues2(double[][] points)
          do get values of grid for provided points.
 float[] getValues3(double[][] points, int bufferSize)
           
 void mergeMissingValues(Grid sourceOfMissingValues, boolean hideMissing)
           
 void printMinMax()
           
 void writeGrid(java.lang.String newfilename, double[] dfiltered, double xmin, double ymin, double xmax, double ymax, double xres, double yres, int nrows, int ncols)
          for grid cutter writes out a list of double (same as getGrid() returns) to a file byteorderlsb data type, FLOAT
 void writeGrid(java.lang.String newfilename, float[] dfiltered, double xmin, double ymin, double xmax, double ymax, double xres, double yres, int nrows, int ncols)
           
 void writeGrid(java.lang.String newfilename, int[] dfiltered, double xmin, double ymin, double xmax, double ymax, double xres, double yres, int nrows, int ncols)
          for DomainGenerator writes out a list of double (same as getGrid() returns) to a file byteorderlsb data type, FLOAT
 void writeHeader(java.lang.String newfilename, double xmin, double ymin, double xmax, double ymax, double xres, double yres, int nrows, int ncols, double minvalue, double maxvalue)
           
 void writeHeader(java.lang.String newfilename, double xmin, double ymin, double xmax, double ymax, double xres, double yres, int nrows, int ncols, double minvalue, double maxvalue, java.lang.String datatype, java.lang.String nodata)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected org.apache.log4j.Logger logger
Log4j instance


byteorderLSB

public java.lang.Boolean byteorderLSB

ncols

public int ncols

nrows

public int nrows

nodatavalue

public double nodatavalue

valid

public java.lang.Boolean valid

values

public double[] values

xmin

public double xmin

xmax

public double xmax

ymin

public double ymin

ymax

public double ymax

xres

public double xres

yres

public double yres

datatype

public java.lang.String datatype

minval

public double minval

maxval

public double maxval

filename

public java.lang.String filename

units

public java.lang.String units
Constructor Detail

Grid

public Grid(java.lang.String fname)
loads grd for gri file reference

Parameters:
fname - full path and file name without file extension of .gri and .grd files to open
Method Detail

getGrid

public static Grid getGrid(java.lang.String filename)

getLoadedGrid

public static Grid getLoadedGrid(java.lang.String filename)

getGridStandardized

public static Grid getGridStandardized(java.lang.String filename)

getcellnumber

public int getcellnumber(double x,
                         double y)

getGrid

public float[] getGrid()

writeGrid

public void writeGrid(java.lang.String newfilename,
                      int[] dfiltered,
                      double xmin,
                      double ymin,
                      double xmax,
                      double ymax,
                      double xres,
                      double yres,
                      int nrows,
                      int ncols)
for DomainGenerator writes out a list of double (same as getGrid() returns) to a file byteorderlsb data type, FLOAT

Parameters:
newfilename -
dfiltered -

writeGrid

public void writeGrid(java.lang.String newfilename,
                      double[] dfiltered,
                      double xmin,
                      double ymin,
                      double xmax,
                      double ymax,
                      double xres,
                      double yres,
                      int nrows,
                      int ncols)
for grid cutter writes out a list of double (same as getGrid() returns) to a file byteorderlsb data type, FLOAT

Parameters:
newfilename -
dfiltered -

writeGrid

public void writeGrid(java.lang.String newfilename,
                      float[] dfiltered,
                      double xmin,
                      double ymin,
                      double xmax,
                      double ymax,
                      double xres,
                      double yres,
                      int nrows,
                      int ncols)

writeHeader

public void writeHeader(java.lang.String newfilename,
                        double xmin,
                        double ymin,
                        double xmax,
                        double ymax,
                        double xres,
                        double yres,
                        int nrows,
                        int ncols,
                        double minvalue,
                        double maxvalue)

writeHeader

public void writeHeader(java.lang.String newfilename,
                        double xmin,
                        double ymin,
                        double xmax,
                        double ymax,
                        double xres,
                        double yres,
                        int nrows,
                        int ncols,
                        double minvalue,
                        double maxvalue,
                        java.lang.String datatype,
                        java.lang.String nodata)

getValues2

public float[] getValues2(double[][] points)
do get values of grid for provided points. loads whole grid file as double[] in process

Parameters:
points -
Returns:

printMinMax

public void printMinMax()

getValues

public float[] getValues(double[][] points)
Parameters:
points - input array for longitude and latitude double[number_of_points][2]
Returns:
array of .gri file values corresponding to the points provided

getValues3

public float[] getValues3(double[][] points,
                          int bufferSize)
Parameters:
points - input array for longitude and latitude double[number_of_points][2] and sorted latitude then longitude
Returns:
array of .gri file values corresponding to the points provided

mergeMissingValues

public void mergeMissingValues(Grid sourceOfMissingValues,
                               boolean hideMissing)

calculatetMinMax

public float[] calculatetMinMax()
Parameters:
points - input array for longitude and latitude double[number_of_points][2]
Returns:
calculated min and max values of a grid file as float [] where [0] is min and [1] is max.


Copyright © 2014. All Rights Reserved.