How to use the wradlib.trafo.decibel function in wradlib

To help you get started, we’ve selected a few wradlib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wradlib / wradlib / wradlib / zr.py View on Github external
def _z_to_r_enhanced_mdfilt(z, mode='mirror'):
    """multidimensional version

    assuming the two last dimensions represent a 2-D image
    Uses :func:`scipy:scipy.ndimage.filters.generic_filter` to reduce the
    number of for-loops even more.
    """
    # get the shape of the input
    # dimy = z.shape[-2]
    # dimx = z.shape[-1]

    # calculate the decibel values from the input
    db = trafo.decibel(z)

    # set up our output arrays
    r = np.zeros(z.shape)
    size = list(z.shape)
    size[-2:] = [3, 3]
    size[:-2] = [1] * len(size[:-2])
    size = tuple(size)
    si = filters.generic_filter(db, z_to_r_esifilter, size=size, mode=mode)

    gt44 = db > 44.
    r[gt44] = z_to_r(z[gt44], a=77, b=1.9)
    si[gt44] = -1.
    # the same is true for values between 36.5 and 44 dBZ
    bt3644 = (db >= 36.5) & (db <= 44.)
    r[bt3644] = z_to_r(z[bt3644], a=200, b=1.6)
    si[bt3644] = -2.