Various utilities related to geometric operations.
This module requires
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
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.
- 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 non-zero area. Typically a Polygon or MultiPolygon.
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.