Returns the index of the first occurrence of a minimum value within the specified dimension.
Available in version 6.4.0 and later.
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" function dim_minind ( arg : numeric, dim  : integer ) return_val : integer array containing first occurrence of a minimum value
An array of up to four dimensions.dim
The dimension number of arg along which the first minimum is desired. Currently, this must be set to 0 which corresponds to the leftmost dimension.
integer array containing the index of first occurrence of a minimum value
This function scans an array for the minimum value and returns the index of the first occurrence of the minimum along the specified dimension. Missing values are ignored. Remember that in NCL, indexing starts at 0, not 1.
This function will return a long if on a 64-bit system and the index value is >= 2 GB.
This function is based upon a response by Dave Allured (NOAA Affiliate) to an question asked on email@example.com.
Example 1: Trivial example. The results should be identical (i=>j=3)
x = (/3.,2.,5.,1.,5.,2.,5.,1.,3.,2./) imin = minind(x) ; Should be 3 jmin = dim_minind(x, 0)
Example 2: Find the first index value correspnding to the minimum and maximum values along the specified dimension.
z = (/ (/1, 2, 3, 4, 7/), \ ; a(4,5) ; dimension 0 is the leftmost dimension (/5, 6, 7, 8, 3/), \ (/9, 1, 9, 8,10/), \ (/7, 6, 1, 4, 3/) /) nmin = dim_minind(z, 0) ; nmim= (/0, 2, 3, 0, 1/) nmax = dim_maxind(z, 0) ; nmax= (/2, 1, 2, 1, 2/)