arup-group / elara

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

Mode errors happening very late #67

Closed fredshone closed 3 years ago

fredshone commented 3 years ago

The following error is encountered too late (ie at handler run time). Need to add a check at startup.

1-26 17:19 elara.event_handlers WARNING 
                No viable routes found for mode:train in TransitSchedule, 
                this may be because the Schedule modes do not match the configured 
                modes. Elara will continue with all routes found in schedule.
Traceback (most recent call last):
  File "/home/arup/repo/elara/venv/bin/elara", line 11, in <module>
    load_entry_point('elara', 'console_scripts', 'elara')()
  File "/home/arup/repo/elara/venv/lib/python3.8/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/arup/repo/elara/venv/lib/python3.8/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/arup/repo/elara/venv/lib/python3.8/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/arup/repo/elara/venv/lib/python3.8/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/arup/repo/elara/venv/lib/python3.8/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/arup/repo/elara/elara/main.py", line 375, in run
    main(config)
  File "/home/arup/repo/elara/elara/main.py", line 441, in main
    factory.build(config_requirements)
  File "/home/arup/repo/elara/elara/factory.py", line 591, in build
    current.build(write_path=write_path)
  File "/home/arup/repo/elara/elara/event_handlers.py", line 1027, in build
    super().build(write_path=write_path)
  File "/home/arup/repo/elara/elara/factory.py", line 381, in build
    tool.build(self.supplier_resources, write_path)
  File "/home/arup/repo/elara/elara/event_handlers.py", line 701, in build
    self.elem_ids, self.elem_indices = self.generate_elem_ids(list(routes))
TypeError: 'NoneType' object is not iterable
fredshone commented 3 years ago

on second thoughts... this error tends to arrise because the network is missing a configured mode. We can only know this once the network is in memory, which is the slow operation.

A likelly improvement would have to be checking the output matsim config to see if the modes are available.

fredshone commented 3 years ago

Not come across this since. Closing