src/pys5p/biweight.py
def biweight(data, axis=None, spread=False):
    """
    Calculate Tukey's biweight.
    Implementation based on Eqn. 7.6 and 7.7 in the SWIR OCAL ATBD.

    Parameters
    ----------
    data   :   array_like
       input array
    axis   :   int, optional
       axis along which the biweight medians are computed.
        - Note that axis will be ignored when data is a 1-D array.
    spread :   bool, optional
       if True, then return also the biweight spread.

    Returns
    -------
    out    :   ndarray or tuple
       biweight median and biweight spread if parameter "spread" is True
    """
    if axis is None or data.ndim == 1:
        mask = np.isfinite(data)
        if np.all(~mask):
            if spread:
                return (np.nan, 0.)
            return np.nan
        return __biweight(data, spread)

    # only a single axis!
    if not isinstance(axis, int):
        raise TypeError('axis not an integer')
    if not 0 <= axis < data.ndim:
        raise ValueError('axis out-of-range')

    with warnings.catch_warnings():
        warnings.filterwarnings('ignore', r'All-NaN (slice|axis) encountered')
        return __biweight_axis(data, axis, spread)

    Calculate Tukey's biweight.
    Implementation based on Eqn. 7.6 and 7.7 in the SWIR OCAL ATBD.

    Parameters
    ----------
    data   :   array_like
       input array
    axis   :   int, optional
       axis along which the biweight medians are computed.
        - Note that axis will be ignored when data is a 1-D array.
    spread :   bool, optional
       if True, then return also the biweight spread.

    Returns
    -------
    out    :   ndarray or tuple
       biweight median and biweight spread if parameter "spread" is True
    
Calculate Tukey's biweight.
Implementation based on Eqn.

Parameters

data   :   array_like
input array
axis   :   int, optional
axis along which the biweight medians are computed.
Note that axis will be ignored when data is a 1-D array.
spread :   bool, optional
if True, then return also the biweight spread.

Returns

out    :   ndarray or tuple
biweight median and biweight spread if parameter "spread" is True
Calculate Tukey ' s biweight . Implementation based on Eqn . Parameters data : array_like input array axis : int optional axis along which the biweight medians are computed . Note that axis will be ignored when data is a 1 - D array . spread : bool optional if True then return also the biweight spread . Returns out : ndarray or tuple biweight median and biweight spread if parameter " spread " is True
def biweight(data, axis=None, spread=False):
    if axis is None or data.ndim == 1:
        mask = np.isfinite(data)
        if np.all(~mask):
            if spread:
                return (np.nan, 0.)
            return np.nan
        return __biweight(data, spread)
    if not isinstance(axis, int):
        raise TypeError('axis not an integer')
    if not 0 <= axis < data.ndim:
        raise ValueError('axis out-of-range')
    with warnings.catch_warnings():
        warnings.filterwarnings('ignore', r'All-NaN (slice|axis) encountered')
        return __biweight_axis(data, axis, spread)
def biweight ( data , axis = None , spread = False ) : if axis is None or data . ndim == 1 : mask = np . isfinite ( data ) if np . all ( ~ mask ) : if spread : return ( np . nan , 0. ) return np . nan return __biweight ( data , spread ) if not isinstance ( axis , int ) : raise TypeError ( 'axis not an integer' ) if not 0 <= axis < data . ndim : raise ValueError ( 'axis out-of-range' ) with warnings . catch_warnings ( ) : warnings . filterwarnings ( 'ignore' , r'All-NaN (slice|axis) encountered' ) return __biweight_axis ( data , axis , spread )
Calculate Tukey's biweight.
Calculate Tukey ' s biweight .
"""
    Calculate Tukey's biweight.
    Implementation based on Eqn. 7.6 and 7.7 in the SWIR OCAL ATBD.

    Parameters
    ----------
    data   :   array_like
       input array
    axis   :   int, optional
       axis along which the biweight medians are computed.
        - Note that axis will be ignored when data is a 1-D array.
    spread :   bool, optional
       if True, then return also the biweight spread.

    Returns
    -------
    out    :   ndarray or tuple
       biweight median and biweight spread if parameter "spread" is True
    """ # only a single axis!
data
axis
spread