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

Home » Public Forums » archive » Re: NCDF_ATTCOPY and typecasting
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_ATTCOPY and typecasting [message #49794] Fri, 18 August 2006 11:12 Go to previous message
K. Bowman is currently offline  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
[Message index]
 
Read Message
Read Message
Previous Topic: iplot, /xlog
Next Topic: Re: Algorithm for lat/lon searching

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

Current Time: Wed Oct 08 11:27:01 PDT 2025

Total time taken to generate the page: 0.00656 seconds