Class Ncdump

java.lang.Object
ucar.nc2.write.Ncdump

@Immutable public class Ncdump 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). Moved from ucar.nc2.NCdumpW
  • Method Details

    • ncdump

      public static void ncdump(String command, Writer out, CancelTask ct) throws IOException
      ncdump that parses a command string.
      Parameters:
      command - command string
      out - send output here
      ct - 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 ct) throws IOException
      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.
      Throws:
      IOException
    • builder

      public static Ncdump.Builder builder(NetcdfFile ncfile)
    • print

      public String print()
    • printVariableData

      public static String printVariableData(Variable v, CancelTask ct) throws IOException
      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
    • printArrayPlain

      public static String printArrayPlain(Array ma)
      Print array as undifferentiated sequence of values.
      Parameters:
      ma - any Array except ArrayStructure
    • printArray

      public static String printArray(Array ma)
      Print array to returned String.
    • printArray

      public static String printArray(Array array, String name, CancelTask ct)
      Print named array to returned String.
    • printStructureData

      public static String printStructureData(StructureData sdata)
      Print StructureData to returned String.
    • 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