Re: IDL problem with ncdf_vardef: can' exit definition mode [message #84341] |
Fri, 31 May 2013 05:44 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Therese writes:
> I have problems with creating a ncdf-file: I can't define all of my variables with ncdf_vardef().
>
> Two of my variables (longitude, latitude) have the dimensions x*y=6000*4800 and the whole data-field has x*y*k=6000*4800*10. I want to save the data-field in k=10 variables with dimensions x*y in the ncdf-file.
>
> The definition of longitude and latitude works but if I want to define the ten data-fields I get the following error message:
>
> "NCDF_CONTROL: Attempt to take the file out of define mode (ENDEF) failed. (NC_ERROR=-31)"
>
> I first tried to define them in a for-loop and I also tried to do it "by hand" one for one but it didn't help. If I remove the definitions for the data-fields the program works.
>
> I do not understand why there is a difference between "latid", "lonid" and the "datid"-vector. Is there a maximum number of definitions which can be defined?
It is hard to know what this is all about. Your data is about 1.2
GBytes. That is a pretty large file. I wonder what happens if you
defined, say three of those variables, rather than 10. Same problem?
I ran into similar strange problems when I was working with netCDF data
files years ago. I got so frustrated with it I wrote my own software to
make all of this much easier and less prone to frustrating errors. You
can find netCDF_File, my solution, on my web page:
http://www.idlcoyote.com/fileio_tips/ncdf_browser.html
But, it is not clear to me even this will solve your problem. It might
be you have to "sync" your variables to disk each time you write one:
NCDF_Control, self.fileID, /SYNC
This will make sure the variable is actually written to disk.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|