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.
Hi Karishma, > I have some netcdf files which have data in them and were apparently not > properly closed. When I examine them using ncdump they report zero data > points, although the size is a few meg. > Is there a way of recovering them ? I have looked up the netcdf web page > but couldn't find anything obvious. From the NetCDF User's Guide for C, section 4.1 (Creating a NetCDF Dataset): Finally, you should explicitly close all netCDF datasets that have been opened for writing by calling nc_close. By default, access to the file system is buffered by the netCDF library. If a program terminates abnormally with netCDF datasets open for writing, your most recent modifications may be lost. This default buffering of data is disabled by setting the NC_SHARE flag when opening the dataset. But even if this flag is set, changes to attribute values or changes made in define mode are not written out until nc_sync or nc_close is called. and the NetCDF User's Guide for FORTRAN contains a similar passage. So unfortunately your unwritten data was left in the memory buffers that were never flushed by a close, and there is no way to recover them. Sorry about that ... --Russ _____________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu