radarx.retrieve.ducts.ducting_layers#
- radarx.retrieve.ducts.ducting_layers(profile, *, radar_height=None, max_layers=4, min_deficit=0.0, earth_radius=6371000.0, form='bean_dutton', n_threads=None, engine='auto')[source]#
Layers of a refractivity profile that trap the radar beam.
A trapping layer is a run of levels where the modified refractivity decreases with height; its angle of penetration is the elevation below which a ray is trapped. The equations, the choices of radarx and the limits are in
radarx.retrieve.ducts.- Parameters:
profile (
xarray.Datasetorxarray.DataArray) – Refractivity on aheightcoordinate (m above sea level, strictly ascending): a DataArray in N-units, or a Dataset withrefractivityor withpressure(Pa),temperature(K) and water vapour, seeradarx.retrieve.modified_refractivity(). Any other dimensions (time, station, latitude, longitude) are batch dimensions: every profile is searched on its own. Levels with NaN are left out of their profile. Not changed. A dask-backed input gives a lazy result.radar_height (
float, optional) – Height of the radar (m above sea level). Fillsradar_trapping_anglefor the layers that contain the radar.max_layers (
int, optional) – Number of layers kept per profile, lowest first. Default 4.min_deficit (
float, optional) – Layers whose M-deficit is not above this value (M-units) are left out. Default 0.earth_radius (
float, optional) – Radius of the Earth (m). Default: the radarx value.form (
str, optional) – Formula of the refractivity from the thermodynamic variables.n_threads (
int, optional) – Threads of the compiled kernel. Default: all cores.engine (
{"auto", "compiled", "numpy"}, optional) – Implementation."auto"(default) prefers the compiled kernel.
- Returns:
xarray.Dataset– On the batch dimensions ofprofilewith alayerdimension (0 for the lowest layer; NaN for unused slots):layer_base,layer_top,layer_thickness(m),m_deficit(M-units),trapping_angleandradar_trapping_angle(degrees),surface_based(1 or 0), andlayer_count, the number of layers found, which can exceedmax_layers.- Raises:
ValueError – For a profile without a
heightcoordinate or with heights that are not ascending,max_layersbelow 1, a negativemin_deficit, anearth_radiusthat is not positive or an unknownengine.TypeError – If
profileis not an xarray object.ImportError – If
engine="compiled"and the kernel is not available.
Notes
Source: Bean and Dutton (1966), see the module documentation. The wavelength of the radar is not taken into account.
Dask. Dask arrays stay lazy: the result is a dask array and nothing is computed until it is.
References
Examples
>>> import numpy as np, xarray as xr >>> h = np.array([0.0, 100.0, 1000.0]) >>> n = xr.DataArray([330.0, 280.0, 250.0], dims="height", coords={"height": h}) >>> out = ducting_layers(n) >>> int(out.layer_count), float(out.layer_top.isel(layer=0)) (1, 100.0)