From 732bfe23e3486c11dd471ccf150dfb73ca0a7c8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=B6rl?= Date: Fri, 5 Jul 2024 18:14:45 +0200 Subject: [PATCH] fix: repairing of completely overlapping trips in ENTD --- CHANGELOG.md | 1 + data/hts/hts.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d6ea0a6..d762fde4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ **Under development** +- fix: fixed special case in repairing ENTD for completely overlapping trips - feat: make it possible to disable the test run of MATSim before writing everything out - feat: check availability of open data sources for every PR - feat: make statistical matching attribute list configurable diff --git a/data/hts/hts.py b/data/hts/hts.py index d8c26dd2..86bc0365 100644 --- a/data/hts/hts.py +++ b/data/hts/hts.py @@ -89,12 +89,13 @@ def fix_trip_times(df_trips): print(" of which we're able to shorten %d to make it consistent" % np.count_nonzero(f)) df_main.loc[f, "arrival_time"] = df_next["departure_time"] - # Included trips + # Included trips (moving the first one to the start of the following trip and setting duration to zero) f = ~df_main["is_last_trip"] f &= df_main["departure_time"] >= df_next["departure_time"] f &= df_main["arrival_time"] <= df_next["arrival_time"] + df_main.loc[f, "departure_time"] = df_next["departure_time"] + df_main.loc[f, "arrival_time"] = df_next["departure_time"] print("Found %d occurences where current trip is included in next trip" % np.count_nonzero(f)) - df_main = df_main[~f] return df_main