au.csiro.netcdf
Class NcWriteVariable

java.lang.Object
  extended by au.csiro.netcdf.NcWriteVariable
All Implemented Interfaces:
Command

public class NcWriteVariable
extends Object
implements Command

The ncwriteVar command writes a specified portion of data to a Variable object in a netCDF file. Copyright 2010, CSIRO Australia All rights reserved.

Version:
$Revision: 86 $ $Date: 2010-08-30 17:31:03 +1000 (Mon, 30 Aug 2010) $
Author:
James Dempsey on 18/03/2010

Field Summary
static String NC_WRITE_VAR_COMMAND_NAME
          The command name
 
Fields inherited from interface au.csiro.netcdf.cli.Command
MAX_32BIT_OFFSET_FILE_SIZE, PRINT_WIDTH
 
Constructor Summary
NcWriteVariable()
          Default constructor.
 
Method Summary
 org.apache.commons.cli.Options createOptions()
          Create the command line options for this command.
 void execute(File outputFile, String variableName, String fillRange, InputStream dataStream, boolean binary)
          Write data to a variable.
 void execute(String[] args)
          Run the command.
 String getCommandName()
           
 String getUsageString()
           
 String toString()
           
 String validCommand(String[] args)
          Determine if this command is valid, check its syntax.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NC_WRITE_VAR_COMMAND_NAME

public static final String NC_WRITE_VAR_COMMAND_NAME
The command name

See Also:
Constant Field Values
Constructor Detail

NcWriteVariable

public NcWriteVariable()
Default constructor.

Method Detail

execute

public void execute(String[] args)
             throws org.apache.commons.cli.ParseException,
                    IOException
Description copied from interface: Command
Run the command.

Specified by:
execute in interface Command
Parameters:
args - command line arguments.
Throws:
org.apache.commons.cli.ParseException - thrown if the command line arguments can not be parsed.
IOException - thrown if netCDF can to be written to or read from.

execute

public void execute(File outputFile,
                    String variableName,
                    String fillRange,
                    InputStream dataStream,
                    boolean binary)
             throws IOException
Write data to a variable. This is a library interface used by the command line ncwriteVar command to put data into a netCDF file. The fill range must be a comma separated list with values for each dimension of the variable. Values may be either a range n-n or a value n. e.g. 5-10, 3

Parameters:
outputFile - The netCDF file to be updated.
variableName - The variable to be updated.
fillRange - The range in which the data is to be written. Should be of the form n-n, n-n, n...
dataStream - The stream from which input data is read. Assumed to contain text with one value per line.
binary - True if the dataStream contains binary data, false if it is text
Throws:
IOException - If either the netCDF file or the input stream cannot be accessed.

getCommandName

public String getCommandName()
Specified by:
getCommandName in interface Command
Returns:
the command name for this command.

toString

public String toString()
Overrides:
toString in class Object

getUsageString

public String getUsageString()
Specified by:
getUsageString in interface Command
Returns:
the usage for this command.

createOptions

public org.apache.commons.cli.Options createOptions()
Description copied from interface: Command
Create the command line options for this command.

Specified by:
createOptions in interface Command
Returns:
the command line options for this command.

validCommand

public String validCommand(String[] args)
Description copied from interface: Command
Determine if this command is valid, check its syntax.

Specified by:
validCommand in interface Command
Parameters:
args - command line arguments.
Returns:
error if found.


Copyright © 2010. All Rights Reserved.