xarray.DataArray.xvec.summarize_geometry

xarray.DataArray.xvec.summarize_geometry#

DataArray.xvec.summarize_geometry(dim, geom_array=None, aggfunc='envelope', **kwargs)#

Summarize the geometry of an variable geometry along a specified dimension.

Given a DataArray of variable geometry, summary geometry captures the overall spatial extent of a series of individual geometry objects along a single dimension. A typical use case would be a summary geometry of a moving object based on its ID.

Parameters:
dimHashable

The dimension along which to summarize the geometry.

geom_arrayHashable, optional

The name of the geometry array to use for xr.Dataset objects. Must be specified for a xr.Dataset, ignored for a xr.DataArray.

aggfuncstr or Callable, default “envelope”

The aggregation function to use for summarizing the geometry. Can be one of the following strings:

  • "envelope": Computes the envelope (bounding box) of the geometries.

  • "centroid": Computes the centroid of the geometries.

  • "oriented_envelope": Computes the oriented envelope of the geometries.

  • "convex_hull": Computes the convex hull of the geometries.

  • "concave_hull": Computes the concave hull of the geometries. Additional parameters can be passed via kwargs.

  • "collection": Collects the geometries into a geometry collection.

  • "union": Computes the union of the geometries.

Or a callable that takes an xr.DataArray and returns an scalar xr.DataArray with shapely geometry.

**kwargsAny

Additional keyword arguments to pass to the aggregation function if it is callable.

Returns:
xr.DataArray or xr.Dataset

The original xarray DataArray or Dataset with a new coordinate geometry summary_geometry with a GeometryIndex linked to a given dimension.