Z-R Conversions#

Module zr takes care of transforming reflectivity into rainfall rates and vice versa

z_to_r

Conversion from reflectivities to rain rates.

r_to_z

Calculates reflectivity from rain rates using a power law Z/R relationship Z = a*R**b

z_to_r_enhanced

Calculates rainrates from radar reflectivities using the enhanced three-part Z-R-relationship used by the DWD (as of 2009)

ZRMethods

wradlib xarray SubAccessor methods for zr.

wradlib.zr.z_to_r(z, *, a=200.0, b=1.6)[source]#
wradlib.zr.z_to_r(obj: DataArray, **kwargs)

Conversion from reflectivities to rain rates.

Calculates rain rates from radar reflectivities using a power law Z/R relationship Z = a*R**b

Parameters
  • z (float or numpy.ndarray) – Corresponds to reflectivity Z in mm**6/m**3

  • a (float) – Parameter a of the Z/R-relationship Standard value according to Marshall-Palmer is a=200., b=1.6

  • b (float) – Parameter b of the Z/R-relationship Standard value according to Marshall-Palmer is b=1.6

Note

The German Weather Service uses a=256 and b=1.42 instead of the Marshall-Palmer defaults.

Returns

output (float or numpy.ndarray) – rainfall intensity in mm/h

wradlib.zr.r_to_z(r, *, a=200.0, b=1.6)[source]#
wradlib.zr.r_to_z(obj: DataArray, **kwargs)

Calculates reflectivity from rain rates using a power law Z/R relationship Z = a*R**b

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

  • a (float) – Parameter a of the Z/R-relationship Standard value according to Marshall-Palmer is a=200., b=1.6

  • b (float) – Parameter b of the Z/R-relationship Standard value according to Marshall-Palmer is b=1.6

Note

The German Weather Service uses a=256 and b=1.42 instead of the Marshall-Palmer defaults.

Returns

output (float or numpy.ndarray) – reflectivity in mm**6/m**3

wradlib.zr.z_to_r_enhanced(z, *, polar=True, shower=True)[source]#
wradlib.zr.z_to_r_enhanced(obj: DataArray, **kwargs)

Calculates rainrates from radar reflectivities using the enhanced three-part Z-R-relationship used by the DWD (as of 2009)

To be used with polar representations so that one dimension is cyclical. i.e. z should be of shape (nazimuths, nbins) –> the first dimension is the cyclical one. For DWD DX-Data z’s shape is (360,128).

Neighborhood-means are taken only for available data via fast convolution sums. Refer to the RADOLAN final report or the RADOLAN System handbook for details on the calculations. Basically, for low reflectivities an index called the shower index is calculated as the mean of the differences along both axis in a neighborhood of 3x3 pixels. This means:

x-direction –>

y
l
d
i
r

1

2

3

4

5

6

7

8

9

If 5 is the pixel in question, it’s shower index is calculated as:

\[\begin{split}( &|1-2| + |2-3| + |4-5| + |5-6| + |7-8| + |8-9| + \\ &|1-4| + |4-7| + |2-5| + |5-8| + |3-6| + |6-9| ) / 12.\end{split}\]

then, the upper line of the sum would be diffx (DIFFerences in X-direction), the lower line would be diffy (DIFFerences in Y-direction) in the code below.

Parameters
  • z (numpy.ndarray) – Corresponds to reflectivity Z in mm**6/m**3 ND-array, at least 2D

  • polar (bool) – defaults to True for polar data, False for cartesian data.

  • shower (bool) – output shower index, defaults to True

Returns

  • r (numpy.ndarray) – r - array of shape z.shape - calculated rain rates

  • si (numpy.ndarray) – si - array of shape z.shape - calculated shower index for control purposes. May be omitted in later versions

class wradlib.zr.ZRMethods(obj)[source]#

Bases: XarrayMethods

wradlib xarray SubAccessor methods for zr.

z_to_r(**kwargs)[source]#

Conversion from reflectivities to rain rates.

Calculates rain rates from radar reflectivities using a power law Z/R relationship Z = a*R**b

Parameters

obj (xarray.DataArray) – Corresponds to reflectivity Z in mm**6/m**3

Keyword Arguments
  • a (float) – Parameter a of the Z/R-relationship Standard value according to Marshall-Palmer is a=200., b=1.6

  • b (float) – Parameter b of the Z/R-relationship Standard value according to Marshall-Palmer is b=1.6

Note

The German Weather Service uses a=256 and b=1.42 instead of the Marshall-Palmer defaults.

Returns

output (xarray.DataArray) – rainfall intensity in mm/h

r_to_z(**kwargs)[source]#

Calculates reflectivity from rain rates using a power law Z/R relationship Z = a*R**b

Parameters
  • obj (xarray.DataArray) – Corresponds to rainfall intensity in mm/h

  • a (float) – Parameter a of the Z/R-relationship Standard value according to Marshall-Palmer is a=200., b=1.6

  • b (float) – Parameter b of the Z/R-relationship Standard value according to Marshall-Palmer is b=1.6

Note

The German Weather Service uses a=256 and b=1.42 instead of the Marshall-Palmer defaults.

Returns

output (xarray.DataArray) – reflectivity in mm**6/m**3

z_to_r_enhanced(**kwargs)[source]#

Calculates rainrates from radar reflectivities using the enhanced three-part Z-R-relationship used by the DWD (as of 2009)

To be used with polar representations so that one dimension is cyclical. i.e. z should be of shape (nazimuths, nbins) –> the first dimension is the cyclical one. For DWD DX-Data z’s shape is (360,128).

Neighborhood-means are taken only for available data via fast convolution sums. Refer to the RADOLAN final report or the RADOLAN System handbook for details on the calculations. Basically, for low reflectivities an index called the shower index is calculated as the mean of the differences along both axis in a neighborhood of 3x3 pixels. This means:

x-direction –>

y
l
d
i
r

1

2

3

4

5

6

7

8

9

If 5 is the pixel in question, it’s shower index is calculated as:

\[\begin{split}( &|1-2| + |2-3| + |4-5| + |5-6| + |7-8| + |8-9| + \\ &|1-4| + |4-7| + |2-5| + |5-8| + |3-6| + |6-9| ) / 12.\end{split}\]

then, the upper line of the sum would be diffx (DIFFerences in X-direction), the lower line would be diffy (DIFFerences in Y-direction) in the code below.

Parameters

obj (xarray.DataArray) – Corresponds to reflectivity Z in mm**6/m**3 ND-array, at least 2D

Keyword Arguments

shower (bool) – output shower index, defaults to True

Returns