NCL Home >
Documentation >
Functions >
Array query
local_min_1d
Determines the relative minima for a 1-dimensional array.
Prototype
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" ; This library is automatically loaded
; from NCL V6.2.0 onward.
; No need for user to explicitly load.
function local_min_1d (
x [*] : numeric,
cyclic : logical,
delta [1] : numeric,
iopt [1] : integer
)
Arguments
xA one-dimensional (1D) numeric array.
cyclicA logical value indicating if x is cyclic [=True] or not [=False].
deltaTolerance level (negative). If values are within delta of surrounding values it will not be counted as a local minimum value.
ioptAn integer value indicating what is to be returned. iopt=0 means return the minimum values. iopt.ne.0 means return the indices [subscripts] where minimum values occured.
Return value
If iopt=0 then a 1D array containing the relative minima is returned. Otherwise a 1D array containing the indices (subscripts) where the minima are returned.
Description
Each element of x is checked against adjacent points to see if the difference exceeds delta.
See Also
Examples
Example 1
qmin = local_min_1d(q, False, -0.25, 0)
or
imin = local_min_1d(q, False, -0.25, 1)
if (.not.ismissing(imin)) then
qmin = q(imin)
zmin = z(imin) ; z where q is at a minimum
end if