reduce_point_density#

metpy.calc.reduce_point_density(points, radius, priority=None)[source]#

Return a mask to reduce the density of points in irregularly-spaced data.

This function is used to down-sample a collection of scattered points (e.g. surface data), returning a mask that can be used to select the points from one or more arrays (e.g. arrays of temperature and dew point). The points selected can be controlled by providing an array of priority values (e.g. rainfall totals to ensure that stations with higher precipitation remain in the mask). The points and radius can be specified with units. If none are provided, meters are assumed.

Points with at least one non-finite (i.e. NaN or Inf) value are ignored and returned with a value of False (meaning don’t keep).

Parameters:
  • points ((N, M) array-like) – N locations of the points in M dimensional space

  • radius (pint.Quantity or float) – Minimum radius allowed between points. If units are not provided, meters is assumed.

  • priority ((N, M) array-like, optional) – If given, this should have the same shape as points; these values will be used to control selection priority for points.

Returns:

  • (N,) array-like of boolean values indicating whether points should be kept. This

  • can be used directly to index numpy arrays to return only the desired points.

Examples

>>> metpy.calc.reduce_point_density(np.array([1, 2, 3]), 1.)
array([ True, False, True])
>>> metpy.calc.reduce_point_density(np.array([1, 2, 3]), 1.,
... priority=np.array([0.1, 0.9, 0.3]))
array([False, True, False])

Examples using metpy.calc.reduce_point_density#

Mesonet Station Plot

Mesonet Station Plot

Station Plot

Station Plot