ucar.nc2
Class NCdump

java.lang.Object
  extended by ucar.nc2.NCdump

Deprecated. use NCdumpW, to handle Unicode correctly

public class NCdump
extends java.lang.Object

Print contents of an existing netCDF file of unknown structure, like ncdump. A difference with ncdump is that the nesting of multidimensional array data is represented by nested brackets, so the output is not legal CDL that can be used as input for ncgen. Also, the default is header only (-h)

Author:
Russ Rew, John Caron

Constructor Summary
NCdump()
          Deprecated.  
 
Method Summary
static java.lang.String encodeString(java.lang.String s)
          Deprecated. Replace special characters '\t', '\n', '\f', '\r'.
static void main(java.lang.String[] args)
          Deprecated. Main program.
static java.lang.String makeSectionString(VariableIF v, java.util.List<Range> ranges)
          Deprecated. Make section specification String from a range list for a Variable.
static boolean print(NetcdfFile nc, java.io.OutputStream out, boolean showAll, boolean showCoords, boolean ncml, boolean strict, java.lang.String varNames, CancelTask ct)
          Deprecated. ncdump-like print of netcdf file.
static boolean print(NetcdfFile nc, java.lang.String command, java.io.OutputStream out, CancelTask ct)
          Deprecated. ncdump, parsing command string, file already open.
static boolean print(java.lang.String command, java.io.OutputStream out)
          Deprecated. NCdump that parses a command string, using default options.
static boolean print(java.lang.String fileName, java.io.OutputStream out, boolean showAll, boolean showCoords, boolean ncml, boolean strict, java.lang.String varNames, CancelTask ct)
          Deprecated. ncdump-like print of netcdf file.
static boolean print(java.lang.String command, java.io.OutputStream out, CancelTask ct)
          Deprecated. ncdump that parses a command string.
static void printArray(Array array, java.lang.String name, java.io.PrintStream out, CancelTask ct)
          Deprecated. Print the data array.
static boolean printHeader(java.lang.String fileName, java.io.OutputStream out)
          Deprecated. Print netcdf "header only" in CDL.
static boolean printNcML(java.lang.String fileName, java.io.OutputStream out)
          Deprecated. print NcML representation of this netcdf file, showing coordinate variable data.
static void printStructureData(java.io.PrintStream out, StructureData sdata)
          Deprecated. Print contents of a StructureData.
static java.lang.String printVariableData(VariableIF v, CancelTask ct)
          Deprecated. Print all the data of the given Variable.
static java.lang.String printVariableDataSection(VariableIF v, java.lang.String sectionSpec, CancelTask ct)
          Deprecated. Print a section of the data of the given Variable.
static void writeNcML(NetcdfFile ncfile, java.io.OutputStream os, boolean showCoords, java.lang.String uri)
          Deprecated. Write the NcML representation for a file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NCdump

public NCdump()
Deprecated. 
Method Detail

printHeader

public static boolean printHeader(java.lang.String fileName,
                                  java.io.OutputStream out)
                           throws java.io.IOException
Deprecated. 
Print netcdf "header only" in CDL.

Parameters:
fileName - open this file
out - print to this stream
Returns:
true if successful
Throws:
java.io.IOException - on write error

printNcML

public static boolean printNcML(java.lang.String fileName,
                                java.io.OutputStream out)
                         throws java.io.IOException
Deprecated. 
print NcML representation of this netcdf file, showing coordinate variable data.

Parameters:
fileName - open this file
out - print to this stream
Returns:
true if successful
Throws:
java.io.IOException - on write error

print

public static boolean print(java.lang.String command,
                            java.io.OutputStream out)
                     throws java.io.IOException
Deprecated. 
NCdump that parses a command string, using default options. Usage:
NCdump filename [-ncml] [-c | -vall] [-v varName;...]

Parameters:
command - command string
out - send output here
Returns:
true if successful
Throws:
java.io.IOException - on write error

print

public static boolean print(java.lang.String command,
                            java.io.OutputStream out,
                            CancelTask ct)
                     throws java.io.IOException
Deprecated. 
ncdump that parses a command string. Usage:
NCdump filename [-ncml] [-c | -vall] [-v varName;...]

Parameters:
command - command string
out - send output here
ct - allow task to be cancelled; may be null.
Returns:
true if successful
Throws:
java.io.IOException - on write error

print

public static boolean print(NetcdfFile nc,
                            java.lang.String command,
                            java.io.OutputStream out,
                            CancelTask ct)
                     throws java.io.IOException
Deprecated. 
ncdump, parsing command string, file already open.

Parameters:
nc - apply command to this file
command - : command string
out - send output here
ct - allow task to be cancelled; may be null.
Returns:
true if successful
Throws:
java.io.IOException - on write error

print

public static boolean print(java.lang.String fileName,
                            java.io.OutputStream out,
                            boolean showAll,
                            boolean showCoords,
                            boolean ncml,
                            boolean strict,
                            java.lang.String varNames,
                            CancelTask ct)
                     throws java.io.IOException
Deprecated. 
ncdump-like print of netcdf file.

Parameters:
fileName - NetcdfFile to open
out - print to this stream
showAll - dump all variable data
showCoords - only print header and coordinate variables
ncml - print NcML representation (other arguments are ignored)
strict - print strict CDL representation
varNames - semicolon delimited list of variables whose data should be printed
ct - allow task to be cancelled; may be null.
Returns:
true if successful
Throws:
java.io.IOException - on write error

print

public static boolean print(NetcdfFile nc,
                            java.io.OutputStream out,
                            boolean showAll,
                            boolean showCoords,
                            boolean ncml,
                            boolean strict,
                            java.lang.String varNames,
                            CancelTask ct)
                     throws java.io.IOException
Deprecated. 
ncdump-like print of netcdf file.

Parameters:
nc - already opened NetcdfFile
out - print to this stream
showAll - dump all variable data
showCoords - only print header and coordinate variables
ncml - print NcML representation (other arguments are ignored)
strict - print strict CDL representation
varNames - semicolon delimited list of variables whose data should be printed. May have Fortran90 like selector: eg varName(1:2,*,2)
ct - allow task to be cancelled; may be null.
Returns:
true if successful
Throws:
java.io.IOException - on write error

makeSectionString

public static java.lang.String makeSectionString(VariableIF v,
                                                 java.util.List<Range> ranges)
                                          throws InvalidRangeException
Deprecated. 
Make section specification String from a range list for a Variable.

Parameters:
v - for this Variable.
ranges - list of Range. Must includes all parent structures. The list be null, meaning use all. Individual ranges may be null, meaning all for that dimension.
Returns:
section specification String.
Throws:
InvalidRangeException - is specified section doesnt match variable shape

printVariableData

public static java.lang.String printVariableData(VariableIF v,
                                                 CancelTask ct)
                                          throws java.io.IOException
Deprecated. 
Print all the data of the given Variable.

Parameters:
v - variable to print
ct - allow task to be cancelled; may be null.
Returns:
String result
Throws:
java.io.IOException - on write error

printVariableDataSection

public static java.lang.String printVariableDataSection(VariableIF v,
                                                        java.lang.String sectionSpec,
                                                        CancelTask ct)
                                                 throws java.io.IOException,
                                                        InvalidRangeException
Deprecated. 
Print a section of the data of the given Variable.

Parameters:
v - variable to print
sectionSpec - string specification
ct - allow task to be cancelled; may be null.
Returns:
String result formatted data ouptut
Throws:
java.io.IOException - on write error
InvalidRangeException - is specified section doesnt match variable shape

printArray

public static void printArray(Array array,
                              java.lang.String name,
                              java.io.PrintStream out,
                              CancelTask ct)
Deprecated. 
Print the data array.

Parameters:
array - data to print.
name - title the output.
out - send output here.
ct - allow task to be cancelled; may be null.

printStructureData

public static void printStructureData(java.io.PrintStream out,
                                      StructureData sdata)
Deprecated. 
Print contents of a StructureData.

Parameters:
out - send output here.
sdata - StructureData to print.

writeNcML

public static void writeNcML(NetcdfFile ncfile,
                             java.io.OutputStream os,
                             boolean showCoords,
                             java.lang.String uri)
                      throws java.io.IOException
Deprecated. 
Write the NcML representation for a file. Note that ucar.nc2.dataset.NcMLWriter has a JDOM implementation, for complete NcML. This method implements only the "core" NcML for plain ole netcdf files.

Parameters:
ncfile - write NcML for this file
os - write to this Output Stream.
showCoords - show coordinate variable values.
uri - use this for the uri attribute; if null use getLocation(). // ??
Throws:
java.io.IOException - on write error

encodeString

public static java.lang.String encodeString(java.lang.String s)
Deprecated. 
Replace special characters '\t', '\n', '\f', '\r'.

Parameters:
s - string to quote
Returns:
equivilent string replacing special chars

main

public static void main(java.lang.String[] args)
Deprecated. 
Main program.

ucar.nc2.NCdump filename [-cdl | -ncml] [-c | -vall] [-v varName1;varName2;..] [-v varName(0:1,:,12)]

where:

Default is to dump the header info only.

Parameters:
args - arguments