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

Home » Public Forums » archive » IDL problem with ncdf_vardef: can' exit definition mode
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
IDL problem with ncdf_vardef: can' exit definition mode [message #84360] Thu, 30 May 2013 08:00
Therese is currently offline  Therese
Messages: 5
Registered: May 2013
Junior Member
Hello,

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?

I'm using idl 6.4.

Please help! Thank you!

Therese Keck


=============
My example-code:


id = NCDF_CREATE(file,/CLOBBER)
NCDF_CONTROL,id,/FILL

xid = NCDF_DIMDEF(id,"xid",x)
yid = NCDF_DIMDEF(id,"yid",y)

latid = NCDF_VARDEF(id,"latitude",[xid,yid],/FLOAT)
lonid = NCDF_VARDEF(id,"longitude",[xid,yid],/FLOAT)

datid = lonarr(size(label,/n_elements))
for d=0,1 do $
datid[d] = NCDF_VARDEF(id,label[d],[xid,yid],/SHORT)

NCDF_CONTROL,id,/ENDEF ; the program stops here

NCDF_VARPUT,id,lonid,lon
NCDF_VARPUT,id,latid,lat
for d=0,size(label,/n_elements)-1 do $
NCDF_VARPUT,id,dat[d],data[*,*,d]

NCDF_CLOSE,id

===========


note:

label is a string-array for the names of the variables of the data-field: Albedo_WSA_Band1 Albedo_WSA_Band2 Albedo_WSA_Band3 Albedo_WSA_Band4 Albedo_WSA_Band5 Albedo_WSA_Band6 Albedo_WSA_Band7 Albedo_WSA_vis Albedo_WSA_nir Albedo_WSA_shortwave
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Widget_Base KBRD_Focus_Events not generated via Alt-Tab
Next Topic: ENVI_GLT_DOIT and ENVI_GEOREF_FROM_GLT_DOIT

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

Current Time: Wed Oct 08 18:40:21 PDT 2025

Total time taken to generate the page: 0.00518 seconds