Skip to content

Commit

Permalink
update broken urls and style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
rakow committed Oct 24, 2023
1 parent 0102143 commit 50fcaf3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

<a rel="TU Berlin" href="https://www.vsp.tu-berlin.de"><img src="https://svn.vsp.tu-berlin.de/repos/public-svn/ueber_uns/logo/TUB_Logo.png" width="15%" height="15%"/></a>
<a rel="TU Berlin" href="https://www.vsp.tu-berlin.de"><img src="https://svn.vsp.tu-berlin.de/repos/public-svn/ueber_uns/logo/TU_BERLIN_Logo_Lang_RGB_SR_rot.svg" width="25%"/></a>

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.

Expand Down
10 changes: 6 additions & 4 deletions src/main/python/create_ref.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand All @@ -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,
Expand All @@ -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)

0 comments on commit 50fcaf3

Please sign in to comment.