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

Home » Public Forums » archive » compare 2-d array with vector
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: compare 2-d array with vector [message #82694 is a reply to message #81550] Tue, 08 January 2013 04:53 Go to previous message
Fabzi is currently offline  Fabzi
Messages: 305
Registered: July 2010
Senior Member
On 01/07/2013 11:30 PM, Jeremy Bailin wrote:
>
> What do you expect him to do? Our conclusion was that it's inherently
> undefined, so there's not much point in asking for consistency.
>
> -Jeremy.

You're right it's a detail but I would expect value_locate to return -1
and no warning message.

let's say I want to attribute rank -1 to missing data, 0 to data below
my first level bound and so on.

Solution 1 (throwing a warning):

data = FINDGEN(10) & data[1] = !VALUES.F_NAN
levels = [1L,3,6,9]
pnovalid = where(~ FINITE(data), n_novalid)
rank = VALUE_LOCATE(levels, data) + 1
if n_novalid ne 0 then rank[pnovalid] = -1
print, rank

Solution 2 (no warning):

data = FINDGEN(10) & data[1] = !VALUES.F_NAN
levels = [1L,3,6,9]
pvalid = where(FINITE(data), n_valid)
rank = LONARR(N_ELEMENTS(data)) - 1
rank[pvalid] = VALUE_LOCATE(levels, data[pvalid]) + 1
print, rank

I agree, they are quite similar but I would expect value_locate to be at
least consistent and maybe be clearer in the documentation. Nothing
critical, of course.
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: interpolation of two different model
Next Topic: Re: IDL Astronomy Library: Some procedures doesn't work?

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

Current Time: Fri Oct 10 00:06:31 PDT 2025

Total time taken to generate the page: 0.40281 seconds