Re: min & max with index i, j, k

From: <debasish_at_nyahnyahspammersnyahnyah>
Date: Mon Jun 14 2010 - 16:01:13 MDT

Dear Yongzuo,

Please try

  xMax = max(x)
  xMin = min(x)

  x1D = ndtooned(x) ; only do this once
  indMax = ind_resolve(ind(x1D.eq.xMax),dimsizes(x)) ; locations of max
  indMin = ind_resolve(ind(x1D.eq.xMin),dimsizes(x)) ; locations of min

webpage: http://www.ncl.ucar.edu/Document/Functions/Built-in/ind_resolve.shtml

Also you can use maxind and minind

webpage: http://www.ncl.ucar.edu/Document/Functions/Built-in/maxind.shtml
          http://www.ncl.ucar.edu/Document/Functions/Built-in/minind.shtml

Thanks

Debasish

Quoting "Li, Yongzuo" <yongzuo.li@ou.edu>:

> Hi,
>
> Is it possible to find index i, j, k of maximum value
> (or minimum value) when function max or min is used?
>
> The corresponding values of other variables at the same
> i, j, k are wanted.
>
> Thanks.
>
> Yongzuo
>

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jun 14 16:01:21 2010

This archive was generated by hypermail 2.1.8 : Wed Jun 16 2010 - 15:28:33 MDT