Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove vp nearest neighbor intermediate output #1319

Merged
merged 7 commits into from
Dec 9, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update segment cutting once gtfs-segments pinned to 2.1.7
tiffanychu90 committed Dec 9, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 87bbad6432b6754f6e2e23097bebcfb661568b25
15 changes: 11 additions & 4 deletions rt_segment_speeds/scripts/cut_stop_segments.py
Original file line number Diff line number Diff line change
@@ -74,7 +74,10 @@ def cut_stop_segments(analysis_date: str) -> gpd.GeoDataFrame:
# so let's partition it with a lot of npartitions
ddf = ddf.repartition(npartitions=150).persist()

renamed_ddf = ddf.rename(columns = {"stop_id": "stop_id1"})
renamed_ddf = ddf.rename(columns = {
"stop_id": "stop_id1",
"arrival_time": "arrival_time1"
})
orig_dtypes = renamed_ddf.dtypes.to_dict()

segments = ddf.map_partitions(
@@ -85,15 +88,19 @@ def cut_stop_segments(analysis_date: str) -> gpd.GeoDataFrame:
"stop_id2": "str",
"end": "geometry",
"snap_end_id": "int",
"arrival_time2": "int",
"segment_id": "str"
},
align_dataframes = False
)

# We don't need several of these columns, esp 3 geometry columns
segments = (segments.drop(
columns = ["start", "end",
"snap_start_id", "snap_end_id"]
columns = [
"start", "end",
"snap_start_id", "snap_end_id",
"arrival_time1", "arrival_time2"
]
).pipe(
gtfs_schedule_wrangling.gtfs_segments_rename_cols,
natural_identifier = False