appl.util
Class RasterUtil

java.lang.Object
  extended by appl.util.RasterUtil

public class RasterUtil
extends Object

This Class provides some simple mostly independent functions related to Geo-Rasters and WritableGrids.

Author:
Dominik Appl

Constructor Summary
RasterUtil()
           
 
Method Summary
static boolean checkEqual(WritableGrid a, WritableGrid b, boolean outputToConsole)
          Runs through every grid cell and checks if the two Grids are equal (based on the RasterMetaData of the first Grid.
static void copyInto(WritableGrid src, WritableGrid target)
          Copies all values from a WritableGrid into another WritableGrid.
static RasterMetaData getRasterMetaData_from_ArcGridASCII_File(File src)
          Extracts metadata out of a ArcGridASCII File without reading the whole Grid (only the Header is parsed).
static void printGrid(WritableGrid grid)
          Prints the grid to the console (useful for testing).
static void printGrid(WritableGrid grid, int spacing, int precision, String name)
          Prints the grid to the console (useful for testing).
static void printGrid(WritableGrid grid, String name)
          Prints the grid to the console (useful for testing).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RasterUtil

public RasterUtil()
Method Detail

getRasterMetaData_from_ArcGridASCII_File

public static RasterMetaData getRasterMetaData_from_ArcGridASCII_File(File src)
Extracts metadata out of a ArcGridASCII File without reading the whole Grid (only the Header is parsed).

Parameters:
src - the ArcInfoASCII file
Returns:
the meta data

checkEqual

public static boolean checkEqual(WritableGrid a,
                                 WritableGrid b,
                                 boolean outputToConsole)
Runs through every grid cell and checks if the two Grids are equal (based on the RasterMetaData of the first Grid. If the difference is smaller than 0.0001 only conversion Warning is given. Output to console may be enabled. Writes out warning to sysout, if metaData is not equal, but continues checking

Parameters:
a - 1st grid
b - 2nd grid
outputToConsole - if true the results and some infos are written on System.out
Returns:
true, if the grids match

copyInto

public static void copyInto(WritableGrid src,
                            WritableGrid target)
Copies all values from a WritableGrid into another WritableGrid. Of course the grids must have the same dimensions.

Parameters:
src -
target -
Throws:
UnsupportedOperationException - if the dimensions of the grids does not match or one of the grids is null

printGrid

public static void printGrid(WritableGrid grid,
                             int spacing,
                             int precision,
                             String name)
Prints the grid to the console (useful for testing).

Parameters:
grid - the grid to be printed
spacing - the space to be reserved for one cell-value
precision - the decimal places to be printed out
name - the name will be shown in the heading of the output

printGrid

public static void printGrid(WritableGrid grid,
                             String name)
Prints the grid to the console (useful for testing). Spacing will be 5 and precision will be 2.

Parameters:
grid - the grid to be printed
name - the name will be shown in the heading of the output

printGrid

public static void printGrid(WritableGrid grid)
Prints the grid to the console (useful for testing). Spacing will be 5 and precision will be 2.

Parameters:
grid - the grid to be printed