tracktable.filter.trajectory module

Module contents

tracktable.filter.trajectory - Filters that take trajectories as input

class tracktable.filter.trajectory.ClipToTimeWindow[source]

Bases: object

Truncate trajectories to fit within a time window

Given an iterable of Trajectory objects, return those portions of each trajectory that fit within the specified time window. Interpolate endpoints as necessary.

input

Source of Trajectory objects

Type:

iterable

start_time

Beginning time for window of interest

Type:

datetime

end_time

End time for window of interest

Type:

datetime

trajectories()[source]

Return sub-trajectories within window.

Note

Since this is a generator, you can only traverse the sequence once unless you collect it in a list yourself.

Yields:
Trajectories derived from input trajectories. Each trajectory

is guaranteed to fall entirely within the window specified by self.start_time and self.end_time. If one of the input trajectories extends beyond that boundary, a new endpoint will be interpolated so that it begins or ends precisely at the boundary. Trajectories entirely outside the boundary will be returned as empty trajectories with 0 points.

class tracktable.filter.trajectory.FilterByAltitude[source]

Bases: object

Filter out trajectories that don’t intersect an interval of altitude

Given a source that produces Trajectories, return only those trajectories that have at least one point between min_altitude and max_altitude.

Like FilterByBoundingBox, no clipping will take place. If a trajectory crosses the specified interval at all then you will get the whole thing back.

input

Iterable containing Trajectory objects

Type:

iterable

min_altitude

Minimum altitude for acceptance

Type:

float

max_altitude

Maximum altitude for acceptance

Type:

float

trajectories()[source]

Return just the trajectories that intersect the bounding box

Yields:

Trajectory objects that fall within the altitude region

class tracktable.filter.trajectory.FilterByBoundingBox[source]

Bases: object

FilterByBoundingBox: Eliminate trajectories that don’t intersect a given box

Given a source that produces Trajectories, return only those trajectories that intersect the specified bounding box. No clipping or subsetting is performed: if at least one point is within the desired region you will get the entire trajectory back.

input

Sequence of Trajectory objects

Type:

iterable

box

Bounding box

Type:

tuple

trajectories()[source]

Return just those trajectories that intersect the bounding box

Yields:

Trajectory objects with at least one point inside the bounding box

class tracktable.filter.trajectory.FilterByPolygon[source]

Bases: object

Filter out trajectories that lie within a shoreline, river or border polygon

Given a source that produces Trajectories, return only those trajectories that are outside of a given shoreline, river or border polygon.

Trajectories will only be filtered out if the entire trajectory is contained within the bounds of the given polygon.

trajectory

Iterable containing Trajectory objects

Type:

iterable

polygon

Polygon to filter trajectories

Type:

Shapely polygon

trajectories()[source]

Return just the trajectories that are entirely outside of the given polygon

Yields:

Trajectory objects that are entirely outside of the given polygon