[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #RZM-153225]: netcdf4 and C++

Hi Pascal,

> I'm looking for using netCDF4 library on my project.
> The source code may be in C++ and when i read the faq, i fell that c++
> library is not mature.
> " For C++ programs, the experimental cxx4 API may be used"
> " However, the C++ interface is less mature and less-widely used than
> the C interface"
> Is it always true and if yes, when do you think that will be stable?

There are two netCDF-C++ APIs, one fairly old ("too mature") and the
other not yet in widespread general use, although it has been used
successfully in storing experimental fusion energy research data.

The first is in the "cxx" directory of the netCDF-4.1.3 source, and
also as a separate version 4.2 package:


and documented here:


It doesn't make use of exceptions, was written before namespaces and
templates were a standard part of the language, and only supports the
netCDF-3 classic data model and classic or 64-bit offset formats.  It
is a fairly thin layer over the C API, was developed and maintained at
Unidata.  It is being frozen rather than extended to support the
enhanced data model of netCDF-4.  It is nevertheless used successfully
in several external projects, and may be adequate for accessing netCDF
data in the still widely used classic format.  For example, all of the
CMIP5 climate model data is being made available in netCDF classic
format, so would be accessible with this older C++ API.

The second is in the "cxx4" directory of the 4.1.3 source, and as a
slightly more recent 4.2 version in a separate source package:


and documented here:


It is the new C++ API, designed and implemented by Lynton Appel of the
Culham Centre for Fusion Energy (CCFE) in Oxfordshire.  It provides
more complete support for the netCDF-4 enhanced data model and
formats, but it is still being actively developed.  A new version is
expected in the next few months that provides easier ways to write
netCDF-4 compound data.  It can access netCDF-3 classic data as well,
but writing classic format data will not be supported until the next

The widely used C API is also callable from C++, and some developers 
just call netCDF C functions in their C++ applications.

I hope that clears up what's available and helps you decide among
the available alternatives.


Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu

Ticket Details
Ticket ID: RZM-153225
Department: Support netCDF
Priority: Normal
Status: Closed

NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.