comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » The good way to use cdfid's
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
The good way to use cdfid's [message #76410] Mon, 06 June 2011 02:42 Go to previous message
Fabzou is currently offline  Fabzou
Messages: 76
Registered: November 2010
Member
Dear IDL fans,

Like many of you, i made my own NCDF object to handle NCDF files.

When the NCDF object is built, the init function opens the ncdf file
just once and stores the ncdf ID (given by NCDF_OPEN) as an attribute
(as long). In the object destroy procedure, the file is closed again,
like in the example code at the end of this message.

The reason for this choice was just to avoid many open/close, each time
a variable is asked, for example.

It worked well for a long time, BUT recently a user wanted to create and
destroy many many ncdf objects and finally got the following error after
opening exactly 16382 files:

%W_NCDF::INIT: ERROR! NCDF_INQUIRE: -2147483648 is not a valid cdfid.

where -2147483648 is then the ID returned by NCDF_OPEN on the line just
before, which didn't throw any error.

Any idea where this error could come from?

My only explanation is that I don't close the files properly, but the
OBJ_DESTROY procedure was called at the end of each loop and after
testing, the files seem also well closed...

I looked into David's code from NCDF_DATA and saw that David is opening
and closing the file every time (e.g. in NCDF_DATA::ReadVariable). What
are the reasons for this choice? This would open and close the same file
many times, and throw the error I obtain even sooner (I guess).

Thanks for your help on this !

Fabien

IDL> print, !VERSION
{ x86_64 linux unix linux 7.1.1 Aug 21 2009 64 64}

;----------------------------------------------------------- ----------
pro w_NCDF__Define

struct = {w_NCDF , $
path: '' , $ ;
cdfid: 0L , $ ; id given by NCDF_OPEN
etc...
}

end

function w_NCDF::Init, FILE = file
; code ....
self.cdfid = NCDF_OPEN(file, /NOWRITE)
; code ...
end

pro w_NCDF::Cleanup

NCDF_CLOSE, self.cdfid

END
;----------------------------------------------------------- ----------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: point inside/outside of 3D object.
Next Topic: Re: Venn Diagram in IDL?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:29:15 PDT 2025

Total time taken to generate the page: 0.00399 seconds