Code errors when opening and writing netcdf file HDF error (NC_EHDFERR)
7 次查看(过去 30 天)
显示 更早的评论
Hello. I'm working on a simulation which will run for some time, maybe an hour, then error out with the following message when saving a variable to a .nc netcdf file.
Error using netcdflib
The NetCDF library encountered an error during execution of 'open' function - 'HDF error (NC_EHDFERR)'.
Error in netcdf.open (line 67)
[varargout{:}] = netcdflib ( 'open', filename, varargin{1} );
Error in internal.matlab.imagesci.nc/openToAppend (line 1238)
this.ncRootid = netcdf.open(this.Filename,'WRITE');
Error in internal.matlab.imagesci.nc (line 123)
this.openToAppend();
Error in ncwrite (line 83)
ncObj = internal.matlab.imagesci.nc(ncFile,'a',formatStr);
Error in field_cls/record_energy (line 687)
ncwrite(sfile,'EchiI',imag(this.E.Echi),[1,1,irun]);
The variable isn't too huge, just a complex vector length 100, broken into the real and imaginary part (here I am saving EchiI, the imaginary part). I write about 14 of these vectors in each time step, then move onto the next one and proceed to do this for a few hundred time steps. This error seems to only happen when I run the program for a very long time and take up a large amount of memory for other variables. There is no function which is deleting these files or any reason for them to not be able to be reopened. The file name is stored within the function record_energy(). I'm wondering how it might be possible to avoid this error. The program will run fine for a while, then produce this error out of nowhere.
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 NetCDF 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!