import dascore as dc
= dc.get_example_patch()
patch # integrate along time axis, preserve patch shape with indefinite integral
= patch.integrate(dim="time", definite=False)
time_integrated # integrate along distance axis, collapse distance coordinate
= patch.integrate(dim="distance", definite=True)
dist_integrated # integrate along all dimensions.
= patch.integrate(dim=None, definite=False) all_integrated
integrate
integrate(
patch: Patch ,
dim: collections.abc.Sequence[collections.abc.Sequence[str], str, None] ,
definite: bool = False,
)-> ‘PatchType’
Integrate along a specified dimension using composite trapezoidal rule.
Parameters
Parameter | Description |
---|---|
patch | Patch object for integration. |
dim |
The dimension(s) along which to integrate. If None, integrate along all dimensions. |
definite |
If True, consider the integration to be defined from the minimum to the maximum value along specified dimension(s). In essense, this collapses the integrated dimensions to a lenght of 1. If define is False, the shape of the patch is preserved and a “cumulative” type integration in performed. |
Note
The number of dimensions will always remain the same regardless of definite
value. To remove dimensions with length 1, use Patch.squeeze
.