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

Home » Public Forums » archive » Re: NCDF_ATTPUT _FillValue problem for string arrays?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: NCDF_ATTPUT _FillValue problem for string arrays? [message #67200 is a reply to message #67134] Wed, 08 July 2009 12:12 Go to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
F�LDY Lajos wrote:
>
> On Mon, 6 Jul 2009, Paul van Delst wrote:
>
>> AHA!!!
>>
>> When I change your above test code to use the conventional fill value
>> attribute name as specified in the netCDF Interface Guide,
>> "_FillValue", I get the following:
>>
>> ncid=ncdf_create('test.nc', /clobber)
>> dim32=ncdf_dimdef(ncid, 'dim1', 32)
>> n_absorbers_dimid=ncdf_dimdef(ncid, 'dim2', 9)
>> varid = ncdf_vardef( ncid, 'absorber_units_name',
>> [dim32,n_absorbers_dimid], /char)
>> ncdf_attput, ncid, varid, '_FillValue', ' ' ; <---**** Note the
>> attribute name
>> ncdf_control, ncid, /endef
>> ncdf_close, ncid
>>
>> IDL> .run blah
>> % Compiled module: $MAIN$.
>> % NCDF_CONTROL: Attempt to take the file out of define mode (ENDEF)
>> failed. % (NC_ERROR=-45)
>> % Execution halted at: $MAIN$ 6 scratch/blah.pro
>>
>>
>> So:
>> - if I use "_fillvalue" for the attribute name, the code works fine.
>> - if I use "_FillValue" for the attribute name, the code crashes.
>>
>
> I have found the solution: _FillValue needs to be the same type as the
> variable. ' ' is an IDL string, which is converted to something,
> probably BYTE. So let's add an explicite /CHAR to ncdf_attput:
>
> ncid=ncdf_create('test.nc', /clobber)
> dim32=ncdf_dimdef(ncid, 'dim1', 32)
> n_absorbers_dimid=ncdf_dimdef(ncid, 'dim2', 9)
> varid = ncdf_vardef( ncid, 'absorber_units_name',
> [dim32,n_absorbers_dimid], /char)
> ncdf_attput, ncid, varid, '_FillValue', ' ', /CHAR
> ncdf_control, ncid, /endef
> ncdf_close, ncid
>
> It works now! :-)

Yes, it does for me also.

You, sir, are a star!

Thanks,

paulv
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Are user-defined private methods possible?
Next Topic: IDL 7.1 dialog_pickfile segmentation fault

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

Current Time: Fri Oct 10 10:10:15 PDT 2025

Total time taken to generate the page: 1.67719 seconds