Skip to content

Commit

Permalink
chore: only impute urban attributes if shape is present (#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebhoerl authored Jul 6, 2024
1 parent 5e98fbe commit 90e9416
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions matsim/simulation/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,27 +111,29 @@ def execute(context):
columns = dict(departement_id = "id")
)
df_shape["id"] = df_shape["id"].astype(str)
df_shape.to_file("%s/departments.shp" % context.path())

eqasim.run(context, "org.eqasim.core.scenario.spatial.RunImputeSpatialAttribute", [
"--input-population-path", "prepared_population.xml.gz",
"--output-population-path", "prepared_population.xml.gz",
"--input-network-path", "%snetwork.xml.gz" % context.config("output_prefix"),
"--output-network-path", "%snetwork.xml.gz" % context.config("output_prefix"),
"--shape-path", "departments.shp",
"--shape-attribute", "id",
"--shape-value", "75",
"--attribute", "isUrban"
])

eqasim.run(context, "org.eqasim.core.scenario.spatial.RunAdjustCapacity", [
"--input-path", "%snetwork.xml.gz" % context.config("output_prefix"),
"--output-path", "%snetwork.xml.gz" % context.config("output_prefix"),
"--shape-path", "departments.shp",
"--shape-attribute", "id",
"--shape-value", "75",
"--factor", str(0.8)
])
if "75" in df_shape["id"].unique():
df_shape.to_file("%s/departments.shp" % context.path())

eqasim.run(context, "org.eqasim.core.scenario.spatial.RunImputeSpatialAttribute", [
"--input-population-path", "prepared_population.xml.gz",
"--output-population-path", "prepared_population.xml.gz",
"--input-network-path", "%snetwork.xml.gz" % context.config("output_prefix"),
"--output-network-path", "%snetwork.xml.gz" % context.config("output_prefix"),
"--shape-path", "departments.shp",
"--shape-attribute", "id",
"--shape-value", "75",
"--attribute", "isUrban"
])

eqasim.run(context, "org.eqasim.core.scenario.spatial.RunAdjustCapacity", [
"--input-path", "%snetwork.xml.gz" % context.config("output_prefix"),
"--output-path", "%snetwork.xml.gz" % context.config("output_prefix"),
"--shape-path", "departments.shp",
"--shape-attribute", "id",
"--shape-value", "75",
"--factor", str(0.8)
])


# Optionally, perform mode choice
Expand Down

0 comments on commit 90e9416

Please sign in to comment.