Re: Can't exit DEFINE mode in netCDF File [message #68220 is a reply to message #68119] |
Wed, 07 October 2009 07:30   |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
David Fanning wrote:
> Paul van Delst writes:
>
>> F�LDY Lajos came up with a solution,
>>
>>
>>> 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! :-)
>>>
>>> regards,
>>> lajos
>> Does that help?
>
> Ah! Yes, I remember reading that and thinking it was too
> esoteric for an article on my web page. I should have known
> better. I won't make that mistake again!
>
> Where is it written, though, that the _FillValue attribute has
> to be the same data type as the variable it is an attribute of?
> And why doesn't *that* cause an error, instead of this action at
> a distance thing?
All good questions. Although I find myself in the strange position of *providing*
David-Fanning-type wisdom (to said namesake no less!) rather than being on the receiving end:
It is like it is because that's the way it is.
:o)
> I'm not sure this was worth three hours of effort, not counting the
> time it will take to write the damn article. :-(
BTW, was it the fillvalue attribute in particular, or some other one? Your example was a
little bit different from mine in that my fillvalue was a character (where I believe yours
was a numeric quantity).
> Thanks for the help.
Ultimate thanks go to Mr. Lajos (or Mr. F�ldy? Don't know the correct order)
cheers,
paulv
|
|
|