uk.ac.leeds.ccg.andyt.grids.exchange
Class IO

java.lang.Object
  extended by uk.ac.leeds.ccg.andyt.grids.exchange.IO

public class IO
extends java.lang.Object

This class holds general utility methods for io.


Constructor Summary
IO()
          Creates a new instance of io
 
Method Summary
static void gamOutputToGrid(java.io.File gamOutputFile, AbstractGrid2DSquareCell grid, double weight)
           
static void generateGamInput(java.io.File gamInputFile, AbstractGrid2DSquareCell countGrid, AbstractGrid2DSquareCell parGrid)
          Creates gamInputFile from the countFile and parFile.
static double[] getBasicGridInfo(java.io.File gridFile)
          Returns a double[] of grid information where; [0] = (double) ncols; [1] = (double) nrows; [2] = xllcorner; [3] = yllcorner; [4] = cellsize; [5] = noDataValue if it exists or Double.NEGATIVE_INFINITY otherwise
static java.lang.String getDefaultDataDirectory()
          Returns a default data directory
static void gridArray2CSV(AbstractGrid2DSquareCell[] gridArray, java.lang.String header, java.io.File csvFile)
          Generates CSV file from gridArray
static boolean isImageWriterAvailable(java.lang.String writerType)
          Returns true if writerType is available
static void xyFileToGAM(java.io.File parFile, java.io.File countFile, java.io.File gamFile, double radius, double xmin, double ymin, double xmax, double ymax)
           
static void xyFileToGrid(java.io.File xyFile, Grid2DSquareCellDouble grid, int linesInHeader, boolean handleOutOfMemoryError)
          This will modify grid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IO

public IO()
Creates a new instance of io

Method Detail

getDefaultDataDirectory

public static java.lang.String getDefaultDataDirectory()
Returns a default data directory


getBasicGridInfo

public static double[] getBasicGridInfo(java.io.File gridFile)
Returns a double[] of grid information where; [0] = (double) ncols; [1] = (double) nrows; [2] = xllcorner; [3] = yllcorner; [4] = cellsize; [5] = noDataValue if it exists or Double.NEGATIVE_INFINITY otherwise

Parameters:
gridFile - The File of the grid.

isImageWriterAvailable

public static boolean isImageWriterAvailable(java.lang.String writerType)
Returns true if writerType is available

Parameters:
writerType - - usually a well known text String for an image type

generateGamInput

public static void generateGamInput(java.io.File gamInputFile,
                                    AbstractGrid2DSquareCell countGrid,
                                    AbstractGrid2DSquareCell parGrid)
Creates gamInputFile from the countFile and parFile. The basic format is: id x y count par


xyFileToGrid

public static void xyFileToGrid(java.io.File xyFile,
                                Grid2DSquareCellDouble grid,
                                int linesInHeader,
                                boolean handleOutOfMemoryError)
This will modify grid

Parameters:
xyFile -
grid -
handleOutOfMemoryError -

gamOutputToGrid

public static void gamOutputToGrid(java.io.File gamOutputFile,
                                   AbstractGrid2DSquareCell grid,
                                   double weight)

xyFileToGAM

public static void xyFileToGAM(java.io.File parFile,
                               java.io.File countFile,
                               java.io.File gamFile,
                               double radius,
                               double xmin,
                               double ymin,
                               double xmax,
                               double ymax)

gridArray2CSV

public static void gridArray2CSV(AbstractGrid2DSquareCell[] gridArray,
                                 java.lang.String header,
                                 java.io.File csvFile)
Generates CSV file from gridArray