Thank you Russ. I'd explored Lynton's manual as well, and was confused when
the close() function was not mentioned.
To finish up with my question, if I can not manually close a file, if I
open a NEW file with the same handle 'ncfile' (imagine the small code
snippet that I included earlier being inside a loop ), will this deallocate
the memory used by the earlier instance? I'd like to open (and close)
several files in sequence and would like to minimize memory usage.
Thank you
Taylor
On Tue, Jan 29, 2013 at 4:22 PM, Russ Rew <russ@xxxxxxxxxxxxxxxx> wrote:
> Hi Taylor,
>
> You were the first to point out what was an unfortunate error in the
> documentation for the netcdf-cxx4 release. The
>
> http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-cxx4/
>
> directory actually contained a copy of the legacy netcdf-cxx
> documentation, so not just the close method but much of the documentation
> in that directory referred to the old release. That directory is now a
> link pointing to
>
> http://www.unidata.ucar.edu/software/netcdf/docs/cxx4/
>
> where the netcdf-cxx4 documentation is maintained.
>
> However, to partly answer your question, there is no close() method in
> the netcdf-cxx4 package that corresponds to the manual close() method in
> the legacy C++ API. I'm forwarding this note to Lynton Appel, the
> developer of the netcdf-cxx4 package, in case he can suggest a way to do
> what you need.
>
> --Russ
>
> > --===============1190630261==
> > Content-Type: multipart/alternative;
> boundary=20cf30780c10aa77ce04d472aa51
> >
> > --20cf30780c10aa77ce04d472aa51
> > Content-Type: text/plain; charset=windows-1252
> > Content-Transfer-Encoding: quoted-printable
> >
> > Hello,
> > I have (I think...) a very simple question. I'm using the netCDF C++
> > libraries (version 4.2.1, --has-c++4 -> yes). I am unsure how to close
> > files, manually (before the destructor is called). According to this URL:
> >
> >
> http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-cxx4/Class-NcFile.h=
> > tml
> >
> > there should be a close(void) member function. Here is a test file
> >
> > #include <iostream>
> > #include <netcdf>
> > using namespace std;
> > using namespace netCDF;
> > using namespace netCDF::exceptions;
> >
> > int main()
> > {
> > NcFile ncfile(file.nc, NcFile::read);
> > ncfile.close();
> > return 0;
> > }
> >
> > I get the error
> >
> > error: =91class netCDF::NcFile=92 has no member named =91close=92
> >
> > Am I misusing this method? How can I clear that memory (at the end of a
> > loop) so that I can open several files in sequence with the same handle
> > 'ncfile'? Thank you!
> >
> > --=20
> > Taylor Binnington
> >
> > --20cf30780c10aa77ce04d472aa51
> > Content-Type: text/html; charset=windows-1252
> > Content-Transfer-Encoding: quoted-printable
> >
> > <div dir=3D"ltr"><div style>Hello,</div><div style>I have (I think...) a
> ve=
> > ry simple question. I'm using the netCDF C++ libraries (version
> 4.2.1, =
> > --has-c++4 -> yes). I am unsure how to close files, manually (before
> the=
> > destructor is called). According to this URL:</div>
> >
> > <div><br></div><a href=3D"
> http://www.unidata.ucar.edu/software/netcdf/docs/=
> > netcdf-cxx4/Class-NcFile.html">
> http://www.unidata.ucar.edu/software/netcdf/=
> > docs/netcdf-cxx4/Class-NcFile.html</a><div><br></div><div style>there
> shoul=
> > d be a close(void) member function. Here is a test file</div>
> >
> > <div style><br></div><div style><div>#include
> <iostream></div><div>#i=
> > nclude <netcdf><br></div><div>using namespace
> std;<br></div><div>usin=
> > g namespace netCDF;<br></div><div>using namespace
> netCDF::exceptions;</div>
> >
> > <div><br></div></div><div style>int main()=A0</div><div
> style>{</div><div s=
> > tyle>NcFile ncfile(<a href=3D"http://file.nc">file.nc</a>,
> NcFile::read);</=
> > div><div style>ncfile.close();</div><div style>return 0;</div><div
> style>}<=
> > /div>
> >
> > <div style><br></div><div style>I get the
> error<br></div><div><br></div><di=
> > v>error: =91class netCDF::NcFile=92 has no member named
> =91close=92</div><d=
> > iv><br></div><div>Am I misusing this method? How can I clear that memory
> (a=
> > t the end of a loop) so that I can open several files in sequence with
> the =
> > same handle 'ncfile'? Thank you!<br clear=3D"all">
> >
> > <div><br></div>-- <br><div dir=3D"ltr">Taylor
> Binnington<br><div><br><div><=
> > /div></div></div>
> > </div></div>
> >
> > --20cf30780c10aa77ce04d472aa51--
> >
> >
> > --===============1190630261==
> > Content-Type: text/plain; charset="us-ascii"
> > MIME-Version: 1.0
> > Content-Transfer-Encoding: 7bit
> > Content-Disposition: inline
> >
> > _______________________________________________
> > netcdfgroup mailing list
> > netcdfgroup@xxxxxxxxxxxxxxxx
> > For list information or to unsubscribe, visit:
> http://www.unidata.ucar.edu/m
> > ailing_lists/
> > --===============1190630261==--
>
--
Taylor Binnington