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.tracking for the method (Feng et al. 2023).

Parameters:
  • cells (xarray.Dataset or xarray.DataArray) – The cell numbers of every volume on (time, y, x): the result of identify_cells() (CELL_LABEL) or any integer labels, 0 for none.

  • motion (tuple, xarray.Dataset or None, 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 with u and v that are scalars, have one value per time (per volume or per interval) or a field on (y, x) (and time), as estimate_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. Default None: no such links.

  • dt (float or sequence of float, optional) – Seconds between volumes, if the cells have no time coordinate.

  • 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_ID on (time, y, x) (the track of the cell at a grid point, 0 for none) and, on the dimension cell (the track numbers from 1): cell_first_time, cell_last_time, cell_lifetime (number of volumes), cell_split_from and cell_merged_into (track numbers, 0 for none); on (cell, time): cell_area (km2), cell_x and cell_y (m, the centre of the cell), cell_u and cell_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 dimensions time, y and x, a motion or a dt that does not fit the volumes, or no time step when the motion or max_speed needs one.

  • TypeError – If motion is 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_motion

References

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