kuanb / peartree

peartree: A library for converting transit data into a directed graph for sketch network analysis.
MIT License
201 stars 23 forks source link

[bug] When direction id absent, incorrectly calcs wait times #137

Closed kuanb closed 5 years ago

kuanb commented 5 years ago

Major bug!

When direction id is missing from GTFS feed, all arrival times associated with the trip are included during the parallelizable wait time by route-stop-trip operation. See these lines:

https://github.com/kuanb/peartree/blob/a9ef0bd4d13796ead921d9d575834e5fe6fa9e95/peartree/parallel.py#L119-L142

Mistake is that the operation should always subset of stop id, regardless of whether direction is available.

This bug was producing <1 minute wait times on some routes in Yuba City, for example. Making this change made those nodes have wait times of 22.5 minutes (so about 45 minute headways) which reflects the schedules' performance.

image