# Path: wradlib/trafo.py
# class SBandToKu:
# class KuBandToS:
# def rvp_to_dbz(x):
# def decibel(x):
# def idecibel(x):
# def r_to_depth(x, interval):
# def kdp_to_r(kdp, f, a=129.0, b=0.85):
# def si_to_kmh(vals):
# def si_to_mph(vals):
# def si_2_kts(vals):
# def kmh_to_si(vals):
# def mph_to_si(vals):
# def kts_to_si(vals):
# 
# Path: wradlib/zr.py
# def z_to_r(z, a=200.0, b=1.6):
# def r_to_z(r, a=200.0, b=1.6):
# def z_to_r_enhanced(z, polar=True, shower=True):


import logging
import numpy as np
from scipy import interpolate, ndimage
from wradlib import trafo, zr

            - 0.165 for standard radomes,
            - 0.0575 for hydrophobic radomes.

            Per default set to 0.165.
    n_r : int
        The radius of rangebins within the rain-intensity is
        statistically evaluated as the representative rain-intensity
        over radome.
    stat : callable
        A numpy function for statistical aggregation of the
        central rangebins defined by n_r.

        Potential options: np.mean, np.median, np.max, np.min.

    Returns
    -------
    k : :class:`numpy:numpy.ndarray`
        Array with the same shape as ``gateset`` containing the
        calculated two-way transmission loss [dB] for each range gate.
        In case the input array (gateset) contains NaNs the
        corresponding beams of the output array (k) will be set as NaN,
        too.
    """

    # Select rangebins inside the defined center-range n_r.
    center = gateset[..., :n_r].reshape(-1, n_r * gateset.shape[-2])
    center_m = np.ma.masked_array(center, np.isnan(center))
    # Calculate rainrate in the center-range based on statistical method stat
    # and with standard ZR-relation.

# Path: wradlib/trafo.py
# class SBandToKu:
# class KuBandToS:
# def rvp_to_dbz(x):
# def decibel(x):
# def idecibel(x):
# def r_to_depth(x, interval):
# def kdp_to_r(kdp, f, a=129.0, b=0.85):
# def si_to_kmh(vals):
# def si_to_mph(vals):
# def si_2_kts(vals):
# def kmh_to_si(vals):
# def mph_to_si(vals):
# def kts_to_si(vals):
# 
# Path: wradlib/zr.py
# def z_to_r(z, a=200.0, b=1.6):
# def r_to_z(r, a=200.0, b=1.6):
# def z_to_r_enhanced(z, polar=True, shower=True):


# Path: wradlib/atten.py
import logging
import numpy as np
from scipy import interpolate, ndimage
from wradlib import trafo, zr


            - 0.165 for standard radomes,
            - 0.0575 for hydrophobic radomes.

            Per default set to 0.165.
    n_r : int
        The radius of rangebins within the rain-intensity is
        statistically evaluated as the representative rain-intensity
        over radome.
    stat : callable
        A numpy function for statistical aggregation of the
        central rangebins defined by n_r.

        Potential options: np.mean, np.median, np.max, np.min.

    Returns
    -------
    k : :class:`numpy:numpy.ndarray`
        Array with the same shape as ``gateset`` containing the
        calculated two-way transmission loss [dB] for each range gate.
        In case the input array (gateset) contains NaNs the
        corresponding beams of the output array (k) will be set as NaN,
        too.
    """

    # Select rangebins inside the defined center-range n_r.
    center = gateset[..., :n_r].reshape(-1, n_r * gateset.shape[-2])
    center_m = np.ma.masked_array(center, np.isnan(center))
    # Calculate rainrate in the center-range based on statistical method stat
    # and with standard ZR-relation.

    rain_over_radome = zr.z_to_r(trafo.idecibel(stat(center_m, axis=-1)))