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

Home » Public Forums » archive » Re: Bad data in structure (NaN HowTo?)
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: Bad data in structure (NaN HowTo?) [message #22589 is a reply to message #22582] Wed, 22 November 2000 00:00 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Randall Skelton <rhskelto@atm.ox.ac.uk> writes:
> I have an array of large structures which occasionally is filled (via an
> external C program) and passed into IDL with -12345 signifying the data
> for that element is lost. I would like to convert the occurances of
> -12345 to NaN's in IDL but I am a little perplexed on how to do this.
>
> I had hoped that since this is technically an 'array' (albeit an array of
> structures) I would just be able to use the 'where' command; alas, it
> appears that structures are not allowed in the where command:
>
> B = where(atrl eq -12345, count)
> % Struct expression not allowed in this context: ATRL.

Hi Randall--

You have the 500-pound gorilla approach from Pavel. However, if your
-12345's appear in a few well defined fields in the structure, then
it's much easier and more efficent to do the following:

wh = where(atrl.field1 EQ -12345, ct)
if ct GT 0 then atrl(wh).field1 = -12345

However, if there are lots of fields then the 500-pound gorilla may be
what you need. You mentioned that integers and strings are the same
way. How can this be? There is no such thing as a NaN string or
integer.

If you do it in C, I would propose that you pass in the value of NaN
into your C procedure and then just use it there. That should be the
most portable. Then from the IDL side you would call your routine
with !VALUES.NAN

Cheers,
Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Mixing ASCII and Binary in files
Next Topic: Re: FSC_surface and xsurface under LINUX/IDL5.3

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

Current Time: Wed Oct 08 17:33:07 PDT 2025

Total time taken to generate the page: 0.00456 seconds