def xmedian(ma):
    """ Given a masked numpy array (build using numpy.ma class) return
    the median value of the array."""
    import numpy
    _medianIndex = numpy.floor(ma.count(axis=0)/2.0)
    _sortIndex = ma.argsort(kind='heapsort',axis=0)
    _median = ma[0].filled(fill_value=0)*0
    for idx in range(len(_sortIndex)):
        _median = _median+_sortIndex[idx]*(_medianIndex==idx)
    _medianIndex=_median
    _median=0*_median
    for idx in range(len(ma)):
        _median = _median + ma[idx].filled(fill_value=0)*(_medianIndex==idx)
    _sortIndex=None
    _medianIndex=None
    return _median
def xmedian ( ma ) : import numpy _medianIndex = numpy . floor ( ma . count ( axis = 0 ) / 2.0 ) _sortIndex = ma . argsort ( kind = 'heapsort' , axis = 0 ) _median = ma [ 0 ] . filled ( fill_value = 0 ) * 0 for idx in range ( len ( _sortIndex ) ) : _median = _median + _sortIndex [ idx ] * ( _medianIndex == idx ) _medianIndex = _median _median = 0 * _median for idx in range ( len ( ma ) ) : _median = _median + ma [ idx ] . filled ( fill_value = 0 ) * ( _medianIndex == idx ) _sortIndex = None _medianIndex = None return _median
Given a masked numpy array (build using numpy.ma class) return
    the median value of the array.