arup-group / elara

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

`ValueError: max() arg is an empty sequence` error when running on SF eqasim-org/california model #182

Closed KasiaKoz closed 2 years ago

KasiaKoz commented 2 years ago

I'm hit with the following error running a matsim model adapted from here: https://github.com/eqasim-org/california

Traceback (most recent call last):
File "/usr/local/bin/elara", line 33, in <module>
sys.exit(load_entry_point('elara', 'console_scripts', 'elara')())
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/elara/main.py", line 53, in run
main(config)
File "/elara/main.py", line 127, in main
factory.build(config_requirements)
File "/elara/factory.py", line 683, in build
current.build(write_path=write_path)
File "/elara/plan_handlers.py", line 1509, in build
plan_handler.process_plans(person)
File "/elara/plan_handlers.py", line 314, in process_plans
mode = self.get_furthest_mode(plan_modes)
File "/elara/plan_handlers.py", line 63, in get_furthest_mode
return max(modes, key=modes.get)
ValueError: max() arg is an empty sequence

My elara config:

[scenario]
name = "SF"
time_periods = 24
scale_factor = 0.01
crs = "EPSG:3494"
verbose = true
version = 12
using_experienced_plans = 'False'

[inputs]
events = "./output_events.xml.gz"
network = "./output_network.xml.gz"
transit_schedule = "./output_transitSchedule.xml.gz"
transit_vehicles = "./output_transitVehicles.xml.gz"
plans= "./output_plans.xml.gz"
output_config_path = "./output_config.xml"

[outputs]
path = "./elara"
contract = false

[event_handlers]
link_vehicle_counts = ["car"]
link_vehicle_speeds = ["car"]
link_passenger_counts = ["bus", "rail", "cable car", "ferry", "subway", "tram"]
stop_passenger_counts = ["bus", "rail", "cable car", "ferry", "subway", "tram"]
stop_passenger_waiting = ["all"]

[plan_handlers]
trip_modes = ["all"]
plan_modes = ["all"]
plan_logs = ["all"]
agent_highway_distance_logs = ["car"]
trip_highway_distance_logs = ["car"]

[post_processors]
vkt = ["car"]
plan_summary = ["all"]
trip_duration_breakdown = ["all"]

[benchmarks]
#test_pt_interaction_counter = ["bus"]
#test_link_cordon = ["car"]

There are agents in the model that stay home all day, my feeling is that this error is due to them not travelling and thus not having any modes---but running elara in the past ( Oct 2021 ) on the same sim outputs worked. I would like to take advantage of the latest advances in the speed computation, so would like to run on the latest elara version. Please halp 🥲

fredshone commented 2 years ago

@KasiaKoz - i think this emerged because of the not often used plan_modes handler. Thanks for finding but also wanted to check that this was intended - "plan mode shares" are based on the primary mode used for entire day (as oppoosed to trip based mode share which returns share based on primary mode of each trip...