radarx.retrieve.lightning.cell_flash_rate#

radarx.retrieve.lightning.cell_flash_rate(obj, mask, *, interval='1min', time_edges=None, z=None, count='initiation', max_offset=None, background=0, latitude=None, longitude=None, min_sources=10, distance=3000.0, time=0.15, n_threads=None, engine='auto')[source]#

Flash rates and source height distributions of tracked storm cells.

Parameters:
  • obj (xarray.Dataset) – LMA sources (radarx.io.read_lma()), with or without flashes.

  • mask (xarray.DataArray) – Integer cell labels on (time, y, x) (e.g. a tracked-storm segmentation on a radarx grid; the same label is the same cell at all times), with x/y in metres east and north of the origin. background (and negative or NaN values) mark no cell. Each source is attributed to the mask frame nearest in time.

  • interval (str or timedelta, optional) – Length of the flash-rate intervals. Default "1min".

  • time_edges (array-like of datetime64, optional) – Explicit interval edges. Default: intervals covering the mask times.

  • z (array-like, optional) – Height bin centres (m above mean sea level) for the source counts by height (vertical source distribution of every cell).

  • count ({"initiation", "extent"}, optional) – Count a flash in the cell of its first source (default) or in every cell any of its sources falls in. A flash is counted in the interval of its first source.

  • max_offset (str or timedelta, optional) – Largest time difference between a source and its mask frame. Default: half the median spacing of the mask times.

  • background (int, optional) – Label of no cell. Default 0.

  • latitude, longitude (float, optional) – Origin of x/y, if the mask does not give it (coordinates latitude/longitude, origin_latitude/origin_longitude or crs_wkt).

  • min_sources, distance, time, engine, n_threads – As in grid_lightning().

Returns:

xarray.Dataset – flash_count and flash_rate (flashes min-1) on (cell, time), and with z the source_count on (cell, time, z); cell holds the mask labels.

Notes

Flashes, min_sources and the clustering scales are as in cluster_flashes() and grid_lightning() (Fuchs et al. 2016; Schultz et al. 2011, with their references there). The 1-min interval, the nearest-frame attribution of sources and the default max_offset (half the median mask spacing, or 150 s for a single frame) are radarx choices without a published source. Flash rates of tracked cells are the input of lightning_jump() (Schultz et al. 2009, 2011, 2016).

Dask. This function computes the dask array: the cells are tracked through all times. The input is loaded into memory and the result is held in memory.