trajdl.datasets.arrow.traj module#

class trajdl.datasets.arrow.traj.TrajectoryDataset(*args, **kwargs)[source]#

Bases: BaseArrowDataset

Dataset for trajectories.

check_table(table: Table) None[source]#

Validate the input Arrow table.

Parameters:

table (pa.Table) – The Arrow table to validate.

Notes

This method is a placeholder and needs to be implemented to ensure the table complies with expected structure and data types.

classmethod init_from_trajectories(seqs: Iterable[Trajectory]) TrajectoryDataset[source]#

Initialize the dataset from an iterable of trajectories.

Parameters:

seqs (Iterable[Trajectory]) – An iterable containing Trajectory objects.

Returns:

An instance of TrajectoryDataset initialized from the provided trajectory data.

Return type:

TrajectoryDataset

Notes

The method extracts data, id, and ts attributes from each Trajectory object to build an Arrow table. The data is converted to a list for storage.

classmethod schema() Schema[source]#

Get the Arrow schema for the trajectory dataset.

Returns:

The schema definition for the dataset, defined in TRAJ_ARROW_SCHEMA.

Return type:

pa.lib.Schema

sub_classes_construction(*args, **kwargs) Trajectory[source]#

这个方法是将table的一行数据转换为单条序列的实例