function of dascore.transform.integrate source

    patch: Patch ,
    dim:[[str], str, None] ,
    definite: bool = False,
)-> ‘PatchType’

Integrate along a specified dimension using composite trapezoidal rule.


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.

The number of dimensions will always remain the same regardless of definite value. To remove dimensions with length 1, see squeeze


import dascore as dc
patch = dc.get_example_patch()
# integrate along time axis, preserve patch shape with indefinite integral
time_integrated = patch.tran.integrate(dim="time", definite=False)
# integrate along distance axis, collapse distance coordinate
dist_integrated = patch.tran.integrate(dim="distance", definite=True)
# integrate along all dimensions.
all_integrated = patch.tran.integrate(dim=None, definite=False)