KPG1_FMEDx

Derives the unweighted fast median of a vector

Description:

This routine derives the unweighte ‘fast’ median of an array. The method used is based on Wirth’ s algorithm for selecting the Kth value, which is very fast compared with a full sort. If there is an even number of elements, the median is computed from the mean of the two elements that straddle the median.

Invocation

CALL KPG1_FMEDx( BAD, EL, ARRAY, POINT, MEDIAN, NGOOD, STATUS )

Arguments

BAD = LOGICAL (Given)
If BAD is .TRUE. there may be bad pixels present in the vector and so should be tested. If BAD is .FALSE. there is no testing for bad values.
EL = INTEGER (Given)
The number of elements within the array to sort.
ARRAY( EL ) = ? (Given and Returned)
The array whose median is to be found. On exit the array is partially sorted.
POINT( EL ) = INTEGER (Returned)
Workspace to hold pointers to the original positions of the data before extraction and conversion into the ARRAY array.
MEDIAN = ? (Returned)
The fast median of the array.
NGOOD = INTEGER (Returned)
The number of elements actually used after bad values have been excluded.
STATUS = INTEGER (Given and Returned)
The global status.

Notes: