Exemple #1
0
def sky_view_non_ditch_amplification(arr):
    """
    Non ditch amplification from SkyViewFactor.
    """
    arr = da.from_array(arr, chunks=(800, 800))
    arr = d_gf(
        arr, np.nanmedian,
        footprint=create_circular_mask(25)).compute(scheduler='processes')
    arr = da.from_array(_reclassify_sky_view_non_ditch_amp(arr),
                        chunks=(800, 800))
    return d_gf(arr, np.nanmean, footprint=create_circular_mask(10))
Exemple #2
0
def impoundment_amplification(arr, mask_radius=10):
    """
    Impoundment ditch enhancement.
    """
    norm_arr = da.from_array(_reclassify_impoundment(arr), chunks=(800, 800))
    mask = create_circular_mask(mask_radius)
    return d_gf(d_gf(d_gf(norm_arr, np.nanmean, footprint=mask),
                     np.nanmean,
                     footprint=mask),
                np.nanmedian,
                footprint=mask).compute(scheduler='processes')
Exemple #3
0
def slope_non_ditch_amplification(arr):
    """
    Non ditch amplification from Slope.
    """
    new_arr = arr.copy()
    arr = d_gf(
        da.from_array(arr, chunks=(800, 800)),
        np.nanmedian,
        footprint=create_circular_mask(35)).compute(scheduler='processes')
    new_arr = _slope_non_ditch_amplifcation_normalize(arr, new_arr)
    return d_gf(da.from_array(new_arr, chunks=(800, 800)),
                np.nanmean,
                footprint=create_circular_mask(15))
def custom_remove_noise(arr, radius, threshold, selfThreshold):
    """
    Removes noise from a probability prediction.
    """
    max_arr = d_gf(
        da.from_array(arr, chunks=(800, 800)),
        np.nanmax,
        footprint=general_functions.create_circular_mask(radius)).compute(
            scheduler='processes')
    return _custom_remove_noise(arr, max_arr, np.copy(arr), threshold,
                                selfThreshold)
Exemple #5
0
def hpmf_filter(arr):
    """
    HPMF ditch enhancement.
    """
    normalized_arr = da.from_array(_reclassify_hpmf_filter(arr),
                                   chunks=(800, 800))

    mean = d_gf(
        d_gf(d_gf(d_gf(normalized_arr,
                       np.amax,
                       footprint=create_circular_mask(1)),
                  np.amax,
                  footprint=create_circular_mask(1)),
             np.median,
             footprint=create_circular_mask(2)),
        np.nanmean,
        footprint=create_circular_mask(5)).compute(scheduler='processes')
    reclassify = da.from_array(_reclassify_hpmf_filter_mean(mean),
                               chunks=(800, 800))

    return d_gf(reclassify, np.nanmean, footprint=create_circular_mask(7))
def conic_proba_post_processing(arr, maskRadius, threshold):
    """
    Attempts to fill the gaps of a continuous probability prediction array.
    """
    masks = []
    maxArr = d_gf(da.from_array(arr, chunks=(800, 800)),
                  np.nanmax,
                  footprint=general_functions.create_circular_mask(5))
    for i in range(0, 8):
        masks.append(create_conic_mask(maskRadius, i))

    return _conic_proba_post_processing(np.array(arr), np.array(maxArr),
                                        np.array(masks), threshold)