raster_tools.focal.get_focal_window#

raster_tools.focal.get_focal_window(width_or_radius, height=None)[source]#

Get a rectangle, circle, or annulus focal window.

A rectangle window is simply a NxM grid of True values. A circle window is a grid with a centered circle of True values surrounded by False values. The circle extends to the edge of the grid. An annulus window is the same as a circle window but has a nested circle of False values inside the main circle.

Parameters
  • width_or_radius (int or 2-tuple of ints) – If an int and height is None, specifies the radius of a circle window. If an int and height is also an int, specifies the width of a rectangle window. If a 2-tuple of ints, the values specify the inner and outer radii of an annulus window.

  • height (int or None) – If None (default), width_or_radius will be used to construct a circle or annulus window. If an int, specifies the height of a rectangle window.

Returns

window – A focal window containing bools with the specified pattern.

Return type

ndarray