radarx.fundamentals.refraction.trace_rays#
- radarx.fundamentals.refraction.trace_rays(range_m, elevation_deg, height, refractivity, *, radar_height=0.0, step=100.0, earth_radius=6371000.0, n_threads=None, engine='auto')[source]#
Beam height and ground range of range gates from a refractivity profile.
Integrates the ray equations of
radarx.fundamentals.refraction(Snell’s law in a spherically stratified atmosphere) for every elevation and returns the ray at the range gates. It replacesbeam_center_height()andground_range()where the refractivity profile is known.- Parameters:
range_m (
float, array-like orxarray.DataArray) – Gate ranges along the ray (path length) in m, one-dimensional (the dimension of a DataArray is renamedrange). Sorted internally.elevation_deg (
float, array-like orxarray.DataArray) – Elevation of the beam at the radar in degrees: a number, a one-dimensional array (dimensionray) or a DataArray of any dimensions (for example the elevation of every ray of a sweep). NaN gives NaN. Dask arrays give a lazy result.height (array-like) – Heights of the levels of the profile in m above sea level (same reference as
radar_height), at least two, distinct.refractivity (array-like) – Radio refractivity N in N-units at the levels (see
radarx.io.sounding.refractivity()). The refractive index is1 + 1e-6 N, linear between the levels and constant below and above them.radar_height (
float, optional) – Height of the radar above sea level (m). Default 0.step (
float, optional) – Longest path step of the integration (m). Default 100. Steps end at the levels of the profile; with the sharp inversion of the tests the height at 250 km range changes by less than 0.1 mm between steps of 100 m and 2 m.earth_radius (
float, optional) – Radius of the spherical Earth (m). Default the radarx value 6371 km (radarx.fundamentals.constants.EARTH_RADIUS).n_threads (
int, optional) – Threads of the compiled kernel (per call; each dask chunk is one call). Default: all cores.engine (
{"auto", "compiled", "numpy"}, optional) – Implementation."auto"(default) prefers the compiled kernel.
- Returns:
xarray.Dataset–beam_height(m above sea level),ground_range(m, distance on the ground at sea level,atimes the central angle) andgate_elevation(degrees, the elevation of the ray at the gate), on the dimensions of the elevation andrange. The inputs are not changed.- Raises:
ValueError – For a profile with fewer than two levels, repeated heights or a refractivity of more than 2000 N-units in magnitude, a non-positive
stepor an unknownengine.ImportError – If
engine="compiled"and the kernel is not available.
Notes
The equations are those of Bean and Dutton [1] (Eqs. 1.27 and 3.1); the discretisation (Runge-Kutta in the path length), the constant refractive index outside the profile and the handling of the surface are radarx choices, see the module documentation.
References
Examples
>>> import numpy as np >>> h = np.arange(0.0, 10001.0, 500.0) >>> ray = trace_rays(np.arange(1e3, 200e3, 1e3), 0.5, h, 313.0 - 39.2e-3 * h) >>> float(ray.beam_height.isel(range=-1)) > 1000.0 True