Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename 'input' directory to 'scenarios' #84

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ input/sumo.net.xml: input/network.osm
--osm-files $< -o=$@


input/$V/kelheim-$V-network.xml.gz: input/sumo.net.xml
scenarios/$V/kelheim-$V-network.xml.gz: input/sumo.net.xml
$(sc) prepare network-from-sumo $<\
--output $@

Expand All @@ -82,7 +82,7 @@ input/$V/kelheim-$V-network.xml.gz: input/sumo.net.xml
--network $@\
--output $@

input/$V/kelheim-$V-network-with-pt.xml.gz: input/$V/kelheim-$V-network.xml.gz
scenarios/$V/kelheim-$V-network-with-pt.xml.gz: input/$V/kelheim-$V-network.xml.gz
$(sc) prepare transit-from-gtfs --network $<\
--name kelheim-$V --date "2021-08-18" --target-crs $(CRS) \
--output input/$V\
Expand All @@ -102,7 +102,7 @@ input/freight-trips.xml.gz: input/$V/kelheim-$V-network.xml.gz
--shp ../shared-svn/projects/KelRide/matsim-input-files/20211217_kelheim/20211217_kehlheim/kehlheim.shp --shp-crs $(CRS)\
--output $@

input/$V/kelheim-$V-25pct.plans-initial.xml.gz: input/freight-trips.xml.gz input/$V/kelheim-$V-network.xml.gz
scenarios/$V/kelheim-$V-25pct.plans-initial.xml.gz: input/freight-trips.xml.gz scenarios/$V/kelheim-$V-network.xml.gz
$(sc) prepare trajectory-to-plans\
--name prepare --sample-size 0.25\
--max-typical-duration 0\
Expand Down Expand Up @@ -141,11 +141,11 @@ input/$V/kelheim-$V-25pct.plans-initial.xml.gz: input/freight-trips.xml.gz input
--samples 0.1 0.01\


check: input/$V/kelheim-$V-25pct.plans-initial.xml.gz
check: scenarios/$V/kelheim-$V-25pct.plans-initial.xml.gz
$(sc) analysis check-population $<\
--input-crs $(CRS)\
--shp ../shared-svn/projects/KelRide/matsim-input-files/20211217_kelheim/20211217_kehlheim/kehlheim.shp --shp-crs $(CRS)

# Aggregated target
prepare: input/$V/kelheim-$V-25pct.plans-initial.xml.gz input/$V/kelheim-$V-network-with-pt.xml.gz
prepare: scenarios/$V/kelheim-$V-25pct.plans-initial.xml.gz scenarios/$V/kelheim-$V-network-with-pt.xml.gz
echo "Done"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/main/R/srv.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ theme_set(theme_Publication(18))
levels <- c("0 - 1000", "1000 - 2000", "2000 - 5000", "5000 - 10000", "10000 - 20000", "20000+")
breaks <- c(0, 1000, 2000, 5000, 10000, 20000, Inf)

shape <- st_read("../../../input/shp/dilutionArea.shp", crs=25832)
shape <- st_read("../../../scenarios/shp/dilutionArea.shp", crs=25832)

#########
# Read simulation data
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/matsim/run/RunKelheimScenario.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public RunKelheimScenario(@Nullable Config config) {
}

public RunKelheimScenario() {
super(String.format("input/v%s/kelheim-v%s-config.xml", VERSION, VERSION));
super(String.format("scenarios/v%s/kelheim-v%s-config.xml", VERSION, VERSION));
}

public static void main(String[] args) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/python/calibrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"ride": 0.17
}

city = gpd.read_file("../input/shp/dilutionArea.shp").set_crs("EPSG:25832")
homes = pd.read_csv("../input/v3.0/kelheim-v3.0-homes.csv", dtype={"person": "str"})
city = gpd.read_file("../scenarios/shp/dilutionArea.shp").set_crs("EPSG:25832")
homes = pd.read_csv("../scenarios/v3.0/kelheim-v3.0-homes.csv", dtype={"person": "str"})

def f(persons):
persons = pd.merge(persons, homes, how="inner", left_on="person", right_on="person")
Expand Down
18 changes: 9 additions & 9 deletions src/test/java/org/matsim/run/MeanNoiseDashboardTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ void runMeanNoiseDashboardTest() throws IOException {

String networkPath = "https://svn.vsp.tu-berlin.de/repos/public-svn/matsim/scenarios/countries/de/kelheim/kelheim-v3.0/input/kelheim-v3.0-network.xml.gz";
String crs = "EPSG:25832";
String path = utils.getInputDirectory();
String outputpath = utils.getOutputDirectory();
NoiseAverageAnalysis analysis = new NoiseAverageAnalysis();

List<String> foldersSeeded = new ArrayList<>();

new CreateGeoJsonNetwork().execute(List.of("--network", networkPath, "--with-properties", "--shp", "./input/shp/dilutionArea.shp", "--output-network", path + "1seed/analysis/network/network.geojson",
new CreateGeoJsonNetwork().execute(List.of("--network", networkPath, "--with-properties", "--shp", "./scenarios/shp/dilutionArea.shp", "--output-network", outputpath + "1seed/analysis/network/network.geojson",
"--input-crs", "EPSG:25832").toArray(new String[0]));

// write dummy data
Expand All @@ -67,7 +67,7 @@ void runMeanNoiseDashboardTest() throws IOException {

data.put("imissions", List.of((float) i));

String seedDir = path + i + "seed/";
String seedDir = outputpath + i + "seed/";
foldersSeeded.add(seedDir);

// write avro dummy files
Expand All @@ -86,17 +86,17 @@ void runMeanNoiseDashboardTest() throws IOException {
sw.getConfigGroup().defaultParams().mapCenter = "11.89,48.91";
sw.addDashboard(Dashboard.customize(new AverageKelheimNoiseDashboard(foldersSeeded, 3)).context("noise"));
try {
sw.generate(Path.of(path), true);
sw.generate(Path.of(outputpath), true);
} catch (IOException e) {
throw new RuntimeException(e);
}
sw.run(Path.of(path));
sw.run(Path.of(outputpath));

// assert that: a) mean immission is 2.0 on daily and hourly data b) hourly data has timestamp 28800 c) mean emission is 2.0
List<GenericRecord> daily = new ArrayList<>();
List<GenericRecord> hourly = new ArrayList<>();
analysis.readAvroFile(path + "analysis/postAnalysis-noise/mean_immission_per_day.avro", daily);
analysis.readAvroFile(path + "analysis/postAnalysis-noise/mean_immission_per_hour.avro", hourly);
analysis.readAvroFile(outputpath + "analysis/postAnalysis-noise/mean_immission_per_day.avro", daily);
analysis.readAvroFile(outputpath + "analysis/postAnalysis-noise/mean_immission_per_hour.avro", hourly);

if (daily.getFirst().get(4) instanceof HashMap<?, ?>) {
Map.Entry<?, ?> entry = ((HashMap<?, ?>) daily.getFirst().get(4)).entrySet().stream().toList().getFirst();
Expand All @@ -119,10 +119,10 @@ void runMeanNoiseDashboardTest() throws IOException {
Assertions.assertEquals(28800, timeStamp);
}

Table emissions = Table.read().csv(CsvReadOptions.builder(IOUtils.getBufferedReader(path + "analysis/postAnalysis-noise/mean_emission_per_day.csv"))
Table emissions = Table.read().csv(CsvReadOptions.builder(IOUtils.getBufferedReader(outputpath + "analysis/postAnalysis-noise/mean_emission_per_day.csv"))
.columnTypesPartial(Map.of("Link Id", ColumnType.STRING, "value", ColumnType.DOUBLE))
.sample(false)
.separator(CsvOptions.detectDelimiter(path + "analysis/postAnalysis-noise/mean_emission_per_day.csv")).build());
.separator(CsvOptions.detectDelimiter(outputpath + "analysis/postAnalysis-noise/mean_emission_per_day.csv")).build());

String linkId = emissions.row(0).getString("Link Id");
double emission = emissions.row(0).getDouble("value");
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/matsim/run/RunKelheimIntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class RunKelheimIntegrationTest {

@Test
public final void runExamplePopulationTest() {
Config config = ConfigUtils.loadConfig("input/test.config.xml");
Config config = ConfigUtils.loadConfig("scenarios/test/test.config.xml");
config.controller().setLastIteration(1);
config.global().setNumberOfThreads(1);
config.qsim().setNumberOfThreads(1);
Expand All @@ -29,7 +29,7 @@ public final void runExamplePopulationTest() {

@Test
public final void runDrtExamplePopulationTest() {
Config config = ConfigUtils.loadConfig("input/test.with-drt.config.xml");
Config config = ConfigUtils.loadConfig("scenarios/test/test.with-drt.config.xml");
config.controller().setLastIteration(1);
config.controller().setOverwriteFileSetting(OutputDirectoryHierarchy.OverwriteFileSetting.deleteDirectoryIfExists);

Expand Down
Loading