Skip navigation
NASA Logo, National Aeronautics and Space Administration
Currently Being Moderated

Converting Files Between netCDF Versions

VERSION 2  Click to view document history
Created on: Sep 11, 2015 10:23 AM by Eric Kemp - Last Modified:  Sep 11, 2015 10:51 AM by Eric Kemp

NetCDF comes with a nccopy utility that allows you to convert files between variants of netCDF.  This can be useful for sharing NUWRF netCDF4 data with outside users that prefer netCDF3, or for compressing large legacy netCDF3 files with netCDF4/HDF5. For best results, make sure you use a version of nccopy that was compiled with netCDF4/HDF5 compression support, e.g.,


On Discover: /discover/nobackup/projects/nu-wrf/lib/SLES11.3/netcdf4/4.1.3/intel- bin/nccopy

On Pleiades: /nobackupp8/nuwrf/lib/SLES11/netcdf4/4.1.3/intel-2013.5.192/bin/nccopy


To convert to 64-bit netCDF3 (large file support):


nccopy -k 2 infile outfile


And to convert to netCDF4:


nccopy -k 3 infile output


It is also possible to remove compression from a netCDF4 file, which may make it readable to netCDF3 users:


nccopy -d 0 infile outfile


See the man page for nccopy for more information, including options for tuning netCDF4/HDF5 compression. Note that writing to netCDF3 classic format (-k 1) is not recommended due to severe size limitations.

Comments (0)
USAGov logo NASA Logo -