radarx.retrieve.lightning.grid_lightning#

radarx.retrieve.lightning.grid_lightning(obj, grid=None, *, x=None, y=None, z=None, interval='5min', time_edges=None, latitude=None, longitude=None, min_sources=10, distance=3000.0, time=0.15, n_threads=None, engine='auto')[source]#

Source, flash extent and flash initiation densities on a radarx grid.

Parameters:
  • obj (xarray.Dataset) – LMA sources (radarx.io.read_lma()), with or without flashes; if it has none, cluster_flashes() groups them first with distance and time.

  • grid (xarray.Dataset, optional) – A radarx grid (e.g. from radarx.grid.grid_cones()) whose x, y (and, with z=True, z) coordinates and origin (latitude/longitude coordinates or the crs_wkt projection) define the grid.

  • x, y (array-like, optional) – Grid box centres east and north of the origin (m, azimuthal equidistant), instead of or overriding those of grid.

  • z (array-like or bool, optional) – Heights above mean sea level (m) of 3-D grid boxes; True takes grid.z. Default: count whole columns.

  • interval (str or timedelta, optional) – Length of the time intervals, aligned to multiples of it. Default "5min".

  • time_edges (array-like of datetime64, optional) – Explicit time interval edges instead of interval.

  • latitude, longitude (float, optional) – Origin of x/y, if the grid does not give it.

  • min_sources (int, optional) – Flashes with fewer sources are left out of the flash products. Default 10, the minimum number of VHF sources per flash required by Schultz et al. (2011) [2] (section 2b, p. 747) to remove spurious noise points; Fuchs et al. (2016) [1] (p. 8629) describe such a threshold on the number of points as customary.

  • distance, time (float, optional) – Clustering scales if obj has no flashes (see cluster_flashes(), which also states how the flashes relate to Fuchs et al. 2016).

  • n_threads (int, optional) – Threads for the compiled kernel. Default: all cores.

  • engine ({"auto", "compiled", "numpy"}, optional) – Implementation to use. Default "auto".

Returns:

xarray.Dataset – source_density, flash_extent_density and flash_initiation_density (counts per grid box and interval) on (time, [z,] y, x), with the time interval centres and time_bounds, lat/lon axis coordinates and the origin.

Notes

Flash extent density counts the flashes with at least one source in a grid box; the product is attributed to Bruning and MacGorman (2013) [3], not checked against the paper. The 5-min default interval, the box edges midway between grid centres and the azimuthal equidistant projection of the sources about the grid origin are radarx choices.

Dask. This function computes the dask array: the densities are summed over all sources. The input is loaded into memory and the result is held in memory.

References

Examples

>>> lma = radarx.io.read_lma(files, max_chi2=1.0, min_stations=6)
>>> fed = grid_lightning(lma, grid, interval="2min")