Package ucar.nc2

Class NCdumpW


  • @Deprecated
    public class NCdumpW
    extends Object
    Deprecated.
    use ucar.nc2.write.Ncdump
    Print contents of an existing netCDF file, using a Writer.

    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)

    Since:
    Nov 4, 2007
    • Constructor Detail

      • NCdumpW

        public NCdumpW()
        Deprecated.
    • Method Detail

      • print

        public static boolean print​(String command,
                                    Writer out,
                                    CancelTask ct)
                             throws IOException
        Deprecated.
        ncdump that parses a command string.
        Parameters:
        command - command string
        out - send output here
        ct - allow task to be cancelled; may be null.
        Returns:
        true if successful
        Throws:
        IOException - on write error
      • print

        public static boolean print​(NetcdfFile nc,
                                    String command,
                                    Writer out,
                                    CancelTask ct)
                             throws IOException
        Deprecated.
        use Ncdump.ncdump(NetcdfFile nc, String command, Writer out, CancelTask ct)
        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:
        IOException - on write error
      • print

        public static boolean print​(String filename,
                                    Writer out,
                                    boolean showAll,
                                    boolean showCoords,
                                    boolean ncml,
                                    boolean strict,
                                    String varNames,
                                    CancelTask ct)
                             throws 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:
        IOException - on write error
      • print

        public static boolean print​(NetcdfFile nc,
                                    Writer out,
                                    boolean showAll,
                                    boolean showCoords,
                                    boolean ncml,
                                    boolean strict,
                                    String varNames,
                                    CancelTask ct)
                             throws 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:
        IOException - on write error
      • print

        public static boolean print​(NetcdfFile nc,
                                    Writer out,
                                    NCdumpW.WantValues showValues,
                                    boolean ncml,
                                    boolean strict,
                                    String varNames,
                                    CancelTask ct)
                             throws IOException
        Deprecated.
        ncdump-like print of netcdf file.
        Parameters:
        nc - already opened NetcdfFile
        out - print to this stream
        showValues - do you want the variable values printed?
        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:
        IOException - on write error
      • printVariableData

        public static String printVariableData​(Variable v,
                                               CancelTask ct)
                                        throws 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:
        IOException - on write error
      • printVariableDataSection

        public static String printVariableDataSection​(Variable v,
                                                      String sectionSpec,
                                                      CancelTask ct)
                                               throws 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:
        IOException - on write error
        InvalidRangeException - is specified section doesnt match variable shape
      • toString

        @Deprecated
        public static String toString​(Array array,
                                      String name,
                                      CancelTask ct)
        Deprecated.
        use Ncdump.printArray(Array array, String name, CancelTask ct)
        Print named array to returned String.
      • printStructureData

        public static void printStructureData​(PrintWriter out,
                                              StructureData sdata)
        Deprecated.
        Print contents of a StructureData.
        Parameters:
        out - send output here.
        sdata - StructureData to print.
      • toString

        public static String toString​(StructureData sdata)
        Deprecated.
        Print StructureData to returned String.
      • printArrayPlain

        public static void printArrayPlain​(Array ma,
                                           PrintWriter out)
        Deprecated.
        Print array as undifferentiated sequence of values.
        Parameters:
        ma - any Array except ArrayStructure
        out - print to here
      • printArray

        public static void printArray​(Array array,
                                      PrintWriter pw)
        Deprecated.
        Print array to named PrintWriter
      • toString

        public static String toString​(Array ma)
        Deprecated.
        Print array to returned String.
      • writeNcML

        @Deprecated
        public static void writeNcML​(NetcdfFile ncfile,
                                     Writer writer,
                                     NCdumpW.WantValues showValues,
                                     String url)
                              throws IOException
        Deprecated.
        will move in ver 6
        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
        writer - write to this Writer. Must be using UTF-8 encoding (where applicable)
        showValues - do you want the variable values printed?
        url - use this for the url attribute; if null use getLocation(). // ??
        Throws:
        IOException - on write error
      • main

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

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

        where:

        • filename : path of any CDM readable file
        • cdl or ncml: output format is CDL or NcML
        • -vall : dump all variable data
        • -c : dump coordinate variable data
        • -v varName1;varName2; : dump specified variable(s)
        • -v varName(0:1,:,12) : dump specified variable section
        Default is to dump the header info only.
        Parameters:
        args - arguments