From 0a1f2c2e8046e40c379d4002295b984f11b092bc Mon Sep 17 00:00:00 2001 From: schlenther Date: Thu, 20 Jun 2024 16:25:54 +0200 Subject: [PATCH 1/2] typo in CreateDrtDashboard --- .../contrib/drt/extension/dashboards/CreateDrtDashboard.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/dashboards/CreateDrtDashboard.java b/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/dashboards/CreateDrtDashboard.java index 382092147d0..382ee1214d5 100644 --- a/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/dashboards/CreateDrtDashboard.java +++ b/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/dashboards/CreateDrtDashboard.java @@ -42,7 +42,7 @@ final class CreateDrtDashboard implements MATSimAppCommand { private static final Logger log = LogManager.getLogger(CreateDrtDashboard.class); - @CommandLine.Parameters(arity = "1..*", description = "Path to run output directories for which emission dashboards are to be generated.") + @CommandLine.Parameters(arity = "1..*", description = "Path to run output directories for which DRT dashboards are to be generated.") private List inputPaths; private CreateDrtDashboard(){ From 886ea2438b752d366640567416b3e725fddee619 Mon Sep 17 00:00:00 2001 From: schlenther Date: Thu, 20 Jun 2024 18:05:28 +0200 Subject: [PATCH 2/2] debug NoiseAnalysis and proper testing in NoiseDashboardTests --- .../application/analysis/noise/NoiseAnalysis.java | 4 ++-- .../simwrapper/dashboard/NoiseDashboardTests.java | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/contribs/application/src/main/java/org/matsim/application/analysis/noise/NoiseAnalysis.java b/contribs/application/src/main/java/org/matsim/application/analysis/noise/NoiseAnalysis.java index eb76c273c61..c5927fcdb04 100644 --- a/contribs/application/src/main/java/org/matsim/application/analysis/noise/NoiseAnalysis.java +++ b/contribs/application/src/main/java/org/matsim/application/analysis/noise/NoiseAnalysis.java @@ -110,8 +110,8 @@ public Integer call() throws Exception { private Config prepareConfig() { Config config = ConfigUtils.loadConfig(ApplicationUtils.matchInput("config.xml", input.getRunDirectory()).toAbsolutePath().toString(), new NoiseConfigGroup()); - //it is important to match "output_vehicles" because otherwise dvrpVehicle files might be matched and the code crashes later - config.vehicles().setVehiclesFile(ApplicationUtils.matchInput("output_vehicles", input.getRunDirectory()).toAbsolutePath().toString()); + //it is important to match "output_vehicles.xml.gz" specifically, because otherwise dvrpVehicle files might be matched and the code crashes later + config.vehicles().setVehiclesFile(ApplicationUtils.matchInput("output_vehicles.xml.gz", input.getRunDirectory()).toAbsolutePath().toString()); config.network().setInputFile(ApplicationUtils.matchInput("network", input.getRunDirectory()).toAbsolutePath().toString()); config.transit().setTransitScheduleFile(null); config.transit().setVehiclesFile(null); diff --git a/contribs/simwrapper/src/test/java/org/matsim/simwrapper/dashboard/NoiseDashboardTests.java b/contribs/simwrapper/src/test/java/org/matsim/simwrapper/dashboard/NoiseDashboardTests.java index 58c3182b5ba..6ca2a08cee3 100644 --- a/contribs/simwrapper/src/test/java/org/matsim/simwrapper/dashboard/NoiseDashboardTests.java +++ b/contribs/simwrapper/src/test/java/org/matsim/simwrapper/dashboard/NoiseDashboardTests.java @@ -1,5 +1,6 @@ package org.matsim.simwrapper.dashboard; +import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; import org.matsim.application.MATSimApplication; @@ -15,6 +16,7 @@ import java.net.URL; +import java.nio.file.Path; public class NoiseDashboardTests { @@ -24,6 +26,8 @@ public class NoiseDashboardTests { @Test void generate() { + Path out = Path.of(utils.getOutputDirectory(), "analysis", "noise"); + Config config = TestScenario.loadConfig(utils); config.global().setCoordinateSystem("EPSG:25832"); @@ -34,11 +38,14 @@ void generate() { simWrapperConfigGroup.defaultParams().shp = IOUtils.extendUrl(kelheim, "area/area.shp").toString(); - SimWrapper sw = SimWrapper.create(config).addDashboard(new NoiseDashboard()); Controler controler = MATSimApplication.prepare(new TestScenario(sw), config); - controler.run(); + + Assertions.assertThat(out) + .isDirectoryContaining("glob:**emission_per_day.csv") + .isDirectoryContaining("glob:**immission_per_day.avro") + .isDirectoryContaining("glob:**immission_per_hour.avro"); } }