arup-group / elara

Command line utility for processing MATSim events output files.
MIT License
13 stars 4 forks source link

Station to station counter #52

Closed fredshone closed 3 years ago

fredshone commented 4 years ago

Adds new event handler PassengerStopToStopCounts aka "stop-to-stop". This aggregates transit vehicle counts to origin, destination, attribute class and hour. ie Waterloo to Embankment, high income, 3rd hour -> N persons.

eg:

origin,destination,class,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,origin_link,origin_name,destination_link,destination_name
-------
work_stop_out,home_stop_in,poor,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,20000.0,0.0,0.0,0.0,0.0,0.0,0.0,4-3,work_stop_out,2-1,home_stop_in
home_stop_out,work_stop_in,poor,0.0,0.0,0.0,0.0,0.0,0.0,0.0,10000.0,10000.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1-2,home_stop_out,3-4,work_stop_arr

Useful for when you want to get volume of transit flow between two stations rather than for all individual links.

Critique:

  1. The joining of spatial data in the finalise() method is messy and duplicated.
  2. The counter is set up for all combinations of stops to stops (including self to self). This is simple but super memory hungry - it essentially creates a big matrix of zeros for impossible connections (ie Waterloo to London Bridge and so on). This could be corrected either by first traversing the schedule to calculate possible connections, using a sparse matrix repressentation or building on the fly.

Note that we might want to build an O-D scraper for trip origins and destinations which would use the same structure.

fredshone commented 3 years ago

Merging to make new bms available