Re: NCDF_ATTCOPY and typecasting [message #49794] |
Fri, 18 August 2006 11:12  |
K. Bowman
Messages: 330 Registered: May 2000
|
Senior Member |
|
|
In article <1155921996.121510.52270@75g2000cwc.googlegroups.com>,
"alexzcervantes@gmail.com" <alexzcervantes@gmail.com> wrote:
> Hello All,
>
> I am newb to NetCDF and IDL so bear with me :)
>
> Here's my situation:
>
> I am reading in a data array of type FLOAT, and creating a new NetCDF
> file and writing the data array to the new file in type BYTE. I can do
> this fine. However, when I try to do a ncdf_attcopy on the variable
> attributes from the float array to my new byte array, it fails. I do
> know that when doing a varput, the datatype of the array and its
> attributes need to be the same.
>
> Does anyone know any way around this where I can maybe do a typecast
> from float to byte using ncdf_attcopy?
>
> Thanks in advance,
> Alex
I have not used NCDF_ATTCOPY, but I suspect the output file needs to be in
define mode when copying the attributes. Do you copy the attributes first, then
exit define mode, then write the byte array?
If you are changing the type of the attribute, you will have to read it with
NCDF_ATTGET, change the type, then put it with NCDF_ATTPUT.
Ken Bowman
|
|
|