2011 Unidata NetCDF Workshop > NetCDF Utilities
5.8 Examples of nccopy use
Examples of common uses of nccopy
- Make a copy of mslp.nc, a netCDF file of any type, to
mslp-copy.nc, a netCDF file of the same type. This checks that all the
metadata and data are consistent, and that the data can all be
accessed using the netCDF API.
nccopy mslp.nc mslp-copy.nc
-
Check compressibility of a test file,
test.nc, by using nccopy to
copy it to a file in which all variables are compressed at
level 1. Then check if adding the shuffling option improves compression.
nccopy -d1 test.nc testd1.nc # compress data in test.nc
nccopy -d1 -s test.nc testd1s.nc # shuffle and compress data in test.nc
ls -l test.nc testd1.nc testd1s.nc # check results
output from commands above
-
Convert a netCDF-4 classic model file to a netCDF-3 classic file,
uncompressing any compressed variables.
nccopy -k1 testd1s.nc test_classic.nc
-
Download just the variable named "Total_precipitation" and relevant
metadata from an OPeNDAP server dataset into a netCDF file named
precip.nc.
nccopy
'http://motherlode.ucar.edu/thredds/dodsC/fmrc/NCEP/GFS/Hawaii_160km\
/NCEP-GFS-Hawaii_160km_best.ncd?Total_precipitation' precip.nc
Note: the server created a CF-compliant netCDF file "on-the-fly" from a much larger
GRIB dataset.
2011 Unidata NetCDF Workshop > NetCDF Utilities