def sigma_fltr(dem, n=3):
    """sigma * factor filter
    
    Useful for outlier removal

    These are min/max percentile ranges for different sigma values:
    1: 15.865, 84.135
    2: 2.275, 97.725
    3: 0.135, 99.865
    """
    std = dem.std()
    u = dem.mean()
    print('Excluding values outside of range: {1:0.2f} +/- {0}*{2:0.2f}'.format(n, u, std))
    rangelim = (u - n*std, u + n*std)
    out = range_fltr(dem, rangelim)
    return out