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 -o output.nc input.cdl # specify an output file
ncgen -b input.cdl # caution, this overwites nc if it exists
ncgen -k4 -o output.nc imput.cdl # Output netCDF-4 classic model file
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