def dark_pixels(green, swir2, threshold=0.25):
    """ Detect dark pixels from green and swir2 band

    :param green: name of the green band
    :type green: str
    :param swir2: name of the swir2 band
    :type swir2: str
    :param threshold: threshold value from which are considered dark pixels
    :type threshold: float
    :return: a function
    """
    def wrap(img):
        return img.normalizedDifference([green, swir2]).gt(threshold)
    return wrap