Re: The good way to use cdfid's [message #76647 is a reply to message #76410] |
Mon, 20 June 2011 06:42  |
Jos de Laat
Messages: 1 Registered: June 2011
|
Junior Member |
|
|
Dear Fabzou,
I think I ran into a similar problem some time ago. I had a piece of
IDL that subsequently opens and reads data from many - albeit
different - NCDF files in IDL. This always worked well, but after the
operating system of my workstation changed to Fedora 13 my IDL program
started to "stall", it simply stopped running and could only be
stopped by killing idl ("ctrl C" did not work; happens in both IDL v70
and v80). This occurs a bit randomly, but it always happens. After
some fiddling around it turned out that opening and closing any NCDF
files for many times leads to this error. This was also the case for
HDF and HDF5 files. Interestingly, the problem did not occur for IDL
running under windows (IDL v64, I think).
I contacted ITTVIS about it and they gave me the following code
example "that caused a crash on several linux flavours:" (their
words):
pro create_hand_sample, file
compile_opt idl2, logical_predicate
print, file
sample_var = dindgen( 4, 3 )
ncid = ncdf_create(file, /CLOBBER)
dimidx = ncdf_dimdef( ncid, 'x', 4 )
dimidy = ncdf_dimdef( ncid, 'y', 3 )
varid = ncdf_vardef( ncid, 'variable', /double )
ncdf_control, ncid, /ENDEF
ncdf_varput, ncid, varid, sample_var
ncdf_close, ncid
end
pro crash_ncdf
compile_opt idl2, logical_predicate
catch, theError
print, 'theError = ',theError
if theError ne 0 then begin
Catch, /cancel
print, "i = ", i
print, "ncdf_fid = ", ncdf_fid
message, !ERROR_STATE.msg
endif
file = '/tmp/sample_hand.nc'
create_hand_sample, file
long_iteration = 19000000L
for i = 0l, long_iteration do begin
ncdf_fid = ncdf_open( file, write = 0 )
ncdf_close, ncdf_fid
endfor
print, 'Successfully completed first iterations'
window, /free
wdelete
for i = 0l, long_iteration do begin
ncdf_fid = ncdf_open( file, write = 0 )
ncdf_close, ncdf_fid
endfor
print, 'Successfully completed second iterations'
end
>>> output >>>
theError = -1091
ncdf_fid = 65536
% CRASH_NCDF: NCDF_OPEN: Unable to open the file "/tmp/
sample_hand.nc". (NC_ERROR=-31)
% Execution halted at: CRASH_NCDF 24 /usr/people/laatdej/
Documents/tmp/ITT_sample_code.pro
% CREATE_HAND_SAMPLE 3 /usr/people/laatdej/
Documents/tmp/ITT_sample_code.pro
% $MAIN$
...
They promised to look into this but I haven't heard since (so mailed
them again today). I'll keep you posted if a solution is found.
|
|
|