activitysim
activitysim copied to clipboard
Crash in disaggregate accessibilities when trying to create vehicle type table used in logsum calculations
Describe the bug The vehicle table is used in tour and trip mode choice to get the auto operating cost for drive modes. (See here for an example.) Disaggregate accessibilities will call the tour mode choice model when calculating the logsums. Under the hood, ActivitySim will look for the vehicles table and if it doesn't find one, it will create it.
If auto_ownership is not a variable in the input households table, ActivitySim will crash when trying to create the vehicle table.
To Reproduce Run Disaggregate accessibilities with input household data that does not have auto_ownership as an input variable and also calls the vehicles table in tour mode choice.
Expected behavior If auto ownership does not exist in the households table, the created vehicle table is just empty. It should not crash out.
The Fix Just create an empty vehicle table if auto_ownership is not in the household columns.
Additional context The long-term fix for this is to add some functionality in disaggregate accessibilities to specify the vehicles owned by the proto-population used to create the logsums, but this shouldn't be a required feature.