This function calculates the median value of the supplied 1- or 2-d array. The function sorts the array values: if the number of elements is odd, the central element of the sorted list is returned; if even, the element in the lower of the two central elements is returned.
interface median
real(single) function medianVector(array)
real(single), intent(in) :: vector(:)
end function medianVector
real(single) function medianArray(array)
real(single), intent(in) :: array(:,:)
end function medianArray
end interface