ecoscope.trajectory#

Module Contents#

ecoscope.trajectory.get_displacement(gdf)[source]#

Get displacement in meters between first and final fixes.

Parameters:

gdf (geopandas.GeoDataFrame)

ecoscope.trajectory.get_tortuosity(gdf)[source]#

Get tortuosity for dataframe defined as distance traveled divided by displacement between first and final points.

Parameters:

gdf (geopandas.GeoDataFrame)

class ecoscope.trajectory.Trajectory(gdf)[source]#

Bases: ecoscope.base.EcoDataFrame

A trajectory represents a time-ordered collection of segments. Currently only straight track segments exist. It is based on an underlying relocs object that is the point representation

Parameters:

gdf (geopandas.GeoDataFrame)

classmethod from_relocations(relocs, copy=True)[source]#

Create Trajectory class from Relocation dataframe. :param relocs: A Relocations instance. :type relocs: Relocations :param copy: Whether or not to copy the gdf. Defaults to True. :type copy: bool, optional

Return type:

Trajectory

Parameters:
static _create_multitraj(gdf)[source]#
Parameters:

gdf (geopandas.GeoDataFrame)

static _create_trajsegments(gdf)[source]#
Parameters:

gdf (geopandas.GeoDataFrame)

apply_traj_filter(traj_seg_filter, inplace=False)[source]#
Parameters:
get_turn_angle()[source]#
upsample(freq)[source]#

Interpolate to create upsampled Relocations :param freq: Sampling frequency for new Relocations object :type freq: str, pd.Timedelta or pd.DateOffset

Returns:

relocs

Return type:

ecoscope.Relocations

Parameters:

freq (str | pandas.Timedelta | pandas.DateOffset)

to_relocations()[source]#

Converts a Trajectory object to a Relocations object. :rtype: ecoscope.Relocations

downsample(freq, tolerance='0S', interpolation=False)[source]#

Function to downsample relocations. :param freq: Downsampling frequency for new Relocations object :type freq: str, pd.Timedelta or pd.DateOffset :param tolerance: Tolerance on the downsampling frequency :type tolerance: str, pd.Timedelta or pd.DateOffset :param interpolation: If true, interpolates locations on the whole trajectory :type interpolation: bool, optional

Return type:

ecoscope.Relocations

Parameters:
  • freq (str | pandas.Timedelta | pandas.DateOffset)

  • tolerance (str | pandas.Timedelta | pandas.DateOffset)

  • interpolation (bool)

calculate_proximity(proximity_profile)[source]#

A function to analyze the trajectory of a subject in relation to a set of spatial features and regions to determine where/when the subject was proximal to the spatial feature.

Parameters:

proximity_profile (ProximityProfile) – proximity setting for performing calculation

Return type:

pd.DataFrame