au.csiro.netcdf.wron
Class MdbsyNetCDF2CSVConverter

java.lang.Object
  extended by au.csiro.netcdf.wron.MdbsyNetCDF2CSVConverter

public class MdbsyNetCDF2CSVConverter
extends Object

The class is a converter control class to convert Murray Darling Basin Sustainable Yields netCDF files into CSV files. Copyright 2010, CSIRO Australia

Version:
$Revision: 84 $ $Date: 2010-08-25 15:56:46 +1000 (Wed, 25 Aug 2010) $
Author:
Robert Bridle on 07/07/2010

Field Summary
static String FILENAME_PATTERN
          The pattern for accepted file names where multiple files are accepted.
static String INPUT_DIR
          The name of the command line option used for specifying the input directory containing the netCDF files.
static String OUTPUT_DIR
          The name of the command line option used for specifying the directory to create the csv files in.
 
Constructor Summary
MdbsyNetCDF2CSVConverter()
           
 
Method Summary
 void execute(String inputDir, String outputDir)
          Performs the conversion.
static void main(String[] args)
          Command line entry point for the MdbsyNetCDF2CSVConverter class.
static String[][] readLookupFile(File file)
          Parses a csv file into an row-by-column string matrix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INPUT_DIR

public static final String INPUT_DIR
The name of the command line option used for specifying the input directory containing the netCDF files.

See Also:
Constant Field Values

OUTPUT_DIR

public static final String OUTPUT_DIR
The name of the command line option used for specifying the directory to create the csv files in.

See Also:
Constant Field Values

FILENAME_PATTERN

public static final String FILENAME_PATTERN
The pattern for accepted file names where multiple files are accepted.

See Also:
Constant Field Values
Constructor Detail

MdbsyNetCDF2CSVConverter

public MdbsyNetCDF2CSVConverter()
Method Detail

main

public static void main(String[] args)
                 throws org.apache.commons.cli.ParseException,
                        IOException,
                        InvalidRangeException
Command line entry point for the MdbsyNetCDF2CSVConverter class. Gets the input and output directory names from the command line and runs a conversion.

Parameters:
args - The command line arguments
Throws:
org.apache.commons.cli.ParseException - If an error occurs when parsing the arguments.
IOException - If the files cannot be read or written to.
InvalidRangeException - if an invalid range is attempted to be read from a netCDf variable

execute

public void execute(String inputDir,
                    String outputDir)
             throws IOException,
                    InvalidRangeException
Performs the conversion.

Parameters:
inputDir - the directory containing the Scenario A or C netCDF files.
outputDir - the directory in which the csv file will be placed.
Throws:
InvalidRangeException - thrown if an invalid range is attempted to be read from a netCDf variable.
IOException - If the files cannot be read or written to.

readLookupFile

public static String[][] readLookupFile(File file)
                                 throws IOException
Parses a csv file into an row-by-column string matrix.

Parameters:
file - a csv file.
Returns:
row-by-column string matrix of the csv file.
Throws:
IOException


Copyright © 2010. All Rights Reserved.