Data Transformation#

Module <trafo> transforms data e.g. from RVP-units to dBZ-values to Z-values and vice versa.

rvp_to_dbz

Calculates dBZ-values from DWD RVP6 values as given in DX-product files.

decibel

Calculates the decibel representation of the input values

idecibel

Calculates the inverse of input decibel values

r_to_depth

Computes rainfall depth (mm) from rainfall intensity (mm/h)

kdp_to_r

Estimating rainfall intensity directly from specific differential phase.

si_to_kmh

Conversion from SI wind speed units to km/hr.

si_to_mph

Conversion from SI wind speed units to miles/hr

si_to_kts

Conversion from SI wind speed units to knots

kmh_to_si

Conversion from km/hr to SI wind speed units

mph_to_si

Conversion from miles/hr to SI wind speed units

kts_to_si

Conversion from knots to SI wind speed units

KuBandToS

Class to hold coefficients for Radar Reflectivity Conversion

KuBandToX

Class to hold coefficients for Radar Reflectivity Conversion

SBandToKu

Class to hold coefficients for Radar Reflectivity Conversion

TrafoMethods

wradlib xarray SubAccessor methods for DualPol.

wradlib.trafo.rvp_to_dbz(x)[source]#

Calculates dBZ-values from DWD RVP6 values as given in DX-product files.

Parameters

x (float or numpy.ndarray) – a number or an array

Examples

>>> from wradlib.trafo import rvp_to_dbz
>>> print(rvp_to_dbz(65.))
0.0
wradlib.trafo.decibel(x)[source]#

Calculates the decibel representation of the input values

\(dBZ=10 \cdot \log_{10} z\)

Parameters

x (float or numpy.ndarray) – (must not be <= 0.)

Examples

>>> from wradlib.trafo import decibel
>>> print(decibel(100.))
20.0
wradlib.trafo.idecibel(x)[source]#

Calculates the inverse of input decibel values

\(z=10^{x \over 10}\)

Parameters

x (float or numpy.ndarray)

Examples

>>> from wradlib.trafo import idecibel
>>> print(idecibel(10.))
10.0
wradlib.trafo.r_to_depth(x, interval)[source]#

Computes rainfall depth (mm) from rainfall intensity (mm/h)

Parameters
  • x (float or numpy.ndarray) – rainfall intensity in mm/h

  • interval (float) – time interval (s) the values of x represent

Returns

output (float or numpy.ndarray) – rainfall depth (mm)

wradlib.trafo.kdp_to_r(kdp, f, a=129.0, b=0.85)[source]#

Estimating rainfall intensity directly from specific differential phase.

The general power law expression has been suggested by [Ryzhkov et al., 2005].

The default parameters have been set according to [Bringi et al., 2001].

Note

Please note that this way, rainfall intensities can become negative. This is an intended behaviour in order to account for noisy \(K_{DP}\) values.

Parameters
  • kdp (float or numpy.ndarray) – \(K_{DP}\) as array of floats

  • f (float) – radar frequency [GHz]

    • Standard frequencies in X-band range between 8.0 and 12.0 GHz,

    • Standard frequencies in C-band range between 4.0 and 8.0 GHz,

    • Standard frequencies in S-band range between 2.0 and 4.0 GHz.

  • a (float) – linear coefficient of the power law

  • b (float) – exponent of the power law

Returns

output (numpy.ndarray) – array of rainfall intensity

wradlib.trafo.si_to_kmh(vals)[source]#

Conversion from SI wind speed units to km/hr.

Note

Code was migrated from nguy/PyRadarMet.

Parameters

vals (float or numpy.ndarray) – Speed in SI units (m/s)

Returns

output (float or numpy.ndarray) – Speed in km/hr

Examples

>>> from wradlib.trafo import si_to_kmh
>>> print(si_to_kmh(1.))
3.6
wradlib.trafo.si_to_mph(vals)[source]#

Conversion from SI wind speed units to miles/hr

Note

Code was migrated from nguy/PyRadarMet.

Parameters

vals (float or numpy.ndarray) – Speed in SI units (m/s)

Returns

output (float or numpy.ndarray) – Speed in miles per hour

Examples

>>> from wradlib.trafo import si_to_mph
>>> print(np.round(si_to_mph(1.), 3))
2.237
wradlib.trafo.si_to_kts(vals)[source]#

Conversion from SI wind speed units to knots

Note

Code was migrated from nguy/PyRadarMet.

Parameters

vals (float or numpy.ndarray) – Speed in SI units (m/s)

Returns

output (float or numpy.ndarray) – Speed in knots

Examples

>>> from wradlib.trafo import si_to_kts
>>> print(np.round(si_to_kts(1.), 3))
1.944
wradlib.trafo.kmh_to_si(vals)[source]#

Conversion from km/hr to SI wind speed units

Note

Code was migrated from nguy/PyRadarMet.

Parameters

vals (float or numpy.ndarray) – Wind speed in km/hr

Returns

output (float or numpy.ndarray) – Wind speed in SI units (m/s)

Examples

>>> from wradlib.trafo import kmh_to_si
>>> print(np.round(kmh_to_si(10.), 3))
2.778
wradlib.trafo.mph_to_si(vals)[source]#

Conversion from miles/hr to SI wind speed units

Note

Code was migrated from nguy/PyRadarMet.

Parameters

vals (float or numpy.ndarray) – Wind speed in miles per hour

Returns

output (float or numpy.ndarray) – Wind speed in SI units (m/s)

Examples

>>> from wradlib.trafo import mph_to_si
>>> print(np.round(mph_to_si(10.), 2))
4.47
wradlib.trafo.kts_to_si(vals)[source]#

Conversion from knots to SI wind speed units

Note

Code was migrated from nguy/PyRadarMet.

Parameters

vals (float or numpy.ndarray) – Wind speed in knots

Returns

output (float or numpy.ndarray) – Wind speed in SI units (m/s)

Examples

>>> from wradlib.trafo import kts_to_si
>>> print(np.round(kts_to_si(1.), 3))
0.514
class wradlib.trafo.KuBandToS[source]#

Bases: object

Class to hold coefficients for Radar Reflectivity Conversion

From Ku-band (13.8 GHz) to S-band (2.8 GHz)

See [Cao et al., 2013] for reference.

snow = array([[ 4.78e-02,  4.12e-02,  8.12e-02,  1.59e-01,  2.87e-01,  4.93e-01,          8.16e-01,  1.31e+00,  2.01e+00,  2.82e+00,  1.74e-01],        [ 1.23e-02,  3.66e-03,  2.00e-03,  9.42e-04,  5.29e-04,  5.96e-04,          1.22e-03,  2.11e-03,  3.34e-03,  5.33e-03,  1.35e-02],        [-3.50e-04,  1.17e-03,  1.04e-03,  8.16e-04,  6.59e-04,  5.85e-04,          6.13e-04,  7.01e-04,  8.24e-04,  1.01e-03, -1.38e-03],        [-3.30e-05, -8.08e-05, -6.44e-05, -4.97e-05, -4.15e-05, -3.89e-05,         -4.15e-05, -4.58e-05, -5.06e-05, -5.78e-05,  4.74e-05],        [ 4.27e-07,  9.25e-07,  7.41e-07,  6.13e-07,  5.80e-07,  6.16e-07,          7.12e-07,  8.22e-07,  9.39e-07,  1.10e-06,  0.00e+00]])#
hail = array([[ 4.78e-02,  1.80e-01,  1.95e-01,  1.88e-01,  2.36e-01,  2.70e-01,          2.98e-01,  2.85e-01,  1.75e-01,  4.30e-02,  8.80e-02],        [ 1.23e-02, -3.73e-02, -3.83e-02, -3.29e-02, -3.46e-02, -2.94e-02,         -2.10e-02, -9.96e-03, -8.05e-03, -8.27e-03,  5.39e-02],        [-3.50e-04,  4.08e-03,  4.14e-03,  3.75e-03,  3.71e-03,  3.22e-03,          2.44e-03,  1.45e-03,  1.21e-03,  1.66e-03, -2.99e-04],        [-3.30e-05, -1.59e-04, -1.54e-04, -1.39e-04, -1.30e-04, -1.12e-04,         -8.56e-05, -5.33e-05, -4.66e-05, -7.19e-05,  1.90e-05],        [ 4.27e-07,  1.59e-06,  1.51e-06,  1.37e-06,  1.29e-06,  1.15e-06,          9.40e-07,  6.71e-07,  6.33e-07,  9.52e-07,  0.00e+00]])#
class wradlib.trafo.KuBandToX[source]#

Bases: object

Class to hold coefficients for Radar Reflectivity Conversion

From Ku-band (13.8 GHz) to X-band (9.4 GHz)

See [Pejcic et al., 2022] for reference.

snow = array([[ 1.91e-01, -1.20e-01],        [-7.83e-02,  6.80e-02],        [ 1.12e-02, -4.55e-03],        [-6.17e-04,  1.18e-04],        [ 1.25e-05, -6.60e-07],        [-8.43e-08,  0.00e+00]])#
hail = array([[ 1.91e-01,  5.57e-02],        [-7.83e-02,  1.80e-02],        [ 1.12e-02,  1.91e-03],        [-6.17e-04, -6.64e-05],        [ 1.25e-05,  8.18e-07],        [-8.43e-08,  0.00e+00]])#
class wradlib.trafo.SBandToKu[source]#

Bases: object

Class to hold coefficients for Radar Reflectivity Conversion

From S-band (2.8GHz) to Ku-band (13.8GHz)

See [Liao et al., 2009] for reference.

snow = array([ 0.185074  ,  1.01378   , -0.00189212])#
rain = array([-1.50393e+00,  1.07274e+00,  1.65393e-04])#
class wradlib.trafo.TrafoMethods(obj)[source]#

Bases: XarrayMethods

wradlib xarray SubAccessor methods for DualPol.

decibel()[source]#

Calculates the decibel representation of the input values

\(dBZ=10 \cdot \log_{10} z\)

Parameters

x (float or numpy.ndarray) – (must not be <= 0.)

Examples

>>> from wradlib.trafo import decibel
>>> print(decibel(100.))
20.0
idecibel()[source]#

Calculates the inverse of input decibel values

\(z=10^{x \over 10}\)

Parameters

x (float or numpy.ndarray)

Examples

>>> from wradlib.trafo import idecibel
>>> print(idecibel(10.))
10.0
r_to_depth(interval)[source]#

Computes rainfall depth (mm) from rainfall intensity (mm/h)

Parameters
  • x (float or numpy.ndarray) – rainfall intensity in mm/h

  • interval (float) – time interval (s) the values of x represent

Returns

output (float or numpy.ndarray) – rainfall depth (mm)