tobac.analysis.cell_analysis.calculate_velocity#

tobac.analysis.cell_analysis.calculate_velocity(track, method_distance=None, return_components=False, use_3d=False)#

Calculate the velocities of a set of linked features.

Parameters:
  • track (pandas.DataFrame) –

    Dataframe of linked features, containing the columns ‘cell’,

    ’time’ and either ‘projection_x_coordinate’ and ‘projection_y_coordinate’ or ‘latitude’ and ‘longitude’.

  • method_distance ({None, 'xy', 'latlon'}, optional) – Method of distance calculation, used to calculate the velocity. ‘xy’ uses the length of the vector between the two features, ‘latlon’ uses the haversine distance. None checks wether the required coordinates are present and starts with ‘xy’. Default is None.

  • return_components (bool, optional (default=False)) – Flag to control whether the velocity is calculated and returned as its vector components. If False, only the scalar (absolute) value is returned. If True, the function returns a dictionary containing the scalar value as well as its individual directional components (e.g., ‘vx’, ‘vy’, ‘vz’ for velocity).

  • use_3d (bool, optional (default=False)) – If True and a vertical coordinate is available, compute full 3D distances and velocities. Otherwise, only 2D (horizontal) distances are used.

Returns:

track – DataFrame from the input, with an additional column ‘v’, contain the value of the velocity for every feature at every possible timestep

Return type:

pandas.DataFrame