ncmpidump(1)

πŸ’– ncmpidump(1) β€” the PnetCDF utilities glow-up πŸ’–

okay bestie, sit down, hydrate, because today we're learning about ncmpidump, one of the PnetCDF utilities, and honestly? she's iconic. this is the page for ncmpidump(1) and it's about to be your new obsession 🫢


✨ NAME ✨

ncmpidump β€” Convert netCDF files to ASCII form (CDL)

like. she dumps. she converts. she serves ASCII. periodt πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

ncmpidump [-ch] [-v var1,...] [-b lang] [-f lang] [-l len] [-n name]
       [-p f_digits[,d_digits]] file

ncmpidump -k file

two whole ways to call her, both valid, both slaying 🌸


πŸ‘‘ DESCRIPTION πŸ‘‘

so ncmpidump generates an ASCII representation of a specified netCDF file, and she sends it straight to standard output. no cap. πŸ’–

and the ASCII representation? it's in a form called CDL β€” that's "network Common Data form Language" β€” which you can view, edit, or honestly just hand over as input to ncmpigen. ncmpigen is her companion program (her ride-or-die, fr fr) and it can generate a binary netCDF file from a CDL file. so ncmpigen and ncmpidump are basically inverses of each other, transforming data representation between binary and ASCII representations. the way that they're literally built to be each other's mirror πŸ˜­πŸ’•

want the full lore on CDL and netCDF representations? go read ncmpigen. she explains it all.

ncmpidump may also be used to determine what kind of netCDF file is used β€” like, which variant of the netCDF file format β€” with the -k option. vibe check on your file's format, basically πŸ”₯

here's the tea: ncmpidump defines a default format for each type of netCDF data, but you can change it if a C_format attribute is defined for a netCDF variable. in that case, ncmpidump will use the C_format attribute to format each value. for example, if floating-point data for the netCDF variable Z is known to be accurate to only three significant digits, it would be appropriate to use the variable attribute:

Z:C_format = "%.3g"

see? chef's kiss πŸŽ€

ncmpidump may also be used as a simple browser for netCDF data files β€” displaying the dimension names and sizes; variable names, types, and shapes; attribute names and values; and optionally, the values of data for all variables or selected variables in a netCDF file. a little tour of your data, no ticket required πŸ‘‘

and now the important bit, bestie, pay attention: ncmpidump uses _ to represent data values that are equal to the _FillValue attribute for a variable, intended to represent data that has not yet been written. if a variable has no _FillValue attribute, the default fill value for the variable type is used β€” but only if the variable is not of byte type. byte variables, you're on your own, sorry babe πŸ™ˆ


πŸ’… OPTIONS πŸ’…

  • -c β€” Show the values of coordinate variables (variables that are also dimensions) as well as the declarations of all dimensions, variables, and attribute values. Data values of non-coordinate variables are not included in the output. this is the most suitable option to use for a brief look at the structure and contents of a netCDF file. like a lil peek through the window, so cute 🌸
  • -h β€” Show only the header information in the output, that is the declarations of dimensions, variables, and attributes, but no data values for any variables. the output is identical to using the -c option except that the values of coordinate variables are not included. (At most one of -c or -h options may be present.) so pick one, bestie, you can't have both πŸ’€
  • -v var1,...,varn β€” The output will include data values for the specified variables, in addition to the declarations of all dimensions, variables, and attributes. One or more variables must be specified by name in the comma-delimited list following this option. The list must be a single argument to the command, hence cannot contain blanks or other white space characters. The named variables must be valid netCDF variables in the input-file. The default, without this option and in the absence of the -c or -h options, is to include data values for all variables in the output. choose your fighters ✨
  • -b lang β€” A brief annotation in the form of a CDL comment (text beginning with the characters //) will be included in the data section of the output for each row of data, to help identify data values for multidimensional variables. If lang begins with C or c, then C language conventions will be used (zero-based indices, last dimension varying fastest). If lang begins with F or f, then Fortran language conventions will be used (one-based indices, first dimension varying fastest). In either case, the data will be presented in the same order; only the annotations will differ. This option is useful for browsing through large volumes of multidimensional data. lowkey the bestie for big data energy πŸ”₯
  • -f lang β€” Full annotations in the form of trailing CDL comments (text beginning with the characters //) for every data value (except individual characters in character arrays) will be included in the data section. If lang begins with C or c, then C language conventions will be used (zero-based indices, last dimension varying fastest). If lang begins with F or f, then Fortran language conventions will be used (one-based indices, first dimension varying fastest). In either case, the data will be presented in the same order; only the annotations will differ. This option may be useful for piping data into other filters, since each data value appears on a separate line, fully identified. one value per line? she's thorough, she's committed, she's giving main character energy πŸ‘‘
  • -l len β€” Changes the default maximum line length (80) used in formatting lists of non-character data values. eighty was just a suggestion apparently 🌈
  • -n name β€” CDL requires a name for a netCDF data set, for use by ncmpigen -b in generating a default netCDF file name. By default, ncmpidump constructs this name from the last component of the pathname of the input netCDF file by stripping off any extension it has. Use the -n option to specify a different name. Although the output file name used by ncmpigen -b can be specified, it may be wise to have ncmpidump change the default name to avoid inadvertantly overwriting a valuable netCDF file when using ncmpidump, editing the resulting CDL file, and using ncmpigen -b to generate a new netCDF file from the edited CDL file. protect your files, bestie, don't get got 😭
  • -p float_digits[,double_digits] β€” Specifies default precision (number of significant digits) to use in displaying floating-point or double precision data values for attributes and variables. If specified, this value overrides the value of the C_format attribute for any variable that has such an attribute. Floating-point data will be displayed with float_digits significant digits. If double_digits is also specified, double-precision values will be displayed with that many significant digits. In the absence of any -p specifications, floating-point and double-precision data are displayed with 7 and 15 significant digits respectively. CDL files can be made smaller if less precision is required. If both floating-point and double-precision precisions are specified, the two values must appear separated by a comma (no blanks) as a single argument to the command. If you really want every last bit of precision from the netCDF file represented in the CDL file for all possible floating-point values, you will have to specify this with -p 9,17 (according to Theorem 15 of the paper listed under REFERENCES). the way that precision is a whole personality trait πŸ’…
  • -k β€” Reports the kind of netCDF file: classic, 64-bit offset, or 64-bit data. Before netCDF version 3.6, there was only one kind of netCDF file, designated as classic (also know as format variant 1 or CDF-1). Large file support introduced another variant of the format, designated as 64-bit offset (known as format variant 2 or CDF-2). Large data support introduced another variant of the format, designated as 64-bit data (known as format variant 5 or CDF-5). format lore dropped, iykyk 🧚

πŸ“ EXAMPLES πŸ“

Look at the structure of the data in the netCDF file foo.nc:

ncmpidump -c foo.nc

Produce an annotated CDL version of the structure and data in the netCDF file foo.nc, using C-style indexing for the annotations:

ncmpidump -b c foo.nc > foo.cdl

Output data for only the variables uwind and vwind from the netCDF file foo.nc, and show the floating-point data with only three significant digits of precision:

ncmpidump -v uwind,vwind -p 3 foo.nc

Produce a fully-annotated (one data value per line) listing of the data for the variable omega, using Fortran conventions for indices, and changing the netCDF dataset name in the resulting CDL file to omega:

ncmpidump -v omega -f fortran -n omega foo.nc > Z.cdl

copy these, run these, become unstoppable πŸ”₯πŸ¦‹


πŸ“š REFERENCES πŸ“š

What Every Computer Scientist should Know About Floating-Point Arithmetic, D. Goldberg, ACM Computing Surveys, Vol. 23, No. 1, March 1991, pp. 5-48.

(academic baddie behavior, we love to see it πŸ’œ)


🌈 SEE ALSO 🌈

ncmpigen(1), pnetcdf(3)

go give them a visit, they're family 🫢


πŸŽ€ DATE πŸŽ€

July 1, 2026


πŸ’€ BUGS πŸ’€

not everything is perfect, bestie, and we respect the honesty:

  • Character arrays that contain a null-byte are treated like C strings, so no characters after the null byte appear in the output. gone. deleted. not in this house πŸ™ˆ
  • Multidimensional character string arrays are not handled well, since the CDL syntax for breaking a long character string into several shorter lines is weak. the syntax is lowkey not serving 😭
  • There should be a way to specify that the data should be displayed in record order, that is with the all the values for record variables together that have the same value of the record dimension. (currently? there is not. blah.)

and that's the whole page, bestie!! πŸŽ€βœ¨ this was PnetCDF 1.15.0, printed on 2026-11-02. go forth, dump some netCDF files, and remember: every last bit of precision is worth fighting for πŸ’–πŸ’…πŸŒˆ

πŸ“¦ where this page comes from