def _sentinel_stats(
    src_path, percentiles=(2, 98), histogram_bins=10, histogram_range=None
):
    """
    src_path : str or PathLike object
        A dataset path or URL. Will be opened in "r" mode.
    """

    with rasterio.open(src_path) as src:
        arr = src.read(indexes=[1], masked=True)
        arr[arr == 0] = np.ma.masked

    params = {}
    if histogram_bins:
        params.update(dict(bins=histogram_bins))
    if histogram_range:
        params.update(dict(range=histogram_range))

    return {1: utils._stats(arr, percentiles=percentiles, **params)}
def _sentinel_stats ( src_path , percentiles = ( 2 , 98 ) , histogram_bins = 10 , histogram_range = None ) : with rasterio . open ( src_path ) as src : arr = src . read ( indexes = [ 1 ] , masked = True ) arr [ arr == 0 ] = np . ma . masked params = { } if histogram_bins : params . update ( dict ( bins = histogram_bins ) ) if histogram_range : params . update ( dict ( range = histogram_range ) ) return { 1 : utils . _stats ( arr , percentiles = percentiles , ** params ) }
src_path : str or PathLike object
        A dataset path or URL. Will be opened in "r" mode.