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

[netCDF #FVM-642365]: netcdf C++4 API - classic mode

Hi Klaus,

> I just started working with the new C++ API to NetCDF, the current
> stable release:
> netcdf-cxx4-4.2.1
> I want to write classic NetCDF files, therefore I call the NcFile
> constructor with:
> NcFile test(FILE_NAME, NcFile::replace, NcFile::classic);
> But as soon as I start to write data (via ...putVar(...)) to the file,
> an exception is raised with the text:
> -----
> NcInDefineMode: Operation not allowed in define mode
> file: ncVar.cpp  line:720
> -----
> I checked this behaviour also with the NetCDF example code
> ("pres_temp_4D_wr.cpp"), where I only added "NcFile::classic" to the
> NcFile constructor, with the same result (after also adding
> 'cout << e.what() << endl' to the example code).
> Therefore I think, for the 'classic' mode, the switch from define to
> data mode is broken.
> Could you check this behaviour?

Yes, thanks for the error report.  I was able to duplicate the problem, 
and now there's a fix on GitHub:


as well as a test in the examples/simple_xy_wr_formats.cpp that verifies 
that files of all formats can now be created.  This fix will be in the
next release, along with a lot of other fixes recently contributed by
another generous developer.  If you want to try the latest version, you
can clone the current GitHub release, run "autoreconf -if" in the top-level
directory to generate a "configure" script, and then build it in the usual 

> P.S. Merry Christmas and a Happy New Year!

Thanks, same to you and yours ...


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

Ticket Details
Ticket ID: FVM-642365
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.