Data Quality#

This module will serve two purposes:

  1. provide routines to create simple radar data quality related fields.

  2. provide routines to decide which radar pixel to choose based on the competing information in different quality fields.

Data is supposed to be stored in ‘aligned’ arrays. Aligned here means that all fields are structured such that in each field the data for a certain index is representative for the same physical target.

Therefore, no assumptions are made on the dimensions or shape of the input fields except that they exhibit the numpy ndarray interface.

pulse_volume

beam_block_frac

Partial beam blockage fraction.

cum_beam_block_frac

Cumulative beam blockage fraction along a beam.

get_bb_ratio

QualMethods

wradlib xarray SubAccessor methods for Qual Methods.

wradlib.qual.pulse_volume(*args, **kwargs)[source]#
wradlib.qual.pulse_volume(ranges: ndarray, h, theta)
wradlib.qual.pulse_volume(obj: DataArray, h, theta, **kwargs)
wradlib.qual.beam_block_frac(th, bh, a)[source]#

Partial beam blockage fraction.

Note

Code was migrated from nguy/PyRadarMet.

From Bech et al. (2003), Eqn 2 and Appendix

Parameters
Returns

pbb (float or numpy.ndarray) – Partial beam blockage fraction [unitless]

Examples

>>> pbb = beam_block_frac(th,bh,a) 

See Beam Blockage Calculation using a DEM.

Note

This procedure uses a simplified interception function where no vertical gradient of refractivity is considered. Other algorithms treat this more thoroughly. However, this is accurate in most cases other than the super-refractive case.

See the half_power_radius function to calculate variable a.

The heights must be the same units!

wradlib.qual.cum_beam_block_frac(pbb)[source]#

Cumulative beam blockage fraction along a beam.

Computes the cumulative beam blockage (cbb) along a beam from the partial beam blockage (pbb) fraction of each bin along that beam. CBB in one bin along a beam will always be at least as high as the maximum PBB of the preceeding bins.

Parameters

pbb (numpy.ndarray) – 2-D array of floats of shape (num beams, num range bins) Partial beam blockage fraction of a bin along a beam [m]

Returns

cbb (numpy.ndarray) – Array of floats of the same shape as pbb Cumulative partial beam blockage fraction [unitless]

Examples

>>> pbb = beam_block_frac(th, bh, a) 
>>> cbb = cum_beam_block_frac(pbb) 

See Beam Blockage Calculation using a DEM.

wradlib.qual.get_bb_ratio(*args, **kwargs)[source]#
wradlib.qual.get_bb_ratio(bb_height: ndarray, bb_width, quality, zp_r)
wradlib.qual.get_bb_ratio(obj: Dataset)
class wradlib.qual.QualMethods(obj)[source]#

Bases: XarrayMethods

wradlib xarray SubAccessor methods for Qual Methods.

pulse_volume(h, theta, **kwargs)[source]#

Calculates the sampling volume of the radar beam per bin depending on range and aperture.

We assume a cone frustum which has the volume \(V=(\pi/3) \cdot h \cdot (R^2 + R \cdot r + r^2)\). R and r are the radii of the two frustum surface circles. Assuming that the pulse width is small compared to the range, we get \(R=r= \tan ( 0.5 \cdot \theta \cdot \pi/180 ) \cdot range\) with theta being the aperture angle (beam width). Thus, the pulse volume simply becomes the volume of a cylinder with \(V=\pi \cdot h \cdot range^2 \cdot \tan( 0.5 \cdot \theta \cdot \pi/180)^2\)

Parameters

obj (xarray.DataArray | xarray.Dataset)

Keyword Arguments
  • h (float) – pulse width (which corresponds to the range resolution [m])

  • theta (float) – the aperture angle (beam width) of the radar beam [degree]

Returns

obj (xarray.Dataset) – obj with volumes of radar bins at each range in ranges [\(m^3\)].

Examples

See Recipe #1: Clutter and attenuation correction plus composition for two DWD radars.

get_bb_ratio()[source]#

Returns the Bright Band ratio of each PR bin

With SR, we refer to precipitation radars based on space-born platforms such as TRMM or GPM.

This function basically applies the Bright Band (BB) information as provided by the corresponding SR datasets per beam, namely BB height and width, as well as quality flags of the SR beams. A BB ratio of <= 0 indicates that a bin is located below the melting layer (ML), >=1 above the ML, and in between 0 and 1 inside the ML.

Parameters

obj (xarray.DataArray | xarray.Dataset)

Returns

obj (xarray.Dataset) – obj with bb ratio and boolean array containing the indices of SR bins connected to the BB.