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-coption except that the values of coordinate variables are not included. (At most one of-cor-hoptions may be present.) so pick one, bestie, you can't have both π-vvar1,...,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-cor-hoptions, is to include data values for all variables in the output. choose your fighters β¨-blang β 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 eachrowof data, to help identify data values for multidimensional variables. If lang begins withCorc, then C language conventions will be used (zero-based indices, last dimension varying fastest). If lang begins withForf, 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 π₯-flang β 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 withCorc, then C language conventions will be used (zero-based indices, last dimension varying fastest). If lang begins withForf, 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 π-llen β Changes the default maximum line length (80) used in formatting lists of non-character data values. eighty was just a suggestion apparently π-nname β CDL requires a name for a netCDF data set, for use byncmpigen -bin generating a default netCDF file name. By default,ncmpidumpconstructs this name from the last component of the pathname of the input netCDF file by stripping off any extension it has. Use the-noption to specify a different name. Although the output file name used byncmpigen -bcan be specified, it may be wise to havencmpidumpchange the default name to avoid inadvertantly overwriting a valuable netCDF file when usingncmpidump, editing the resulting CDL file, and usingncmpigen -bto generate a new netCDF file from the edited CDL file. protect your files, bestie, don't get got π-pfloat_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 theC_formatattribute 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-pspecifications, floating-point and double-precision data are displayed with7and15significant 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, or64-bit data. Before netCDF version 3.6, there was only one kind of netCDF file, designated asclassic(also know as format variant 1 or CDF-1). Large file support introduced another variant of the format, designated as64-bit offset(known as format variant 2 or CDF-2). Large data support introduced another variant of the format, designated as64-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 π
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
recordorder, that is with the all the values forrecordvariables 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
- ubuntu stonking: pnetcdf-bin 1.15.0-3build1 Β· Northwestern
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms