radarx.retrieve.lagrangian.trajectories#
- radarx.retrieve.lagrangian.trajectories(winds, time=None, *, direction='backward', start=None, levels=None, dt=20.0, iterations=3, max_steps=None, storm_motion=None, extend=0.0, extend_before=None, extend_after=None, surface_downdraft=True, termination=True, boundary='environment', parameters=None, u='u', v='v', w='w', dbz='auto', valid=None, environment_mask=None, n_threads=None, engine='auto')[source]#
Backward or forward air trajectories through a time series of 3-D winds.
- Parameters:
winds (
xarray.Dataset) – Winds on(time, z, y, x)(any order;timemay be absent for a single analysis used withstorm_motionandextend), with coordinatesx,y(m, increasing) andz(m, increasing; the lowest level is the ground), e.g. a time series ofradarx.retrieve.multi_doppler()analyses joined withxr.concat(..., "time"). Ground-relative winds in m s-1.time (
datetime-like, optional) – Analysis time at which the trajectories start. Default: the last wind time for backward and the first for forward trajectories. It need not be one of the wind times.direction (
{"backward", "forward"}, optional) – Integration direction. Default"backward".start (
xarray.Datasetordict, optional) – Start points asx,y,zarrays (m) of the same shape. Default: every grid point (those oflevels), with points of the lowest level started at the offset height above it.levels (sequence of
int, optional) – Grid level indices to start from whenstartis not given. Default: all levels.dt (
float, optional) – Time step in s. Default 20 (Z13a [1], sect. 2b, p. 2250).iterations (
int, optional) – Corrector iterations per step. Default 3 (Z13a [1], sect. 2b; Z07 [3], p. 2422).max_steps (
int, optional) – Maximum number of steps. Default: enough to reach the end of the wind time series (plusextend).storm_motion (
(float,float),xarray.Datasetor"estimate", optional) – Constant storm motion \((c_x, c_y)\) in m s-1 with which every analysis is moved between its time and the parcel time: a pair, the domain-wide output ofradarx.retrieve.estimate_motion()(u,v), or"estimate"to estimate it withradarx.retrieve.estimate_motion()from the reflectivity of the first and last wind times. Default: no motion (fixed analyses).extend (
floator(float,float), optional) – Seconds by which the series is extended before the first and after the last analysis by moving those analyses withstorm_motion(time morphing, Z13b [2], sect. 2c, p. 2268). Default 0.extend_before, extend_after (
float, optional) – Seconds of time morphing before the first and after the last analysis; override the corresponding part ofextend. For backward trajectoriesextend_beforelets parcels of an air mass older than the wind series (e.g. a squall-line cold pool) reach the environment.surface_downdraft (
bool, optional) – Replace the vertical velocity at the ground with the parameterised surface downdraft (Z13a [1], eqs. 2-3, p. 2251). Default True.termination (
{True, "ziegler2013", "precipitation", False}, optional) – Environment test of backward trajectories.Trueor"ziegler2013"(default): the tests of Z13a [1] (sect. 2a, p. 2250)."precipitation": the parcel is outside precipitation (\(Z_H\) belowenv_dbzforenv_dbz_stepssteps) and either abovecold_pool_depthor whereenvironment_maskis true (e.g. ahead of the gust front); see the module documentation.False: no test (trajectories run tomax_stepsor the data).boundary (
stror sequence ofstr, optional) – Which exits through a lateral boundary count as reaching the environment (backward trajectories with a termination test)."environment"(default, Z13a [1], sect. 2a, test iii): every exit."environment_mask": only whereenvironment_maskis true at the last point inside the domain."no_echo": only where the reflectivity there is belowenv_dbzor the mask is true. A sequence of sides ("west","east","south","north"; the domain edges at the smallest and largestxandy): only exits through those sides. Other exits stop the trajectory with flag 128 and are not environmental.parameters (
dict, optional) – Overrides ofTRAJECTORY_DEFAULTS(sources of every default are listed there):offset_height(m),wmix0,wmix1(m s-1),z0_dbz,zddc_dbz(dBZ),min_steps,env_dbz(dBZ),env_w(m s-1),env_w_steps,env_dbz_steps,cold_pool_depth(m above the ground) anddbz_floor(dBZ given to missing reflectivity).u, v, w (
str, optional) – Names of the wind components. Default"u","v","w".dbz (
strorNone, optional) – Reflectivity (dBZ) variable,"auto"(default: the first ofDBZ,DBZH,reflectivity,corrected_reflectivity,dbz) or None (not used; the reflectivity test of the environment is then never met).valid (
strorxarray.DataArray, optional) – True (non-zero) where the winds are analysed, e.g."dd_valid"ofradarx.retrieve.multi_doppler()output, and false where they are a background or filled. Interpolated to the parcels; the fraction of trajectory points with a value of at least 0.5 is returned asvalid_fraction. Default: all valid.environment_mask (
strorxarray.DataArray, optional) – True where a parcel may count as environmental fortermination="precipitation"belowcold_pool_depth(e.g. the air ahead of the gust front). Default: nowhere.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(trajectory, step):x,y,z(m),time(datetime64),u,v,w(m s-1,wwith the surface downdraft),reflectivity(dBZ) andvalid(0-1) at every point (NaN after the end); ontrajectory:n_points,valid_fraction,flags(bit mask, see the module documentation),environment(True where the trajectory reached the storm environment or a lateral boundary) and the start pointstart_x,start_y,start_z(plus the grid indicesk,j,ifor gridpoint trajectories).
Notes
Dask. This function computes the dask array: it follows trajectories through the winds of all times. The input is loaded into memory and the result is held in memory.
References
[1] Ziegler, C. L., 2013a: A diabatic Lagrangian technique for the analysis of convective storms. Part I: Description and validation via an observing system simulation experiment. J. Atmos. Oceanic Technol., 30 (10), 2248-2265, https://doi.org/10.1175/JTECH-D-12-00194.1
[2] Ziegler, C. L., 2013b: A diabatic Lagrangian technique for the analysis of convective storms. Part II: Application to a radar-observed storm. J. Atmos. Oceanic Technol., 30 (10), 2266-2280, https://doi.org/10.1175/JTECH-D-13-00036.1
[3] Ziegler, C. L., M. S. Buban, and E. N. Rasmussen, 2007: A Lagrangian objective analysis technique for assimilating in situ observations with multiple-radar-derived airflow. Mon. Wea. Rev., 135 (7), 2417-2442, https://doi.org/10.1175/MWR3396.1
Examples
>>> import numpy as np, xarray as xr >>> from radarx.retrieve import trajectories >>> c = np.arange(0.0, 10001.0, 1000.0) >>> t = np.array(["2022-03-30T23:00", "2022-03-30T23:10"], "datetime64[ns]") >>> ds = xr.Dataset( ... {k: (("time", "z", "y", "x"), np.full((2, 11, 11, 11), val)) ... for k, val in (("u", 5.0), ("v", 0.0), ("w", 0.0))}, ... coords={"time": t, "z": c, "y": c, "x": c}) >>> tr = trajectories(ds, start={"x": [8000.0], "y": [5000.0], "z": [3000.0]}, ... dbz=None) >>> float(tr.x.isel(step=int(tr.n_points[0]) - 1)[0]) 5000.0