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

Home » Public Forums » archive » Re: idl array operations
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: idl array operations [message #47764 is a reply to message #47757] Tue, 28 February 2006 22:50 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
mmeron@cars3.uchicago.edu writes:
> In article <1141168957.087822.106350@i39g2000cwa.googlegroups.com>, "alex922@gmail.com" <alex922@gmail.com> writes:
>> Hi,
>>
>> I'm pretty new to IDL and someone told me to avoid loops.
>>
>> I have the following problem. I have an array of elements whose values
>> range from 0 to 360, and I have to subtract a number if the value is
>> greater than 180.
...
> Taking your array as arr and the nuber to be subtracted as x, the line
> would be
> arr = arr - x*(arr gt 180)

Or, if you are trying to map longitude in the 0 to 360 range to the
-180 to 180 range, I often would use this:

LONGITUDE = ((LONGITUDE + 180) MOD 360) - 180

Craig


--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: problem with dual monitor setup
Next Topic: Help in Image Analysis

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

Current Time: Sat Oct 11 08:30:56 PDT 2025

Total time taken to generate the page: 1.60163 seconds