You are viewing the latest unreleased documentation 3.10.0.dev14. You can switch to a stable version.


Various utilities related to geometric operations.


This module requires shapely.

iris.analysis.geometry.geometry_area_weights(cube, geometry, normalize=False)[source]#

Return the array of weights corresponding to the area of overlap.

Return 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.


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.


This routine currently does not handle all out-of-bounds 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.


This function does not maintain laziness when called; it realises data. See more at Real and Lazy Data.

  • cube (iris.cube.Cube) – A Cube containing a bounded, horizontal grid definition.

  • geometry (shapely geometry instance) – The geometry of interest. To produce meaningful results this geometry must have a non-zero area. Typically a Polygon or MultiPolygon.

  • normalize (bool, default=False) – 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.