Previous: nccopy Next: Common Data Model utilities Table of contents Frames 2012 Unidata NetCDF Workshop > NetCDF Utilities

6.7 Examples of nccopy use
Examples of common uses of nccopy
  1. 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
      
  2. 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 Show popup
  3. Convert a netCDF-4 classic model file to a netCDF-3 classic file, uncompressing any compressed variables.
     nccopy -k1 testd1s.nc test_classic.nc
  4. Download just the variable named "Total_precipitation" and relevant metadata from an OPeNDAP server dataset into a netCDF file named precip.nc.
     nccopy
      'http://thredds.ucar.edu/thredds/dodsC/fmrc/NCEP/GFS/Hawaii_160km\
      /NCEP-GFS-Hawaii_160km_best.ncd?Total_precipitation' precip.nc 
    Note: use quotes, because of '?' in input name.

 


Previous: nccopy Next: Common Data Model utilities Table of contents Frames 2012 Unidata NetCDF Workshop > NetCDF Utilities