movingpandas.Trajectory.add_acceleration#

Trajectory.add_acceleration(overwrite=False, name='acceleration', units=(None, None, None, None))#

Add acceleration column and values to the trajectory’s DataFrame.

Acceleration values are computed between the current point and the previous:

If no units have been declared:

  • For geographic projections, in meters per second squared

  • For other projections, in CRS units per second squared

If units have been declared:

  • For geographic projections, using declared units

  • For known CRS units, using declared units

  • For unknown CRS units, using declared units as if CRS distance units are meters

  • If only distance units are declared, returns distance per second squared

  • If distance and one time unit declared, returns distance/time per second

Parameters:
  • overwrite (bool) – Whether to overwrite existing speed values (default: False)

  • name (str) – Name of the acceleration column (default: “acceleration”)

  • units (tuple(str)) –

    Units in which to calculate acceleration

    distancestr

    Abbreviation for the distance unit (default: CRS units, or metres if geographic)

    timestr

    Abbreviation for the time unit (default: seconds)

    time2str

    Abbreviation for the second time unit (default: seconds)

    For more info, check the list of supported units at https://movingpandas.org/units

Examples

If no units are declared, the acceleration will be calculated in meters per second squared for geographic projections and in CRS distance units per second squared for all other projections

>>>traj.add_acceleration()

The default column name is “acceleration”. If a column of this name already exists, a new column name can be specified

>>>traj.add_acceleration(name=”acceleration (CRS units/s2)”)

If units are declared, acceleration will be calculated in those units except if the CRS distance units are unknown, in which case the CRS distance units are assumed to be meters

>>>traj.add_acceleration(units=(“km”, “h”, “s”))

It is suggested to declare a name for the new column specifying units

>>>traj.add_acceleration(name=”US Survey Feet/s2”, units=(“survey_ft”, “s”)) >>>traj.add_acceleration(name=”mph/s”, units=(“mi”, “h”, “s”))