radarx.retrieve.tracking.identify_cells#

radarx.retrieve.tracking.identify_cells(obj, field=None, *, thresholds, min_area=10.0, segmentation_threshold=None, smooth=None, connectivity=8, n_threads=None, engine='auto')[source]#

Storm cells of every volume of a grid: multi-threshold features and watershed.

See radarx.retrieve.tracking for the method (Heikenfeld et al. 2019).

Parameters:
  • obj (xarray.DataArray or xarray.Dataset) – The field (DataArray) or a dataset with it, on the horizontal dimensions y and x (m) with any leading (time) dimensions. A vertical dimension (z, altitude, height or level) is reduced to its maximum, the composite.

  • field (str, optional) – Name of the field in a dataset. Default: the first of DBZH, DBZ, reflectivity and corrected_reflectivity.

  • thresholds (sequence of float) – Thresholds of the field in ascending order, for example (30, 40, 50) dBZ. A cell is found at the highest threshold it reaches.

  • min_area (float, optional) – Smallest area (km2) of a region above a threshold. Default 10.

  • segmentation_threshold (float, optional) – Value of the field down to which a cell extends. Default: the lowest threshold; it cannot be higher.

  • smooth (float, optional) – Width (standard deviation, grid cells) of a Gaussian filter that is applied to the field first. Default None: none. A missing value counts as a value below the lowest threshold.

  • connectivity ({4, 8}, optional) – Whether grid points that touch at a corner are connected. Default 8.

  • 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_LABEL (the number of the cell at every grid point, 0 for none, numbered from 1 in every volume in the raster order of the first point of its feature) and CELL_COUNT (the number of cells per volume).

Raises:
  • ValueError – For an unknown engine, thresholds that are not ascending, a segmentation_threshold above the lowest threshold, a connectivity that is not 4 or 8 or a field without the dimensions y and x.

  • KeyError – If the field is not found.

Notes

Dask and extra dimensions. The fields may have extra leading dimensions (for example time or volume): each sweep is processed on its own and the result has the same extra dimensions. Dask arrays stay lazy: the result is a dask array and nothing is computed until it is (the sweep dimensions are rechunked into one chunk).

References

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

>>> cells = radarx.retrieve.identify_cells(grid, thresholds=(30, 40, 50))
>>> cells.CELL_COUNT