diff --git a/src/main/java/org/matsim/dashboard/AverageKelheimEmissionsDashboard.java b/src/main/java/org/matsim/dashboard/AverageKelheimEmissionsDashboard.java index 9ac111d..fa369af 100644 --- a/src/main/java/org/matsim/dashboard/AverageKelheimEmissionsDashboard.java +++ b/src/main/java/org/matsim/dashboard/AverageKelheimEmissionsDashboard.java @@ -130,19 +130,21 @@ public void configure(Header header, Layout layout) { 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!"; - viz.projection = "EPSG:25832"; - viz.setColorRamp(new double[]{30, 40, 50, 60, 70}, new String[]{DARK_BLUE, LIGHT_BLUE, YELLOW, SAND, ORANGE, RED}); - viz.height = 12.0; + setGridMapStandards(viz); viz.file = postProcess(data, "mean_emissions_grid_per_day.xyt.csv"); }); layout.row("third") .el(GridMap.class, (viz, data) -> { viz.title = "CO₂ Emissions"; - viz.projection = "EPSG:25832"; - viz.setColorRamp(new double[]{30, 40, 50, 60, 70}, new String[]{DARK_BLUE, LIGHT_BLUE, YELLOW, SAND, ORANGE, RED}); viz.description = "per hour. Be aware that CO2 values are provided in the simulation sample size!"; - viz.height = 12.; + setGridMapStandards(viz); viz.file = postProcess(data, "mean_emissions_grid_per_hour.csv"); }); } + + private static void setGridMapStandards(GridMap viz) { + viz.projection = "EPSG:25832"; + viz.setColorRamp(new double[]{30, 40, 50, 60, 70}, new String[]{DARK_BLUE, LIGHT_BLUE, YELLOW, SAND, ORANGE, RED}); + viz.height = 12.0; + } } diff --git a/src/main/java/org/matsim/dashboard/AverageKelheimNoiseDashboard.java b/src/main/java/org/matsim/dashboard/AverageKelheimNoiseDashboard.java index 40f34fa..b4715dd 100644 --- a/src/main/java/org/matsim/dashboard/AverageKelheimNoiseDashboard.java +++ b/src/main/java/org/matsim/dashboard/AverageKelheimNoiseDashboard.java @@ -78,55 +78,38 @@ public void configure(Header header, Layout layout) { .el(GridMap.class, (viz, data) -> { viz.title = "Noise Immissions (Grid)"; viz.description = "Total Noise Immissions per day"; - viz.height = 12.0; - viz.cellSize = 250; - viz.opacity = 0.2; - viz.maxHeight = 20; - viz.projection = "EPSG:25832"; - viz.center = data.context().getCenter(); - viz.zoom = data.context().mapZoomLevel; - viz.setColorRamp(new double[]{30, 40, 50, 60, 70}, new String[]{DARK_BLUE, LIGHT_BLUE, YELLOW, SAND, ORANGE, RED}); + setGridMapStandards(viz, data); viz.file = postProcess(data, "mean_immission_per_day.avro"); }) .el(GridMap.class, (viz, data) -> { viz.title = "Hourly Noise Immissions (Grid)"; viz.description = "Noise Immissions per hour"; - viz.height = 12.0; - viz.cellSize = 250; - viz.opacity = 0.1; - viz.maxHeight = 40; - viz.projection = "EPSG:25832"; - viz.center = data.context().getCenter(); - viz.zoom = data.context().mapZoomLevel; - viz.setColorRamp(new double[]{30, 40, 50, 60, 70}, new String[]{DARK_BLUE, LIGHT_BLUE, YELLOW, SAND, ORANGE, RED}); + setGridMapStandards(viz, data); viz.file = postProcess(data, "mean_immission_per_hour.avro"); }); layout.row("damages") .el(GridMap.class, (viz, data) -> { viz.title = "Daily Noise Damages (Grid)"; viz.description = "Total Noise Damages per day [€]"; - viz.height = 12.0; - viz.cellSize = 250; - viz.opacity = 0.1; - viz.maxHeight = 40; - viz.center = data.context().getCenter(); - viz.zoom = data.context().mapZoomLevel; - viz.projection = "EPSG:25832"; - viz.setColorRamp(new double[]{30, 40, 50, 60, 70}, new String[]{DARK_BLUE, LIGHT_BLUE, YELLOW, SAND, ORANGE, RED}); + setGridMapStandards(viz, data); viz.file = postProcess(data, "mean_damages_receiverPoint_per_day.avro"); }) .el(GridMap.class, (viz, data) -> { viz.title = "Hourly Noise Damages (Grid)"; viz.description = "Noise Damages per hour [€]"; - viz.height = 12.0; - viz.cellSize = 250; - viz.opacity = 0.2; - viz.maxHeight = 40; - viz.projection = "EPSG:25832"; - viz.center = data.context().getCenter(); - viz.zoom = data.context().mapZoomLevel; - viz.setColorRamp(new double[]{30, 40, 50, 60, 70}, new String[]{DARK_BLUE, LIGHT_BLUE, YELLOW, SAND, ORANGE, RED}); + setGridMapStandards(viz, data); viz.file = postProcess(data, "mean_damages_receiverPoint_per_hour.avro"); }); } + + private static void setGridMapStandards(GridMap viz, Data data) { + viz.height = 12.0; + viz.cellSize = 250; + viz.opacity = 0.1; + viz.maxHeight = 40; + viz.projection = "EPSG:25832"; + viz.center = data.context().getCenter(); + viz.zoom = data.context().mapZoomLevel; + viz.setColorRamp(new double[]{30, 40, 50, 60, 70}, new String[]{DARK_BLUE, LIGHT_BLUE, YELLOW, SAND, ORANGE, RED}); + } } diff --git a/src/main/java/org/matsim/dashboard/KelheimEmissionsDashboard.java b/src/main/java/org/matsim/dashboard/KelheimEmissionsDashboard.java index 952fd5c..8be2983 100644 --- a/src/main/java/org/matsim/dashboard/KelheimEmissionsDashboard.java +++ b/src/main/java/org/matsim/dashboard/KelheimEmissionsDashboard.java @@ -23,6 +23,7 @@ import org.matsim.analysis.postAnalysis.emissions.KelheimOfflineAirPollutionAnalysisByEngineInformation; import org.matsim.application.prepare.network.CreateGeoJsonNetwork; import org.matsim.simwrapper.Dashboard; +import org.matsim.simwrapper.Data; import org.matsim.simwrapper.Header; import org.matsim.simwrapper.Layout; import org.matsim.simwrapper.viz.GridMap; @@ -30,7 +31,6 @@ import org.matsim.simwrapper.viz.Table; import static org.matsim.dashboard.AverageKelheimNoiseDashboard.*; -import static org.matsim.dashboard.AverageKelheimNoiseDashboard.RED; /** * this is basically equivalent to the standard emissions dashboard @@ -95,20 +95,21 @@ public void configure(Header header, Layout layout) { 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!"; - viz.height = 12.0; - viz.projection = "EPSG:25832"; - viz.file = data.compute(KelheimOfflineAirPollutionAnalysisByEngineInformation.class, "emissions_grid_per_day.xyt.csv", new String[0]); - viz.setColorRamp(new double[]{30, 40, 50, 60, 70}, new String[]{DARK_BLUE, LIGHT_BLUE, YELLOW, SAND, ORANGE, RED}); + setGridMapStandards(viz, 12.0, data.compute(KelheimOfflineAirPollutionAnalysisByEngineInformation.class, "emissions_grid_per_day.xyt.csv", new String[0])); }); layout.row("third") .el(GridMap.class, (viz, data) -> { viz.title = "CO₂ Emissions"; viz.description = "per hour. Be aware that CO2 values are provided in the simulation sample size!"; - viz.height = 12.; - viz.projection = "EPSG:25832"; - viz.file = data.compute(KelheimOfflineAirPollutionAnalysisByEngineInformation.class, "emissions_grid_per_hour.csv"); - viz.setColorRamp(new double[]{30, 40, 50, 60, 70}, new String[]{DARK_BLUE, LIGHT_BLUE, YELLOW, SAND, ORANGE, RED}); + setGridMapStandards(viz, 12., data.compute(KelheimOfflineAirPollutionAnalysisByEngineInformation.class, "emissions_grid_per_hour.csv")); }); } + + private static void setGridMapStandards(GridMap viz, double height, String data) { + viz.height = height; + viz.projection = "EPSG:25832"; + viz.file = data; + viz.setColorRamp(new double[]{30, 40, 50, 60, 70}, new String[]{DARK_BLUE, LIGHT_BLUE, YELLOW, SAND, ORANGE, RED}); + } }