NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
I should add that the code works just fine if the NcFile variable is initialized immediately. That is, replace: NcFile foo; foo = NcFile("blah.nc", NcFile::replace); with just NcFile foo("blah.nc", NcFile::replace); and it works perfectly well. On Fri, Apr 24, 2015 at 1:33 PM, Jack Stalnaker <jack.stalnaker@xxxxxxxxx> wrote: > Not too far back I noticed that I could not use an NcFile object as a > class member, which I asked about here: > http://netcdf-group.1586084.n2.nabble.com/NcFile-as-class-member-td7575625.html#a7575628 > > I never resolved that issue, but I was playing around with it again today. > I wrote a very simple bit of test code, and realized the problem is > actually much more fundamental than the one I originally asked about. > Assignment to an empty NcFile variable does not work anywhere. > > For example: > > #include <netcdf> > > int main(int argc, char *argv[]) > { > using namespace netCDF; > using namespace netCDF::exceptions; > > NcFile foo; > foo = NcFile("blah.nc", NcFile::replace); > > double baz = 1.0; > foo.putAtt("bar", ncDouble, size_t(1), &baz); > > return 0; > } > > fails at the putAtt line with the same netCDF::exceptions::NcBadId > exception I saw in the older question. The exception points to ncGroup.cpp > line 791, which is just the definition of putAtt. > > Anyone have any insight? Thanks. >
netcdfgroup
archives: