From 50fcaf3cec373a439f8812913de059bcd2881429 Mon Sep 17 00:00:00 2001 From: rakow Date: Tue, 24 Oct 2023 17:04:12 +0200 Subject: [PATCH] update broken urls and style issues --- README.md | 2 +- src/main/python/create_ref.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2e62791..c6f31eb 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ When using this template make sure to adapt it as needed: This repository provides an open MATSim transport model for Leipzig, provided by the [Transport Systems Planning and Transport Telematics group](https://www.vsp.tu-berlin.de) of [Technische Universität Berlin](http://www.tu-berlin.de). - + This scenario contains a 25pct sample of Leipzig and its surrounding area; road capacities are accordingly reduced. The scenario is calibrated taking into consideration the traffic counts, modal split and mode-specific trip distance distributions. diff --git a/src/main/python/create_ref.py b/src/main/python/create_ref.py index ea5b5a7..4b0c419 100644 --- a/src/main/python/create_ref.py +++ b/src/main/python/create_ref.py @@ -6,9 +6,11 @@ from matsim.scenariogen.data import run_create_ref_data from matsim.scenariogen.data.preparation import calc_needed_short_distance_trips +CRS = "EPSG:25832" + def person_filter(df): - df = gpd.GeoDataFrame(df, geometry=gpd.GeoSeries.from_wkt(df.geom, crs="EPSG:4326").to_crs("EPSG:25832")) + df = gpd.GeoDataFrame(df, geometry=gpd.GeoSeries.from_wkt(df.geom, crs="EPSG:4326").to_crs(CRS)) df = gpd.sjoin(df, region, how="inner", predicate="intersects") return df[df.present_on_day & (df.reporting_day <= 5)] @@ -20,7 +22,7 @@ def trip_filter(df): if __name__ == "__main__": - region = gpd.read_file("../../../../shared-svn/projects/DiTriMo/data/shp/lausitz.shp").to_crs("EPSG:25832") + region = gpd.read_file("../../../../shared-svn/projects/DiTriMo/data/shp/lausitz.shp").to_crs(CRS) persons, trips, share = run_create_ref_data.create("/Volumes/Untitled/B3_Lokal-Datensatzpaket/CSV", person_filter, trip_filter, @@ -36,14 +38,14 @@ def trip_filter(df): delimiter=";", dtype={"person": "str"}) sim_persons = sim_persons[sim_persons.subpopulation == "person"] sim_persons = gpd.GeoDataFrame(sim_persons, - geometry=gpd.points_from_xy(sim_persons.home_x, sim_persons.home_y)).set_crs("EPSG:25832") + geometry=gpd.points_from_xy(sim_persons.home_x, sim_persons.home_y)).set_crs(CRS) sim_persons = gpd.sjoin(sim_persons, region, how="inner", predicate="intersects") sim = pd.read_csv("../../../output/output-lausitz-100pct/lausitz-100pct.output_trips.csv.gz", delimiter=";", dtype={"person": "str"}) - sim = pd.merge(sim, sim_persons, how="inner", left_on="person", right_on="person") + sim = pd.merge(sim, sim_persons, how="inner", left_on="person", right_on="person", validate="many_to_one") share, add_trips = calc_needed_short_distance_trips(trips, sim, max_dist=1500) print("Short distance trip missing: ", add_trips)