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

Home » Public Forums » archive » Re: strictarrsubs in IDL 8.1
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: strictarrsubs in IDL 8.1 [message #84299] Fri, 17 May 2013 16:17 Go to next message
kdpenner is currently offline  kdpenner
Messages: 6
Registered: May 2013
Junior Member
On Friday, May 17, 2013 3:50:39 PM UTC-7, kdpe...@gmail.com wrote:
> Hi,
>
>
>
> I have the following in my .idlstartup:
>
>
>
> compile_opt strictarrsubs
>
>
>
Grr. WHERE returns an array when the condition is met, and when it's not, it returns -1 as an integer. strictarrsubs only catches bad subscripts when passed in arrays, not integers.

How unpleasant.

> However, I can subscript arrays in 8.1 with [-1], for instance. If I remember correctly, the compile_opt statement in earlier versions of IDL meant I would get an error for a [-1] subscript. Am I misremembering, or has something changed?
>
>
>
> Thanks,
>
>
>
> Kyle
Re: strictarrsubs in IDL 8.1 [message #84529 is a reply to message #84299] Mon, 20 May 2013 11:02 Go to previous message
Chip Helms is currently offline  Chip Helms
Messages: 24
Registered: November 2012
Junior Member
I use the /NULL keyword in WHERE to avoid that issue. Although the only way to be completely safe is to check the count before using the results of WHERE.
Re: strictarrsubs in IDL 8.1 [message #84533 is a reply to message #84299] Mon, 20 May 2013 08:30 Go to previous message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On 5/17/13 7:17 PM, kdpenner@gmail.com wrote:
> On Friday, May 17, 2013 3:50:39 PM UTC-7, kdpe...@gmail.com wrote:
>> Hi,
>>
>>
>>
>> I have the following in my .idlstartup:
>>
>>
>>
>> compile_opt strictarrsubs
>>
>>
>>
> Grr. WHERE returns an array when the condition is met, and when it's not, it returns -1 as an integer. strictarrsubs only catches bad subscripts when passed in arrays, not integers.
>
> How unpleasant.
>
>> However, I can subscript arrays in 8.1 with [-1], for instance. If I remember correctly, the compile_opt statement in earlier versions of IDL meant I would get an error for a [-1] subscript. Am I misremembering, or has something changed?
>>
>>
>>
>> Thanks,
>>
>>
>>
>> Kyle
>

That's because for-reasons-that-still-baffle-me, subscripting with a
scalar negative index has a new legitimate meaning in IDL8 (counting
from the end instead).

-Jeremy.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: IDL8 plot
Next Topic: overlap of two polygons

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

Current Time: Wed Oct 08 15:12:36 PDT 2025

Total time taken to generate the page: 0.00602 seconds