stilt.geometry.overlap_weights#
- stilt.geometry.overlap_weights(geometry, x_centers, y_centers, xres, yres, crs, *, backend='auto')[source]#
Sparse
(n_cells, ny * nx)fraction of each raster cell inside each cell.The raster is described by its cell-centre axes, resolution and CRS; its cells are flattened y-outer / x-inner (the order of
data.transpose("time", y, x).reshape(nt, -1)).geometryis reprojected to the raster CRS when needed. Results are cached on the (raster, geometry, backend) triple so repeated aggregations are a single matmul.Polygon overlaps (
Mesh, andGridin another CRS) use exactextract when it is installed (backend="auto", roughly 100x faster on large rasters) and fall back to shapely otherwise. It is not a dependency;pip install exactextractenables it. Both backends give the same fractions.