NetCDF Operators (NCO)

Useful nco commands

For full descriptions, check out the resource links.

nccopy

The nccopy compresses a netCDF file at various levels
usage: nccopy [-flag] [original nc filename] [compressed nc filename]

example: nccopy -d4 largeFile.nc compressedFile.nc

options:
-d flag represents deflation level from 1 to 9 and is required.
Level 1 (faster compression) to Level 9 (smaller compression)

ncdump

The ncdump generates an ASCII representation (common data language) of a netCDF file.

usage: ncdump [-flag] [your nc filename] > [your output file]

example: ncdump -c input.nc > output.cdl

options:

ncdump -h outputs the header info; same as -c but doesn’t include values

ncgen

The command reads the .cdl file and generates a NetCDF

usage: ncgen -o nc_file cdl_file

example: ncgen -k netCDF-4 -o output.nc input.cdl

ncks

This command merges (appends with -A) the new attributes from metadata.nc file into your existing NetCDF file.

usage: nck -A filename1.nc filename2.nc

example: ncks -A metadata.nc mydata_file.nc

resources

https://www.bic.mni.mcgill.ca/users/sean/Docs/netcdf/guide.txn_79.html

https://www.unidata.ucar.edu/software/netcdf/workshops/2011/utilities/NcgenExamples.html