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

Home » Public Forums » archive » Crazy use of MAX function.
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
Crazy use of MAX function. [message #15930] Sun, 27 June 1999 00:00 Go to next message
Grady Daub is currently offline  Grady Daub
Messages: 22
Registered: June 1999
Junior Member
I have data to be plotted. I want to create YRANGE based on max/min of
the data. The problem is that the maximum is always lower than "9999",
which is used to indicate "bad" data.

Without having to replace all 9999's with, say, zero , using MAX to find
the true maximum and then putting the 9999's back where they were...

How do I find a maximum/minumum value less/greater than a certain value?

MAX(data lt 9999) doesn't work. :-(

Ugh, I just thought of a way:

MAX(data(WHERE(data LT 9999)))

Is this the only way, or, does IDL already have something that does this
task?
Re: Crazy use of MAX function. [message #16112 is a reply to message #15930] Mon, 28 June 1999 00:00 Go to previous message
Struan Gray is currently offline  Struan Gray
Messages: 178
Registered: December 1995
Senior Member
Grady Daub, gadZOOKS8371@garnet.acns.fsuMMER.edu writes:

> How do I find a maximum/minumum value less/greater than a certain value?

device, decomposed=0

Oh no, that's the other question.
The answer to this one is:

dummy = HISTOGRAM(data, max=9998, omax=omax, omin=omin, binsize=9999)

The max keyword stops HISTOGRAM from considering your 9999 values,
the large binsize avoids wasting too much time actually constructing a
histogram. If you know your minimum value you can fine-tune binsize
to ensure that there is only one bin. The numbers you want will be
returned in omax and omin.


Struan
Re: Crazy use of MAX function. [message #16125 is a reply to message #15930] Mon, 28 June 1999 00:00 Go to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
Grady Daub wrote:

> I have data to be plotted. I want to create YRANGE based on max/min of
> the data. The problem is that the maximum is always lower than "9999",
> which is used to indicate "bad" data.
>
> Without having to replace all 9999's with, say, zero , using MAX to find
> the true maximum and then putting the 9999's back where they were...
>
> How do I find a maximum/minumum value less/greater than a certain value?
>
> MAX(data lt 9999) doesn't work. :-(
>
> Ugh, I just thought of a way:
>
> MAX(data(WHERE(data LT 9999)))
>
> Is this the only way, or, does IDL already have something that does this
> task?

How about this:

PRO use_of_valid_example

data_x=FINDGEN(100)
data_x[[1,10,20]]=9999
data_y=FINDGEN(100)
data_y[[3,13,21]]=9999
valid_x=WHERE(data_x NE 9999)
valid_y=WHERE(data_y NE 9999)


valid=MAKE_ARRAY(N_ELEMENTS(data_x),/LONG)


IF valid_x[0] NE -1 THEN valid[valid_x]=1

IF valid_y[0] NE -1 THEN valid[valid_y]=valid[valid_y]+1

valid=TEMPORARY(WHERE(valid EQ 2,count))

plot,data_x[valid],data_y[valid]
END

regards,

R.Bauer
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Indexing structures of different type
Next Topic: repeat.. until loops

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

Current Time: Wed Oct 08 19:34:48 PDT 2025

Total time taken to generate the page: 0.00557 seconds