[ncl-talk] max index on a single dimension for a multidimensional array without loop
Kyle Griffin
ksgriffin2 at wisc.edu
Wed Sep 9 21:22:15 MDT 2015
Hi Matt,
I think dim_max_n is what you're looking for.
https://www.ncl.ucar.edu/Document/Functions/Built-in/dim_max_n.shtml
Not sure if I've used it in this manner before, but if you specify the
dimension to find the max over (2nd argument) as 0, I think you should get
what you're looking for. As a built-in function, it should be faster than
looping over each point.
Kyle
----------------------------------------
Kyle S. Griffin
Department of Atmospheric and Oceanic Sciences
University of Wisconsin - Madison
Room 1407
1225 W Dayton St, Madison, WI 53706
Email: ksgriffin2 at wisc.edu
On Wed, Sep 9, 2015 at 9:08 PM, Matthew Fearon <Matthew.Fearon at dri.edu>
wrote:
> Dear NCL Users,
>
> Trying to get the index of the maximum value on a single dimension as part
> of a multidimensional array. The array is data(time, lat, lon) where nlat x
> nlon is 400x500 and ntime=24. Would like the maximum over the time
> dimension for each grid cell or lat/long. Has anymore performed this
> without a loop over nlat/nlon ?
>
> Making the array 1D (and using ind_resolve) allows me to get the max inds
> per dimension over the whole array, which isn't what I need.
>
> Any suggestions would be greatly appreciated.
> thanks,
> Matt
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150909/9cc7b8b1/attachment.html
More information about the ncl-talk
mailing list