diff --git a/src/main/java/org/matsim/dashboard/AverageKelheimEmissionsDashboard.java b/src/main/java/org/matsim/dashboard/AverageKelheimEmissionsDashboard.java index ddf3036..da115ca 100644 --- a/src/main/java/org/matsim/dashboard/AverageKelheimEmissionsDashboard.java +++ b/src/main/java/org/matsim/dashboard/AverageKelheimEmissionsDashboard.java @@ -25,9 +25,7 @@ import org.matsim.simwrapper.Data; import org.matsim.simwrapper.Header; import org.matsim.simwrapper.Layout; -import org.matsim.simwrapper.viz.GridMap; -import org.matsim.simwrapper.viz.Links; -import org.matsim.simwrapper.viz.Table; +import org.matsim.simwrapper.viz.*; import java.nio.file.Path; import java.util.ArrayList; @@ -53,10 +51,14 @@ public AverageKelheimEmissionsDashboard(List dirs, Integer noRuns, Strin this.dirs = dirs; this.noRuns = noRuns; - if (!pathToBaseRun.endsWith("/")) { - pathToBaseRun += "/"; + if(pathToBaseRun == null || pathToBaseRun.equals("null")){ + this.pathToCsvBase = null; + } else { + if (!pathToBaseRun.endsWith("/")) { + pathToBaseRun += "/"; + } + this.pathToCsvBase = pathToBaseRun + "analysis/emissions/emissions_per_link_per_m.csv"; } - this.pathToCsvBase = pathToBaseRun + "analysis/emissions/emissions_per_link_per_m.csv"; } private String postProcess(Data data, String outputFile) { @@ -70,8 +72,8 @@ private String postProcess(Data data, String outputFile) { * Produces the dashboard. */ public void configure(Header header, Layout layout) { - header.title = "Average Emissions"; - header.description = "Shows the average emissions footprint and spatial distribution for several simulation runs."; + header.title = "Average Air Pollution"; + header.description = "Shows the average air pollution and spatial distribution for several simulation runs."; String linkDescription = "Displays the emissions for each link per meter. Be aware that emission values are provided in the simulation sample size!"; if (pathToCsvBase != null){ @@ -88,12 +90,16 @@ public void configure(Header header, Layout layout) { viz.showAllRows = true; viz.width = 1.0; }) - .el(Links.class, (viz, data) -> { - viz.title = "Emissions per Link per Meter"; + /** + * Commented out link panel, because the MapPlot can show a legend and seems to be the development head. + * However, it doesn't seem to have the pointer to the base case + */ + /*.el(Links.class, (viz, data) -> { + viz.title = "Emitted Pollutant in Gram per Meter"; viz.description = finalLinkDescription; viz.height = 12.0; viz.datasets.csvFile = postProcess(data, "mean_emissions_per_link_per_m.csv"); - viz.datasets.csvBase = Path.of(this.dirs.get(0)).getParent().relativize(Path.of(pathToCsvBase)).toString(); + viz.datasets.csvBase = pathToCsvBase == null ? "" : Path.of(this.dirs.get(0)).getParent().relativize(Path.of(pathToCsvBase)).toString(); viz.network = new CreateAverageDashboards().copyVizNetwork(dirs, ".avro"); viz.display.color.columnName = "CO2_TOTAL [g/m]"; viz.display.color.dataset = "csvFile"; @@ -101,8 +107,27 @@ public void configure(Header header, Layout layout) { viz.display.width.columnName = "CO2_TOTAL [g/m]"; viz.display.width.dataset = "csvFile"; viz.center = data.context().getCenter(); + viz.width = 1.0; + })*/ + .el(MapPlot.class, (viz, data) -> { + viz.title = "Emitted Pollutant in Gram per Meter"; + viz.description = finalLinkDescription; + viz.height = 12.0; + viz.center = data.context().getCenter(); + viz.zoom = data.context().mapZoomLevel; + viz.setShape(new CreateAverageDashboards().copyVizNetwork(dirs, ".avro"), "id"); + viz.addDataset("emissions_per_m", postProcess(data, "mean_emissions_per_link_per_m.csv")); + viz.display.lineColor.dataset = "emissions_per_m"; + viz.display.lineColor.columnName = "CO2_TOTAL [g/m]"; + viz.display.lineColor.join = "linkId"; + viz.display.lineColor.setColorRamp(ColorScheme.Oranges, 8, false, "35, 45, 55, 65, 75, 85, 95"); + viz.display.lineWidth.dataset = "emissions_per_m"; + viz.display.lineWidth.columnName = "CO2_TOTAL [g/m]"; + viz.display.lineWidth.scaleFactor = 100d; + viz.display.lineWidth.join = "linkId"; viz.width = 3.0; - }); + }); + layout.row("second").el(GridMap.class, (viz, data) -> { viz.title = "CO₂ Emissions"; viz.description = "per day. Be aware that CO2 values are provided in the simulation sample size!"; diff --git a/src/main/java/org/matsim/dashboard/AverageKelheimNoiseDashboard.java b/src/main/java/org/matsim/dashboard/AverageKelheimNoiseDashboard.java index 92d89e2..40f34fa 100644 --- a/src/main/java/org/matsim/dashboard/AverageKelheimNoiseDashboard.java +++ b/src/main/java/org/matsim/dashboard/AverageKelheimNoiseDashboard.java @@ -14,7 +14,7 @@ import java.util.List; /** - * Shows emission in the scenario. + * Averages and displays the noise outcome of single runs. */ public class AverageKelheimNoiseDashboard implements Dashboard { diff --git a/src/main/java/org/matsim/dashboard/CreateAverageDashboards.java b/src/main/java/org/matsim/dashboard/CreateAverageDashboards.java index b6dffb3..0b923b4 100644 --- a/src/main/java/org/matsim/dashboard/CreateAverageDashboards.java +++ b/src/main/java/org/matsim/dashboard/CreateAverageDashboards.java @@ -24,18 +24,14 @@ final class CreateAverageDashboards implements MATSimAppCommand { private String inputPath; @CommandLine.Option(names = "--no-runs", defaultValue = "5", description = "Number of simulation runs to be averaged.") private Integer noRuns; - @CommandLine.Option(names = "--base-run", description = "Path to directory base run.", defaultValue = "/net/ils/matsim-kelheim/v3.0-release/output-base/25pct") + @CommandLine.Option(names = "--base-run", description = "Path to directory base run.") private String pathToBaseRun; public static void main(String[] args) { new CreateAverageDashboards().execute(args); } - CreateAverageDashboards() { - - } - - + CreateAverageDashboards() {} @Override public Integer call() throws Exception { diff --git a/src/main/java/org/matsim/dashboard/KelheimEmissionsDashboard.java b/src/main/java/org/matsim/dashboard/KelheimEmissionsDashboard.java index c12f382..1eade5e 100644 --- a/src/main/java/org/matsim/dashboard/KelheimEmissionsDashboard.java +++ b/src/main/java/org/matsim/dashboard/KelheimEmissionsDashboard.java @@ -57,10 +57,10 @@ public KelheimEmissionsDashboard(String pathToBaseRun) { */ public void configure(Header header, Layout layout) { - header.title = "Emissions"; - header.description = "Shows the emissions footprint and spatial distribution."; + header.title = "Air Pollution"; + header.description = "Shows the air pollution and spatial distribution."; - String linkDescription = "Displays the emissions for each link per meter. Be aware that emission values are provided in the simulation sample size!"; + String linkDescription = "Displays the emitted pair pollutants for each link per meter. Be aware that pollutant values are provided in the simulation sample size!"; if (pathToCsvBase != null){ linkDescription += String.format("%n Base is %s", pathToCsvBase); } @@ -68,7 +68,7 @@ public void configure(Header header, Layout layout) { layout.row("links") .el(Table.class, (viz, data) -> { - viz.title = "Emissions"; + viz.title = "Air Pollution"; viz.description = "by pollutant. Total values are scaled from the simulation sample size to 100%."; viz.dataset = data.compute(KelheimOfflineAirPollutionAnalysisByEngineInformation.class, "emissions_total.csv", new String[0]); viz.enableFilter = false; @@ -76,7 +76,7 @@ public void configure(Header header, Layout layout) { viz.width = 1.0; }) .el(Links.class, (viz, data) -> { - viz.title = "Emissions per Link per Meter"; + viz.title = "Emitted Pollutant in Gram per Meter"; viz.description = finalLinkDescription; viz.height = 12.0; viz.datasets.csvFile = data.compute(KelheimOfflineAirPollutionAnalysisByEngineInformation.class, "emissions_per_link_per_m.csv", new String[0]);