stilt.observations.plumes.kernel_density#

stilt.observations.plumes.kernel_density(longitudes, latitudes, *, bandwidth=(0.1, 0.15), n=100)[source]#

Return the Gaussian kernel density of points on an n by n grid.

As in R’s MASS::kde2d, the kernel’s standard deviation is a quarter of bandwidth in each direction, so the defaults give 0.025° in longitude and 0.0375° in latitude. The grid spans the points plus one bandwidth on every side. The density is scaled to a maximum of 1.

Parameters:
  • longitudes (TypeAliasType) – Point positions, in degrees. Non-finite positions are dropped.

  • latitudes (TypeAliasType) – Point positions, in degrees. Non-finite positions are dropped.

  • bandwidth (tuple[float, float]) – Bandwidth in longitude and latitude, in degrees.

  • n (int) – Number of grid points in each direction.

Returns:

Density on lat and lon.

Return type:

DataArray