dk.dmi.jog
Class FileHandling

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

public final class FileHandling
extends Object

An IO class reading in and writing out Grid and Station data from various sources.


Method Summary
static Grid[] readGradsGrid(String ctlfile)
          Read in a GrADS binary grid file using control file.
static Grid[] readGrib(String infile)
          Returns a Grid of a grib file.
static void writeGradsGrid(String file, Grid g)
          Writes out a GrADS binary grid file and a matching control file.
static void writeGradsGrid(String file, Grid[] g)
          Writes out a GrADS binary grid file and a matching control file.
static void writeGradsGrid(String file, Grid[] g, float MISSING)
          Writes out a GrADS binary file and a matching control file.
static void writeGradsGrid(String file, Grid g, float MISSING)
          Writes out a GrADS binary file and a matching control file.
static void writeGradsStations(String file, Station[] s)
          Writes out a GrADS binary station data file and a matching control file.
static void writeGradsStations(String file, Station[] s, float MISSING)
          Writes out a GrADS binary station data file and a matching control file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

readGradsGrid

public static Grid[] readGradsGrid(String ctlfile)
                            throws IOException
Read in a GrADS binary grid file using control file.

Parameters:
ctlfile - name of GrADS control file.
Returns:
a Grid array read in from a GrADS binary grid file.
Throws:
IOException - if an error occurs while trying to read the Grid.

readGrib

public static Grid[] readGrib(String infile)
                       throws IOException
Returns a Grid of a grib file.

Parameters:
infile - name of grib file.
Returns:
a Grid array of a grib file.
Throws:
IOException - if an error occurs while trying to read the input file.

writeGradsGrid

public static void writeGradsGrid(String file,
                                  Grid g)
                           throws IOException
Writes out a GrADS binary grid file and a matching control file.

Parameters:
file - name of GrADS data file. A control file named file.ctl is also created.
g - Grid to be written out.
Throws:
IOException - if an error occurs while trying to write out the Grid.

writeGradsGrid

public static void writeGradsGrid(String file,
                                  Grid[] g)
                           throws IOException
Writes out a GrADS binary grid file and a matching control file.

Parameters:
file - name of GrADS data file. A control file named file.ctl is also created.
g - Grid to be written out.
Throws:
IOException - if an error occurs while trying to write out the Grid.

writeGradsGrid

public static void writeGradsGrid(String file,
                                  Grid[] g,
                                  float MISSING)
                           throws IOException
Writes out a GrADS binary file and a matching control file.

Parameters:
file - name of GrADS data file. A control file named file.ctl is also created.
g - Grid to be written out.
MISSING - value of missing points.
Throws:
IOException - if an error occurs while trying to write out the Grid.

writeGradsGrid

public static void writeGradsGrid(String file,
                                  Grid g,
                                  float MISSING)
                           throws IOException
Writes out a GrADS binary file and a matching control file.

Parameters:
file - name of GrADS data file. A control file named file.ctl is also created.
g - Grid to be written out.
MISSING - value of missing points.
Throws:
IOException - if an error occurs while trying to write out the Grid.

writeGradsStations

public static void writeGradsStations(String file,
                                      Station[] s)
                               throws IOException
Writes out a GrADS binary station data file and a matching control file.

Parameters:
file - name of GrADS data file. A control file named file.ctl is also created.
s - Station array to be written out.
Throws:
IOException - if an error occurs while trying to write out the Station array.

writeGradsStations

public static void writeGradsStations(String file,
                                      Station[] s,
                                      float MISSING)
                               throws IOException
Writes out a GrADS binary station data file and a matching control file.

Parameters:
file - name of GrADS data file. A control file named file.ctl is also created.
s - Station array to be written out.
MISSING - value of missing points.
Throws:
IOException - if an error occurs while trying to write out the Station array.