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:
- Parameters:
relocs (ecoscope.Relocations)
copy (bool)
- apply_traj_filter(traj_seg_filter, inplace=False)[source]#
- Parameters:
traj_seg_filter (ecoscope.base._dataclasses.TrajSegFilter)
inplace (bool)
- 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:
- 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:
- 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