Re: Do netCDF Files Have a DataType of INT? [message #84420 is a reply to message #84419] |
Sun, 02 June 2013 22:11  |
SonicKenking
Messages: 51 Registered: October 2010
|
Member |
|
|
On Monday, June 3, 2013 12:36:19 PM UTC+10, David Fanning wrote:
> Folks,
>
>
>
> I've run into a problem with a netCDF file and I need a sanity check.
>
>
>
> I define a variable attribute "colortable" with an integer value, say
>
> 33. As far as I know netCDF files don't have a datatype named "INT", so
>
> I use the datatype "SHORT" when I create the attribute:
>
>
>
> NCDF_ATTPUT, fileID, self.ID, 'colortable', 33, /SHORT
>
>
>
> Now, I want to read this attribute out of the file and copy it to
>
> another file. To learn something about this attribute I use the IDL
>
> routine NCDF_ATTINQ:
>
>
>
> attrInfo = NCDF_AttInq(fileID, GLOBAL=1, 'colortable')
>
>
>
> But, the datatype field of this attribute structure is inexplicably set
>
> to INT:
>
>
>
> IDL> Print, attrInfo.datatype
>
> INT
>
>
>
> Does that make *any* sense to anyone?
>
>
>
> 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.")
My understanding is that NCDF Short is equivalant to IDL Int. They are both 2 byte integers.
But since IDL does not have a Short type, the data type is reported by NCDF_AttInq (an IDL routine) as INT, which is the result of an implicit type conversion.
They are basically the same thing. But I do think the fact that you get INT from AttInq but have to use SHORT in VarDef is rather confusing.
|
|
|