Skip to content

Commit

Permalink
Merge pull request #801 from camsys/bugfix-801
Browse files Browse the repository at this point in the history
`cleanup_failed_trips` requires workflow state
  • Loading branch information
jpn-- authored Feb 16, 2024
2 parents c0305bd + c9e72a8 commit 03a6720
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion activitysim/abm/models/trip_destination.py
Original file line number Diff line number Diff line change
Expand Up @@ -1598,7 +1598,7 @@ def trip_destination(
trips_df.index[trips_df.failed], level="trip_id", inplace=True
)

trips_df = cleanup_failed_trips(trips_df)
trips_df = cleanup_failed_trips(state, trips_df)

trips_df.drop(columns="failed", inplace=True, errors="ignore")

Expand Down
2 changes: 1 addition & 1 deletion activitysim/abm/models/trip_purpose_and_destination.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def trip_purpose_and_destination(
state.settings.downcast_float,
)

trips_df = cleanup_failed_trips(trips_df)
trips_df = cleanup_failed_trips(state, trips_df)

state.add_table("trips", trips_df)

Expand Down
2 changes: 1 addition & 1 deletion activitysim/abm/models/trip_scheduling.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ def trip_scheduling(
)

trips_df["failed"] = choices.isnull()
trips_df = cleanup_failed_trips(trips_df)
trips_df = cleanup_failed_trips(state, trips_df)
choices = choices.reindex(trips_df.index)

trips_df["depart"] = choices
Expand Down
2 changes: 1 addition & 1 deletion activitysim/abm/models/util/trip.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def flag_failed_trip_leg_mates(trips_df, col_name):
# trips_df.loc[failed_trip_leg_mates, col_name] = True


def cleanup_failed_trips(trips):
def cleanup_failed_trips(state: workflow.State, trips: pd.DataFrame):
"""
drop failed trips and cleanup fields in leg_mates:
Expand Down

0 comments on commit 03a6720

Please sign in to comment.