def _get_threshold_value(precip):
    """
    Get the the rain/no rain threshold with the same unit, transformation and
    accutime of the data.
    If all the values are NaNs, the returned value is `np.nan`.
    Otherwise, np.min(precip[precip > precip.min()]) is returned.

    Returns
    -------
    threshold: float
    """
    valid_mask = np.isfinite(precip)
    if valid_mask.any():
        _precip = precip[valid_mask]
        min_precip = _precip.min()
        above_min_mask = _precip > min_precip
        if above_min_mask.any():
            return np.min(_precip[above_min_mask])
        else:
            return min_precip
    else:
        return np.nan
Get the the rain/no rain threshold with the same unit, transformation and
accutime of the data.
If all the values are NaNs, the returned value is `np.nan`.
Otherwise, np.min(precip[precip > precip.min()]) is returned.

Returns
-------
threshold: float
pysteps/io/importers.py