Skip to content

Commit

Permalink
logging and correct order for veh_type name
Browse files Browse the repository at this point in the history
  • Loading branch information
dhensle committed Feb 3, 2024
1 parent 5adfc7b commit 15b7f31
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions activitysim/abm/models/vehicle_type_choice.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,17 @@ def construct_model_alternatives(model_settings, alts_cats_dict, vehicle_type_da
), f"missing vehicle data for alternatives:\n {missing_alts}"
else:
# eliminate alternatives if no vehicle type data
num_alts_before_filer = len(alts_wide)
alts_wide = alts_wide[alts_wide._merge != "left_only"]
logger.warning(
f"Removed {num_alts_before_filer - len(alts_wide)} alternatives not included in input vehicle type data."
)
# need to also remove any alts from alts_long
alts_long.set_index(['body_type', 'fuel_type', 'age'], inplace=True)
alts_long = alts_long[alts_long.index.isin(
alts_wide.set_index(['body_type', 'fuel_type', 'age']).index)
alts_long.set_index(["body_type", "age", "fuel_type"], inplace=True)
alts_long = alts_long[
alts_long.index.isin(
alts_wide.set_index(["body_type", "age", "fuel_type"]).index
)
].reset_index()
alts_wide.drop(columns="_merge", inplace=True)

Expand Down

0 comments on commit 15b7f31

Please sign in to comment.