iris.analysis.geometry¶
Various utilities related to geometric operations.
Note
This module requires shapely
.
In this module:

iris.analysis.geometry.
geometry_area_weights
(cube, geometry, normalize=False)¶ Returns the array of weights corresponding to the area of overlap between the cells of cube’s horizontal grid, and the given shapely geometry.
The returned array is suitable for use with
iris.analysis.MEAN
.The cube must have bounded horizontal coordinates.
Note
This routine works in Euclidean space. Area calculations do not account for the curvature of the Earth. And care must be taken to ensure any longitude values are expressed over a suitable interval.
Note
This routine currently does not handle all outofbounds cases correctly. In cases where both the coordinate bounds and the geometry’s bounds lie outside the physically realistic range (i.e., abs(latitude) > 90., as it is commonly the case when bounds are constructed via guess_bounds()), the weights calculation might be wrong. In this case, a UserWarning will be issued.
Args:
 cube (
iris.cube.Cube
):  A Cube containing a bounded, horizontal grid definition.
 cube (
 geometry (a shapely geometry instance):
 The geometry of interest. To produce meaningful results this geometry must have a nonzero area. Typically a Polygon or MultiPolygon.
Kwargs:
 normalize:
 Calculate each individual cell weight as the cell area overlap between the cell and the given shapely geometry divided by the total cell area. Default is False.