# 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):


import numpy as np
from wradlib import trafo




class TestTransformation:
    rvp = np.array([0.0, 128.0, 255.0])
    dbz = np.array([-32.5, 31.5, 95.0])
    lin = np.array([1e-4, 1.0, 1e4])
    dec = np.array([-40.0, 0.0, 40.0])
    r = np.array([5.0, 10.0, 20.0])
    kdp = np.array([0.0, 1.0, 2.0, 5.0])
    # speed in m/s
    speedsi = np.array([0.0, 1.0, 50.0])
    # speed in km/h
    speedkmh = np.array([0.0, 3.6, 180.0])
    # speed in miles/h
    speedmph = np.array([0.0, 2.23693629, 111.8468146])
    # speed in knots
    speedkts = np.array([0.0, 1.94384449, 97.19222462])

    def test_rvp_to_dbz(self):
        assert np.allclose(trafo.rvp_to_dbz(self.rvp), self.dbz)

    def test_decibel(self):
        assert np.allclose(trafo.decibel(self.lin), self.dec)

    def test_idecibel(self):
        assert np.allclose(trafo.idecibel(self.dec), self.lin)

    def test_r_to_depth(self):

# 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/tests/test_trafo.py
import numpy as np
from wradlib import trafo





class TestTransformation:
    rvp = np.array([0.0, 128.0, 255.0])
    dbz = np.array([-32.5, 31.5, 95.0])
    lin = np.array([1e-4, 1.0, 1e4])
    dec = np.array([-40.0, 0.0, 40.0])
    r = np.array([5.0, 10.0, 20.0])
    kdp = np.array([0.0, 1.0, 2.0, 5.0])
    # speed in m/s
    speedsi = np.array([0.0, 1.0, 50.0])
    # speed in km/h
    speedkmh = np.array([0.0, 3.6, 180.0])
    # speed in miles/h
    speedmph = np.array([0.0, 2.23693629, 111.8468146])
    # speed in knots
    speedkts = np.array([0.0, 1.94384449, 97.19222462])

    def test_rvp_to_dbz(self):
        assert np.allclose(trafo.rvp_to_dbz(self.rvp), self.dbz)

    def test_decibel(self):
        assert np.allclose(trafo.decibel(self.lin), self.dec)

    def test_idecibel(self):
        assert np.allclose(trafo.idecibel(self.dec), self.lin)

    def test_r_to_depth(self):

        assert np.allclose(trafo.r_to_depth(self.r, 720), np.array([1.0, 2.0, 4.0]))