Re: (no subject)

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue Jul 23 2013 - 09:31:52 MDT

Hi Emiliano,

If by "second maximum" you mean the second highest value in an array, then you could set all maximum values to missing first, and then get the maximum of that array:

; Generate an array of dummy values that go from -10 to 10
x = random_uniform(-10,10,100)
x@_FillValue = -999

xmax = max(x)
print("first maximum = " + xmax)

x = where(x.eq.xmax,x@_FillValue,x)
xmax = max(x)
print("second maximum x = " + xmax)

x = where(x.eq.xmax,x@_FillValue,x)
xmax = max(x)
print("third maximum x = " + xmax)

You can also look into sorting your array with dim_pqsort or pqsort:

http://www.ncl.ucar.edu/Document/Functions/Built-in/dim_pqsort.shtml
http://www.ncl.ucar.edu/Document/Functions/Built-in/pqsort.shtml

--Mary

On Jul 22, 2013, at 12:15 PM, Emiliano Gomez <egolol87@gmail.com> wrote:

> Hello, mi name is Emiliano Gómez and i want to make a ncl program that finds MSD in some data i have. Is there a funcion in ncl that finds the second or third maximum number in a array? max, and dim_max_n just find the maximum of an array. Thanks.
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Jul 23 09:32:04 2013

This archive was generated by hypermail 2.1.8 : Thu Jul 25 2013 - 21:02:42 MDT