- ←Prev
- KAPLIBS – Internal subroutines used within the KAPPA package.
- Next→
- TOC ↑
Description:
This routine
calculates the median and optionally up to one-hundred percentiles. It achieves this by using
Quicksort to order the good array values, and hence provide correct values (unlike the faster
histogram approximation used by KPG1_HSTAx).
Invocation
CALL KPG_STOSx( EL, ARRAY,
NGOOD, NUMPER, PERCNT, MEDIAN, PERVAL, STATUS )
Arguments
EL = INTEGER (Given)
Total
number of pixels in the array.
ARRAY( EL ) = ? (Given)
The vectorised array of values whose
ordered statistics are to be calculated.
NGOOD = INTEGER (Given)
Number of valid pixels which
contributed to the statistics.
NUMPER = INTEGER (Given)
Number of percentiles values to
report. This should be in the range 1 to 100. Set this to 1 and PERCNT(1) to VAL__BADR if
percentiles are not required.
PERCNT( NUMPER ) = REAL (Given)
The percentiles to derive.
Valid percentiles must be in the range 0.0 to 100.0, and preferably in ascending order. If
the first element is set to the bad value, then no percentiles are calculated.
MEDIAN =
DOUBLE PRECISION (Returned)
Median value. If there is an even number of good values
present in the array, the median is the average of the middle pair.
PERVAL( NUMPER ) =
DOUBLE PRECISION (Returned)
Percentile values corresponding to the percentile fractions
in PERCNT.
STATUS = INTEGER (Given and Returned)
The global status.
Notes:
-
There is a routine for byte, double-precision, integer, 64-bit integer, real, and word data types: replace
"
x"
in the routine name by B, D, I, K, R, or W as appropriate. The data type of the ARRAY argument
must match the particular routine used.
-
If the value of NGOOD is not at least two, then this routine will abort. The median and percentiles will
have the bad value.
-
The sorting is recorded in an index leaving the order of the supplied array values intact.
- ←Prev
- KAPLIBS – Internal subroutines used within the KAPPA package.
- Next→
- TOC ↑