diff --git a/Makefile b/Makefile
index 72d2ddd..62a5262 100644
--- a/Makefile
+++ b/Makefile
@@ -53,16 +53,15 @@ input/sumo.net.xml: input/network.osm
--no-internal-links --keep-edges.by-vclass passenger,bicycle\
--remove-edges.by-vclass hov,tram,rail,rail_urban,rail_fast,pedestrian\
--output.original-names --output.street-names\
- --proj "+proj=utm +zone=53 +datum=WGS84 +units=m +no_defs"\
- --lefthand true
+ --proj "+proj=utm +zone=53 +ellps=WGS84 +datum=WGS84 +units=m +no_defs"\
+ --lefthand true\
--osm-files $< -o=$@
-input/$V/$N-$V-network.xml.gz:
- $(sc) prepare network-from-sumo $(kyoto)/data/Kyoto_Network_C_2021/network_C.net.xml\
+input/$V/$N-$V-network.xml.gz: input/sumo.net.xml
+ $(sc) prepare network-from-sumo $<\
--target-crs $(CRS) --output $@
-
input/$V/$N-$V-network-with-pt.xml.gz: input/$V/$N-$V-network.xml.gz
# FIXME: Adjust GTFS
@@ -90,23 +89,20 @@ input/$V/$N-$V-facilities.xml.gz: input/$V/$N-$V-network.xml.gz input/facilities
--output $@
# Static population only contains the home locations
-input/$V/$N-static-$V-10pct.plans.xml.gz: $(kyoto)/data/census_kansai_region.csv $(kyoto)/data/kansai-region-epsg4612.gpkg input/facilities.gpkg
- $(sc) prepare kyoto-population\
- --input $<\
- --shp $(word 2,$^) --shp-crs $(CRS)\
- --facilities $(word 3,$^) --facilities-attr resident\
+input/$V/$N-static-$V-10pct.plans.xml.gz: input/facilities.gpkg
+ $(sc) prepare kansai-population\
+ --input $(kyoto)/data/census_kansai_region.csv\
+ --shp $(kyoto)/data/kansai-region-epsg4612.gpkg --shp-crs $(CRS)\
+ --facilities $< --facilities-attr resident\
--output $@
# Assigns daily activity chains (without locations)
-$p/$N-activities-$V-10pct.plans.xml.gz: input/$V/$N-static-$V-25pct.plans.xml.gz input/$V/$N-$V-facilities.xml.gz input/$V/$N-$V-network.xml.gz
- $(sc) prepare activity-sampling --seed 1 --input $< --output $@ --persons src/main/python/table-persons.csv --activities src/main/python/table-activities.csv
-
- $(sc) prepare assign-reference-population --population $@ --output $@\
+input/$V/$N-$V-10pct.plans-initial.xml.gz: input/$V/$N-static-$V-10pct.plans.xml.gz input/$V/$N-$V-facilities.xml.gz input/$V/$N-$V-network.xml.gz
+ $(sc) prepare create-daily-plans --input $< --output $@\
--persons src/main/python/table-persons.csv\
--activities src/main/python/table-activities.csv\
- --shp $(germany)/../matsim-berlin/data/SrV/zones/zones.shp\
- --shp-crs $(CRS)\
+ --shp $(kyoto)/data/kansai-region-epsg4612.gpkg --shp-crs $(CRS)\
--facilities $(word 2,$^)\
--network $(word 3,$^)\
@@ -127,7 +123,6 @@ $p/berlin-initial-$V-10pct.plans.xml.gz: $p/$N-activities-$V-25pct.plans.xml.gz
--samples 0.1 0.03 0.01\
-# Aggregated target
-# TODO:
-#prepare: input/$V/$N-$V-25pct.plans-initial.xml.gz input/$V/$N-$V-network-with-pt.xml.gz
-# echo "Done"
\ No newline at end of file
+# Aggregated target for input plans to calibration
+prepare: input/$V/$N-$V-10pct.plans-initial.xml.gz input/$V/$N-$V-network-with-pt.xml.gz
+ echo "Done"
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 096aba1..8580e4d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
- 2025.0-PR3350
+ 2025.0-PR3390
@@ -38,8 +38,7 @@
github
GitHub Packages
-
- https://maven.pkg.github.com/matsim-scenarios/matsim-template-scenario
+ https://maven.pkg.github.com/matsim-scenarios/matsim-kyoto
@@ -68,7 +67,7 @@
com.github.matsim-scenarios
matsim-berlin
- 70c8076e1e
+ ce81ea226c
diff --git a/src/main/java/org/matsim/prepare/RunOpenKyotoCalibration.java b/src/main/java/org/matsim/prepare/RunOpenKyotoCalibration.java
index 8188e64..58d896c 100644
--- a/src/main/java/org/matsim/prepare/RunOpenKyotoCalibration.java
+++ b/src/main/java/org/matsim/prepare/RunOpenKyotoCalibration.java
@@ -20,7 +20,7 @@
@CommandLine.Command(header = ":: Open Kyoto Calibration ::", version = OpenKyotoScenario.VERSION, mixinStandardHelpOptions = true)
@MATSimApplication.Prepare({
- MergePopulations.class, CreateKyotoPopulation.class,
+ MergePopulations.class, CreateKansaiPopulation.class, CreateDailyPlans.class,
ExtractFacilityGeoPkg.class, DownSamplePopulation.class,
CreateNetworkFromSumo.class, CreateTransitScheduleFromGtfs.class,
CleanNetwork.class, CreateMATSimFacilities.class, InitLocationChoice.class, FilterRelevantAgents.class,
diff --git a/src/main/java/org/matsim/prepare/population/CreateDailyPlans.java b/src/main/java/org/matsim/prepare/population/CreateDailyPlans.java
new file mode 100644
index 0000000..74d00d5
--- /dev/null
+++ b/src/main/java/org/matsim/prepare/population/CreateDailyPlans.java
@@ -0,0 +1,80 @@
+package org.matsim.prepare.population;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.matsim.api.core.v01.population.Person;
+import org.matsim.api.core.v01.population.Population;
+import org.matsim.application.MATSimAppCommand;
+import org.matsim.application.options.ShpOptions;
+import org.matsim.core.population.PopulationUtils;
+import org.matsim.core.population.algorithms.ParallelPersonAlgorithmUtils;
+import org.matsim.core.population.algorithms.PersonAlgorithm;
+import picocli.CommandLine;
+
+import java.nio.file.Path;
+import java.util.SplittableRandom;
+
+@CommandLine.Command(
+ name = "create-daily-plans",
+ description = "Create daily plans for population."
+)
+public class CreateDailyPlans implements MATSimAppCommand, PersonAlgorithm {
+
+ private static final Logger log = LogManager.getLogger(CreateDailyPlans.class);
+
+ @CommandLine.Option(names = "--input", description = "Path to input population.")
+ private Path input;
+
+ @CommandLine.Option(names = "--output", description = "Path to output population", required = true)
+ private Path output;
+
+ @CommandLine.Option(names = "--persons", description = "Path to person table", required = true)
+ private Path personsPath;
+
+ @CommandLine.Option(names = "--activities", description = "Path to activity table", required = true)
+ private Path activityPath;
+
+ @CommandLine.Option(names = "--facilities", description = "Path to facilities file", required = true)
+ private Path facilityPath;
+
+ @CommandLine.Option(names = "--network", description = "Path to network file", required = true)
+ private Path networkPath;
+
+ @CommandLine.Option(names = "--seed", description = "Seed used to sample locations", defaultValue = "1")
+ private long seed;
+
+ @CommandLine.Mixin
+ private ShpOptions shp;
+
+ private ThreadLocal rnd;
+
+ public static void main(String[] args) {
+ new CreateDailyPlans().execute(args);
+ }
+
+ @Override
+ public Integer call() throws Exception {
+
+ if (!shp.isDefined()) {
+ log.error("Shape file with zones is required.");
+ return 2;
+ }
+
+ Population population = PopulationUtils.readPopulation(input.toString());
+
+ rnd = ThreadLocal.withInitial(() -> new SplittableRandom(seed));
+
+ ParallelPersonAlgorithmUtils.run(population, 8, this);
+
+ PopulationUtils.writePopulation(population, output.toString());
+
+ return 0;
+ }
+
+ @Override
+ public void run(Person person) {
+
+ // TODO: map zones to shape file
+
+ }
+}
diff --git a/src/main/java/org/matsim/prepare/population/CreateKyotoPopulation.java b/src/main/java/org/matsim/prepare/population/CreateKansaiPopulation.java
similarity index 97%
rename from src/main/java/org/matsim/prepare/population/CreateKyotoPopulation.java
rename to src/main/java/org/matsim/prepare/population/CreateKansaiPopulation.java
index 783d5af..7cc2a96 100644
--- a/src/main/java/org/matsim/prepare/population/CreateKyotoPopulation.java
+++ b/src/main/java/org/matsim/prepare/population/CreateKansaiPopulation.java
@@ -31,10 +31,10 @@
import java.util.*;
@CommandLine.Command(
- name = "kyoto-population",
- description = "Create synthetic population for kyoto."
+ name = "kansai-population",
+ description = "Create synthetic population for kansai region."
)
-public class CreateKyotoPopulation implements MATSimAppCommand {
+public class CreateKansaiPopulation implements MATSimAppCommand {
private static final NumberFormat FMT = NumberFormat.getInstance(Locale.GERMAN);
@@ -61,7 +61,7 @@ public class CreateKyotoPopulation implements MATSimAppCommand {
private Population population;
public static void main(String[] args) {
- new CreateKyotoPopulation().execute(args);
+ new CreateKansaiPopulation().execute(args);
}
private static int parseInt(String s) {
diff --git a/src/main/python/extract_population_data.py b/src/main/python/extract_population_data.py
index cbe9bbd..026f636 100644
--- a/src/main/python/extract_population_data.py
+++ b/src/main/python/extract_population_data.py
@@ -63,9 +63,9 @@ def trip_filter(df):
df = join_person_with_household(persons, hh)
df = remove_persons_with_invalid_trips(df, trips)
- df.to_csv(args.output + "-persons.csv")
+ df.to_csv(args.output + "-persons.csv", index=False)
print("Written survey csvs with %d persons" % len(df))
- activities = create_activities(df, trips, include_person_context=False, cut_groups=False)
+ activities = create_activities(df, trips, include_person_context=False, use_index_as_pid=False, cut_groups=False)
activities.to_csv(args.output + "-activities.csv", index=False)