circular_footprint#

rojak.atmosphere.regions.circular_footprint(radius)[source]#

Create a circular boolean footprint for use with scipy morphological filters.

Parameters:

radius (int) – Radius of the circle in grid points.

Returns:

A boolean NumPy ndarray of shape (2*radius+1, 2*radius+1) where True values represent points within the circle.

Return type:

numpy.ndarray

Raises:

ValueError – If radius is \(\leq 0\).

Example: >>> footprint = circular_footprint(radius=2) >>> footprint.astype(int) array([[0, 0, 1, 0, 0],

[0, 1, 1, 1, 0], [1, 1, 1, 1, 1], [0, 1, 1, 1, 0], [0, 0, 1, 0, 0]])