[netcdfgroup] Closing files opened only for reading (C interface - nc_close()?)

Hi all,
   I'm looking for some help with a netcdf-powered application, and it
seemed like this was the right mailing list to ask. Apologies in advance if
this is an inappropriate place to ask this question.


  The problem I'm having is with the file open/close model in netcdf 4
(4.1.3). I'm using LabWindows/CVI 9.0 to build a program and using netCDF
for all my data reading/writing needs. The problem is that in a few cases it
seems like I'm leaving these files open causing them to lock, but given that
you can't call nc_close() on a file that's been opened for reading only
(totally crashes my application if I do that - no error is returned), I
don't really understand how to unlock the files. Right now I'm dealing with
files where you build some set of variables and metadata in a UI editor,
then save them to file. If you load them from file first, when you try to
save them, it returns the error "Could not add HDF5 metadata", but that only
happens when the file is locked due to being in use, because there's a call
to DeleteFilename(filename) that occurs before the nc_create call.

   Given that it was only ever opened with nc_open(filename, NC_NOWRITE,
&ncid), I don't understand why it could possibly be locked. So my overall
question is, "how do I fix this?", but more specifically, I guess I'm
looking for a way to either force close netcdf files that were opened by
some unknown function or force close all open netcdf files.

           Best,
               Paul Ganssle
  • 2011 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: