arup-group/genet

Set attributes for PT schedule elements in a Schedule

KasiaKoz opened this issue · 0 comments

If contained in the Schedule object, the PT schedule element objects: Stop, Route, Service do not exist until requested from the Schedule. A new object is created using data stored in

schedule._graph.nodes
schedule._graph.graph['routes']
schedule._graph.graph['services']

respectively.

Right now we rely on Schedule level methods to change these objects. We should add methods that when an attribute is changed or added e.g. route.mode = 'super_bus' the data in schedule._graph.graph['routes'][route.id] is updated, and a change logged in schedule._graph.graph['change_log'].

Errors should be raised when:

  • attempting to change id of the object
  • attempting to change epsg attribute (projection)
    user should be directed to the dedicated methods for reindexing and reprojections

and warnings for:

  • [Route] changing mode (which affects the modes on the network graph link for the route or could mean that the route needs to be rerouted (depending on the type of mode change))
  • [Route] changing network route (there are genet methods for routing, if user is setting this themselves they should be reminded of these methods and that their route may not be valid)
  • [Route] changing ordered_stops (this will affect the network route which relies on links referenced by stops and their order)
  • [Stop] changing spatial values x or y, since stops are usually snapped to a network link and moving them may mean the snapping is no longer correct

Nb. that schedule._graph is shared with and accessible from lesser objects, e.g. route._graph, if that route if contained within that schedule.