NetCDF4 Files at PSL

We have decided at PSL to switch our file format from netCDF3 to netCDF4-classic wherever possible. New datasets will be created in netCDF4 and we will be converting older files to netCDF4-classic. NetCDF4 has the advantage that files may read faster (much faster sometimes) in some applications (e.g. NCL). It also has the advantage that we will not need to pack the data using a scale and offset and users will not need to unpack data. NetCDF4 provides compression that is comparable to the use of short integers (~50% for most files). The compression they use is lossless, also an advantage.

Most applications should be able to read netCDF4-classic if they are compiled against the latest NetCDF library, and that library was built with NetCDF4 support enabled, requiring HDF5 libraries. A list of applications that can read netCDF4 if compiled with HDF5 libraries is below. Unidata's NetCDF website has explicit instructions for building NetCDF correctly. You may need to change your code if you explicitly unpack the data. NCL's short2flt routine will not need to be changed if you use that. In some cases, users have had issues if their application wasn't compiled with HDF libraries correctly. We do NOT support any netCDF application ourselves. Please contact the individual application support directly and/or read Unidata's netCDF webpage. If you are using the R package, they have specific instructions on their web site for dealing with NetCDF4 files: ncdf4.pdf Page 19 of the PDF document has a working example for R.

Unidata has a program called nccopy that will convert NetCDF 4 files to NetCDF 3. If you are not able to get an application to work, you may find that useful though it will increase the size of the file. In the case of most of the files in our archive, the NC3 size will be double the NC4 size. Also, OPeNDAP might be useful, as it renders the file as if it were NetCDF3 Classic. See our OPeNDAP web page for details. You may contact us if all the above doesn't help.

To determine a file type:
ncdump -k
To convert a netCDF4 file to netCDF3, try one of these, depending on what you want your output to be:
nccopy -k classic
nccopy -k 64-bit-offset
You can also use OPeNDAP and nccopy to download and convert at the same time.
nccopy -k 1 /thredds/dodsC/Datasets/ncep.reanalysis.dailyavgs/pressure/
This will result in a larger netCDF3 file (about twice as big).

CDO (climate data operators) will also convert:
cdo -f nc

Applications/languages that can read netCDF4 (netCDF software/apps)

  • NCL
  • CDO
  • NCO
  • IDL
  • IDV
  • Matlab (version R2010b and newer)
  • GrADS
  • CDAT
  • Ferret
  • R
  • ncBrowse
  • Panoply
  • C
  • Fortran
  • Java
  • Python
  • Perl

Applications/languages that can't read netCDF4

  • Excel
  • Mathematica

Datasets that have been transitioned to netCDF4

20th Century Reanalysis V2Aug 14,2014
NCEP/NCAR Reanalysis IOct 20,2014
NOAA High Resolution SSTAug 18,2014
CMAP PrecipitationJul 29,2014
NOAA ERSSTAug 21,2014
U of Delaware precipitation and temperatureJul 29,2014