This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
>To: address@hidden >From: "Martin Kolleck" <address@hidden> >Subject: netCDF >Organization: Deutsches Zentrum fuer Luft- und Raumfahrt >Keywords: 200307240932.h6O9W5Ld018295 netCDF Hi Martin, > for the application I am writing I'd like to know a little mor in depth, how > the netCDF library works (especially for C). The main point I am considering > is wether it is a good idea to read all the structuring information about the > file (like information about dimensions and variables) into memory for faster > access or if that is already done by the netCDF library. So that inquiries of > the form nc_inq_ are obtaining their information from memory or from disk. I > assume that the nc_get_var(...) functions are working with disk-access, but I > am not sure wether it is the same with the nc_ing_. > I would be glad if you could give some detailed information about this matter. The C library reads all the metadata into memory data structures when the file is first opened, and also on any subsequent calls to nc_sync(). So there are no disk accesses involved in any of the nc_inq_ calls. I found this information in the User's Guide, although it was hard to find (in "4.3 Reading a netCDF Dataset with Unknown Names") and not where I would have expected it (in "9 NetCDF File Structure and Performance"): All the inquire functions are inexpensive to use and require no I/O, since the information they provide is stored in memory when a netCDF dataset is first opened. Maybe some reorganization of the documentation is in order, the next time we revise it. --Russ _____________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://my.unidata.ucar.edu