Re: Index of maximum

From: Andrea Hahmann <hahmann_at_nyahnyahspammersnyahnyah>
Date: Wed, 15 Oct 2008 01:47:12 -0600 (MDT)

Oliver,

You will need to combine the functions maxind
(http://www.ncl.ucar.edu/Document/Functions/Built-in/maxind.shtml)
ind_resolve, and onedtond/ndtooned. There is an example of how to do this
in http://www.ncl.ucar.edu/Document/Functions/Built-in/ind_resolve.shtml

Good luck,
Andrea

> Hi,
>
> I was wondering if there is any easy way to extract the index location
> of the maximum value in a 3-dimensional array other than...
>
> vmax=-99999.0
> do i=0,dimi-1
> do j=0,dimj-1
> do k=0,dimk-1
> if (v(k,j,i).gt.vmax) then
> imax=i
> jmax=j
> kmax=k
> vmax=v(k,j,i)
> end if
> end do
> end do
> end do
>
> Thanks for you help,
> Oli
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

----------------------------------------------------------------
Andrea N. Hahmann, Ph.D.
Research Applications Laboratory
Natl. Cntr for Atmospheric Research
hahmann_at_ucar.edu
303-497-8383 Fax:303-497-8401
----------------------------------------------------------------

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Oct 15 2008 - 01:47:12 MDT

This archive was generated by hypermail 2.2.0 : Fri Oct 17 2008 - 10:06:33 MDT