Class NcdumpArray


  • @Immutable
    public class NcdumpArray
    extends Object
    Utility to implement 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). Version that works with ucar.array.Array.
    • Method Detail

      • ncdump

        public static void ncdump​(String command,
                                  Writer out,
                                  CancelTask cancel)
                           throws IOException
        ncdump that parses a command string.
        Parameters:
        command - command string
        out - send output here
        cancel - allow task to be cancelled; may be null.
        Throws:
        IOException - on write error
      • ncdump

        public static void ncdump​(NetcdfFile nc,
                                  String command,
                                  Writer out,
                                  CancelTask cancel)
                           throws IOException
        ncdump, parsing command string, file already open.
        Parameters:
        nc - apply command to this file
        command - : command string
        out - send output here
        cancel - allow task to be cancelled; may be null.
        Throws:
        IOException
      • print

        public String print()
      • printVariableData

        public static String printVariableData​(Variable v,
                                               CancelTask cancel)
                                        throws IOException
        Print all the data of the given Variable.
        Parameters:
        v - variable to print
        cancel - allow task to be cancelled; may be null.
        Returns:
        String result
        Throws:
        IOException - on write error
      • printArrayPlain

        public static String printArrayPlain​(Array<?> array)
        Print array as undifferentiated sequence of values.
        Parameters:
        array - any Array except StructureDataArray
      • printArray

        public static String printArray​(Array<?> ma)
        Print array to returned String.
      • printArray

        public static String printArray​(Array<?> array,
                                        String name,
                                        CancelTask cancel)
        Print named array to returned String.
      • printSequenceData

        public static String printSequenceData​(Sequence seq,
                                               CancelTask cancel)
        Print all the StructureData from a Sequence.
      • printStructureData

        public static String printStructureData​(StructureData sdata)
        Print StructureData.
      • main

        public static void main​(String[] args)
        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