Re: User selectable lower array bound? [message #26085 is a reply to message #25981] |
Fri, 03 August 2001 16:11   |
Jeff Guerber
Messages: 41 Registered: July 2000
|
Member |
|
|
On 3 Aug 2001, Stein Vidar Hagfors Haugan wrote:
> Paul van Delst <paul.vandelst@noaa.gov> writes:
>
> [..]
>> Well, maybe WHERE could work as it does now, but for cases where the start index is not
>> zero, a function like the Fortran 90 intrinsic LBOUND() could be used.
>>
>> BTW, I never check the WHERE result either, always the COUNT value.
>
> Funny, I [almost] never use the COUNT value.. If you're writing an IF
> test, the information is there anyway..
>
> ix = where(nonzero)
> IF ix[0] ne -1 THEN ...
Stein Vidar, the point I was making about WHERE was that with definable
lower bounds, -1 could be a legitimate index into the array, but
consistently using COUNT avoids this problem. I was also speculating that
WHERE returning lbound-1 would be consistent with its current behavior,
and wouldn't break (as many) existing programs, in which the arrays have
an implicit lbound=0 (and thus lbound-1 = -1).
(Actually, I've been known to use either form, depending on how I feel
at the time. :-) I've been trying to use COUNT more, though.)
There are other problems, though. <sigh>
Jeff Guerber
Raytheon ITSS
NASA Goddard Space Flight Ctr
Oceans & Ice Branch (code 971)
|
|
|