lt_toolbox.TrajFrame.compute_distance#
- TrajFrame.compute_distance(cum_dist: bool = False, unit: str = 'km') Self[source]#
Compute distance travelled by particles along their of trajectories.
Either the distance travelled between particle positions or the cumulative distance travelled is computed and returned for all trajectories a new variable.
The final element in each list is Null since the distance magnitude and direction is undefined at the final position.
- Parameters:
cum_dist (bool, default: False) – Compute the cumulative distance travelled by each particle - default is False.
unit (str, default: 'km') – Unit for distance travelled output. The default is kilometers, ‘km’, alternatively meters can be specified, ‘m’.
- Returns:
TrajFrame is returned with new column variable containing the distance travelled by particles along their trajectories.
- Return type:
TrajFrame.
Examples
Computing distance travelled by particles for all trajectories, specifying cumulative distance as False and unit as default ‘km’.
>>> trajectories.compute_distance(cum_dist=False, unit='km')