radarx.retrieve.tracking.track_cells#
- radarx.retrieve.tracking.track_cells(cells, *, motion=None, min_overlap=0.3, max_speed=None, dt=None, min_lifetime=1, n_threads=None, engine='auto')[source]#
Track the storm cells of a sequence of volumes by their overlap.
See
radarx.retrieve.trackingfor the method (Feng et al. 2023).- Parameters:
cells (
xarray.Datasetorxarray.DataArray) – The cell numbers of every volume on(time, y, x): the result ofidentify_cells()(CELL_LABEL) or any integer labels, 0 for none.motion (
tuple,xarray.DatasetorNone, optional) – Storm motion(u, v)in m/s (eastward, northward) by which the cells of a volume are moved before the overlap is counted: a pair of numbers, or a dataset withuandvthat are scalars, have one value per time (per volume or per interval) or a field on(y, x)(and time), asestimate_motion()gives. Default: none.min_overlap (
float, optional) – Smallest overlap area, as a fraction of the area of either cell, for a link. Default 0.3, the value that Feng et al. (2023) use with advected cells.max_speed (
float, optional) – Largest speed (m/s) for linking cells that do not overlap: a cell without any link is linked to the nearest cell without a link within this speed times the interval of the position that the motion predicts. DefaultNone: no such links.dt (
floator sequence offloat, optional) – Seconds between volumes, if the cells have notimecoordinate.min_lifetime (
int, optional) – Shortest track to keep, in volumes. Default 1 (all tracks).n_threads (
int, optional) – Threads for the compiled kernels. Default: all cores.engine (
{"auto", "compiled", "numpy"}, optional) – Implementation to use."auto"(default) prefers the compiled kernels and falls back to NumPy.
- Returns:
xarray.Dataset–CELL_IDon(time, y, x)(the track of the cell at a grid point, 0 for none) and, on the dimensioncell(the track numbers from 1):cell_first_time,cell_last_time,cell_lifetime(number of volumes),cell_split_fromandcell_merged_into(track numbers, 0 for none); on(cell, time):cell_area(km2),cell_xandcell_y(m, the centre of the cell),cell_uandcell_v(m/s, from the change of position between volumes) - NaN where the track is absent.- Raises:
ValueError – For an unknown
engine, cells without the dimensionstime,yandx, a motion or adtthat does not fit the volumes, or no time step when the motion ormax_speedneeds one.TypeError – If
motionis not a pair or a dataset.
Notes
Dask. This function computes the dask array: a track runs through all volumes, so that the cells of every volume are needed. The input is loaded into memory and the result is held in memory.
See also
identify_cells,cell_statistics,estimate_motionReferences
Feng, Z., J. Hardin, H. C. Barnes, J. Li, L. R. Leung, A. Varble, and Z. Zhang, 2023: PyFLEXTRKR: a flexible feature tracking Python software for convective cloud analysis. Geosci. Model Dev., 16, 2753-2776, https://doi.org/10.5194/gmd-16-2753-2023
Heikenfeld, M., P. J. Marinescu, M. Christensen, D. Watson-Parris, F. Senf, S. C. van den Heever, and P. Stier, 2019: tobac 1.2: towards a flexible framework for tracking and analysis of clouds in diverse datasets. Geosci. Model Dev., 12, 4551-4570, https://doi.org/10.5194/gmd-12-4551-2019
Examples
>>> tracks = radarx.retrieve.track_cells(cells, motion=(12.0, 5.0)) >>> tracks.cell_lifetime