ColumnConfig - jasonxfrazier/puddy GitHub Wiki
ColumnConfig
ColumnConfig
lets you define how your raw data columns map to spatial coordinates (X/Y/Z or longitude/latitude/altitude) and, optionally, a group/trajectory identifier.
This allows Puddy to normalize and group trajectories from any data schema.
Attributes
-
x_col:
str
Name of the column containing X values or longitude. -
y_col:
str
Name of the column containing Y values or latitude. -
z_col:
str
Name of the column containing Z values or altitude. -
identifier_col:
Optional[str]
(Optional) Name of the column used to group points into trajectories.
If not set, all data is treated as a single trajectory. -
trajectory_type:
TrajectoryType
Indicates if coordinates are geographic ("geo"), cartesian ("xyz"), or other.
Factory Methods
create_geo
ColumnConfig.create_geo(
lon_col: str = "lon",
lat_col: str = "lat",
alt_col: str = "alt",
identifier_col: Optional[str] = None
) -> ColumnConfig
Creates a config for longitude/latitude/altitude data.
create_xyz
ColumnConfig.create_xyz(
x_col: str = "x",
y_col: str = "y",
z_col: str = "z",
identifier_col: Optional[str] = None
) -> ColumnConfig
Creates a config for cartesian (X/Y/Z) data.
Example
from puddy import ColumnConfig
# For GPS data
config = ColumnConfig.create_geo(lon_col="longitude", lat_col="latitude", alt_col="height", identifier_col="trip_id")
# For cartesian data
xyz_config = ColumnConfig.create_xyz(x_col="x", y_col="y", z_col="z", identifier_col="track")