Official GitHub repository for netCDF-C++ libraries and utilities.
C++ CMake C M4 Other
Clone or download
WardF Merge pull request #56 from Unidata/gh55.wif
Allow for more flexible opening of netCDF files.
Latest commit f37a909 Jun 19, 2018
Failed to load latest commit information.
cxx4 Corrected an issue for automake-based builds. Jun 19, 2018
docs Corrected an issue with CMakeLists.txt Nov 11, 2016
examples Updated cleanfiles. May 10, 2016
m4 Added m4 directory; this will supress a warning otherwise thrown by '… Aug 7, 2013
.gitignore Updated the .gitignore. Apr 24, 2015
.travis.yml Updated travis.yml to respect .wif and .dmh branches as not requiring… Mar 7, 2018
CMakeInstallation.cmake Always use CMAKE_CURRENT_{SOURCE|BINARY}_DIR Apr 25, 2016
CMakeLists.txt Updated CMakeLists.txt with new cdash location. Mar 7, 2018
COPYRIGHT new Aug 17, 2011 Added coveragte tests, other ctest-related configuration. Apr 15, 2015
CTestCustom.cmake Initisl fleshing out of cmake file in cxx4 directory. Apr 13, 2015 More work wiring in doxygen with autotools. Jan 25, 2016 Use https for URL in README Dec 26, 2017 Updated release notes. Jun 19, 2018 Adding install/uninstall framework similar to that found in netcdf-c. Jan 25, 2016 Use nc-config in configure to check capabilities Aug 18, 2016 Removed some unrelated stuff in libnetcdf-cxx.settings template. Apr 24, 2015 Addressed syntax warning issue. Jul 5, 2016 Use nc-config in configure to check capabilities Aug 18, 2016 Fix multilib and underlinking problems in pkg-config files Jan 1, 2014

Build Status


Official GitHub repository for netCDF-4 C++ library.

Note: The latest release of the historic C++ libraries, netCDF-4.2, may be downloaded from the following page:


Lynton Appel, of the Culham Centre for Fusion Energy (CCFE) in Oxfordshire, has developed and contributed a Oxfordshire, has developed and contributed a netCDF-4 C++ library that depends on an installed netCDF-4 C library. The netCDF-4 C++ API was developed for use in managing fusion research data from CCFE's innovative MAST (Mega Amp Spherical Tokamak) experiment.

Appel's C++ implementation is a complete read/write interface for netCDF-4, but can also be used as an alternative to the older netCDF-3 C++ interface, to write classic-format netCDF-3 files as well as netCDF-4 classic model files. The new API is implemented as a layer over the netCDF-4 C interface, which means bug fixes and performance enhancements in the C interface will be immediately available to C++ developers as well. It replaces a previous partial netCDF-4 C++ interface developed by Shanna Forbes.

The new API makes use of standard C++ features such as namespaces, exceptions, and templates, none of which were included in the first netCDF-3 C++ API developed in the mid-90's. The earlier netCDF-3 C++ API is still supported and available in the source distribution, but developers who are thinking of eventually upgrading to use of the enhanced data model should consider using Lynton's new API.

We're grateful for Appel's development and CCFE's contribution of the new open-source code for the netCDF-4 C++ API, and hope C++ developers in the netCDF community will find it useful! Feedback is appreciated, and should be directed to Lynton Appel.


Installing the C++ interface requires the additional flag --enable-netcdf-4 to be used during the configure stage of the installation, for example enter

  ./configure --enable-cxx-4 [plus other options]

Note that the "configure" script must be generated using

  autoreconf -if

To build the C++ interface guide, change to the cxx4 directory of the distribution and enter


By default, HTML documentation will be installed in cxx4/doc/html; other options may be specified according to the settings contained in the file "Doxyfile" (details of alternative settings are documented at doxygen). Note that as a prerequisite for generating the documentation, the system will need to have doxygen and Graphviz installed.

Examples of usage

Examples codes can be found by selecting the "Examples" tab.