diff --git a/contribs/application/src/main/java/org/matsim/application/analysis/emissions/AirPollutionAnalysis.java b/contribs/application/src/main/java/org/matsim/application/analysis/emissions/AirPollutionAnalysis.java
index 4785de6e945..4c193d6b83c 100644
--- a/contribs/application/src/main/java/org/matsim/application/analysis/emissions/AirPollutionAnalysis.java
+++ b/contribs/application/src/main/java/org/matsim/application/analysis/emissions/AirPollutionAnalysis.java
@@ -53,9 +53,9 @@
)
@CommandSpec(requireRunDirectory = true,
produces = {
- "emissions_total.csv", "emissions_grid_per_day.xyt.csv", "emissions_per_link.csv",
+ "emissions_total.csv", "emissions_grid_per_day.csv", "emissions_per_link.csv",
"emissions_per_link_per_m.csv",
- "emissions_grid_per_hour.xyt.csv",
+ "emissions_grid_per_hour.csv",
"emissions_vehicle_info.csv",
}
)
@@ -253,7 +253,7 @@ private void writeRaster(Network network, Config config, EmissionsOnLinkEventHan
Raster raster = rasterMap.values().stream().findFirst().orElseThrow();
- try (CSVPrinter printer = new CSVPrinter(Files.newBufferedWriter(output.getPath("emissions_grid_per_day.xyt.csv")),
+ try (CSVPrinter printer = new CSVPrinter(Files.newBufferedWriter(output.getPath("emissions_grid_per_day.csv")),
CSVFormat.DEFAULT.builder().setCommentMarker('#').build())) {
String crs = ProjectionUtils.getCRS(network);
@@ -263,7 +263,7 @@ private void writeRaster(Network network, Config config, EmissionsOnLinkEventHan
crs = config.global().getCoordinateSystem();
// print coordinate system
- printer.printComment(crs);
+// printer.printComment(crs);
// print header
printer.print("time");
@@ -280,8 +280,8 @@ private void writeRaster(Network network, Config config, EmissionsOnLinkEventHan
Coord coord = raster.getCoordForIndex(xi, yi);
double value = rasterMap.get(Pollutant.CO2_TOTAL).getValueByIndex(xi, yi);
- if (value == 0)
- continue;
+// if (value == 0)
+// continue;
printer.print(0.0);
printer.print(coord.getX());
@@ -309,7 +309,7 @@ private void writeTimeDependentRaster(Network network, Config config, EmissionsO
Raster raster = firstBin.values().stream().findFirst().orElseThrow();
- try (CSVPrinter printer = new CSVPrinter(IOUtils.getBufferedWriter(output.getPath("emissions_grid_per_hour.xyt.csv").toString()),
+ try (CSVPrinter printer = new CSVPrinter(IOUtils.getBufferedWriter(output.getPath("emissions_grid_per_hour.csv").toString()),
CSVFormat.DEFAULT.builder().setCommentMarker('#').build())) {
String crs = ProjectionUtils.getCRS(network);
@@ -337,8 +337,8 @@ private void writeTimeDependentRaster(Network network, Config config, EmissionsO
Coord coord = raster.getCoordForIndex(xi, yi);
double value = timeBin.getValue().get(Pollutant.CO2_TOTAL).getValueByIndex(xi, yi);
- if (value == 0)
- continue;
+// if (value == 0)
+// continue;
printer.print(timeBin.getStartTime());
printer.print(coord.getX());
diff --git a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/EmissionsDashboard.java b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/EmissionsDashboard.java
index 2dbe51c995f..0843ab4a39b 100644
--- a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/EmissionsDashboard.java
+++ b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/EmissionsDashboard.java
@@ -5,14 +5,14 @@
import org.matsim.simwrapper.Dashboard;
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.XYTime;
/**
* Shows emission in the scenario.
*/
-public class EmissionsDashboard implements Dashboard {
+public class EmissionsDashboard implements Dashboard {
@Override
public void configure(Header header, Layout layout) {
@@ -49,11 +49,29 @@ public void configure(Header header, Layout layout) {
});
layout.row("second")
- .el(XYTime.class, (viz, data) -> {
+ .el(GridMap.class, (viz, data) -> {
viz.title = "CO₂ Emissions";
viz.description = "per day";
viz.height = 12.;
- viz.file = data.compute(AirPollutionAnalysis.class, "emissions_grid_per_day.xyt.csv");
+ viz.cellSize = 100;
+ viz.opacity = 0.5;
+ viz.maxHeight = 100;
+ viz.projection = "EPSG:25832";
+ viz.setColorRamp("RdYlGn", 10, false);
+ viz.file = data.compute(AirPollutionAnalysis.class, "emissions_grid_per_day.csv");
+ });
+
+ layout.row("third")
+ .el(GridMap.class, (viz, data) -> {
+ viz.title = "CO₂ Emissions";
+ viz.description = "per hour";
+ viz.height = 12.;
+ viz.cellSize = 100;
+ viz.opacity = 0.5;
+ viz.maxHeight = 100;
+ viz.projection = "EPSG:25832";
+ viz.setColorRamp("RdYlGn", 10, false);
+ viz.file = data.compute(AirPollutionAnalysis.class, "emissions_grid_per_hour.csv");
});
diff --git a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/OverviewDashboard.java b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/OverviewDashboard.java
index 9edbcae8cb3..0f43d12baaa 100644
--- a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/OverviewDashboard.java
+++ b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/OverviewDashboard.java
@@ -41,7 +41,7 @@ public void configure(Header header, Layout layout) {
viz.display.lineColor.dataset = "traffic";
viz.display.lineColor.columnName = "simulated_traffic_volume";
viz.display.lineColor.join = "link_id";
- viz.display.lineColor.setColorRamp(Plotly.ColorScheme.RdYlBu, 5, true);
+ viz.display.lineColor.setColorRamp(ColorScheme.RdYlBu, 5, true);
viz.display.lineWidth.dataset = "traffic";
viz.display.lineWidth.columnName = "simulated_traffic_volume";
diff --git a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/TrafficCountsDashboard.java b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/TrafficCountsDashboard.java
index bc430127bf0..5ffec552048 100644
--- a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/TrafficCountsDashboard.java
+++ b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/TrafficCountsDashboard.java
@@ -5,6 +5,7 @@
import org.matsim.simwrapper.Dashboard;
import org.matsim.simwrapper.Header;
import org.matsim.simwrapper.Layout;
+import org.matsim.simwrapper.viz.ColorScheme;
import org.matsim.simwrapper.viz.MapPlot;
import org.matsim.simwrapper.viz.Plotly;
import tech.tablesaw.plotly.components.Axis;
@@ -111,7 +112,7 @@ else if (i == labels.size() - 1)
viz.addTrace(BarTrace.builder(Plotly.OBJ_INPUT, Plotly.INPUT).orientation(BarTrace.Orientation.HORIZONTAL).build(), ds.mapping()
.x("n")
.y("source")
- .name("quality", Plotly.ColorScheme.RdYlBu)
+ .name("quality", ColorScheme.RdYlBu)
);
}).el(Plotly.class, (viz, data) -> {
@@ -128,7 +129,7 @@ else if (i == labels.size() - 1)
viz.addTrace(BarTrace.builder(Plotly.OBJ_INPUT, Plotly.INPUT).build(), ds.mapping()
.x("road_type")
.y("share")
- .name("quality", Plotly.ColorScheme.RdYlBu)
+ .name("quality", ColorScheme.RdYlBu)
);
});
@@ -195,7 +196,7 @@ else if (i == labels.size() - 1)
viz.display.lineColor.dataset = "counts";
viz.display.lineColor.columnName = "quality";
viz.display.lineColor.join = "link_id";
- viz.display.lineColor.setColorRamp(Plotly.ColorScheme.RdYlBu, labels.size(), false);
+ viz.display.lineColor.setColorRamp(ColorScheme.RdYlBu, labels.size(), false);
// 8px
viz.display.lineWidth.dataset = "@8";
diff --git a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/TrafficDashboard.java b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/TrafficDashboard.java
index 1fd01f7277e..746c3e033ed 100644
--- a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/TrafficDashboard.java
+++ b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/TrafficDashboard.java
@@ -6,6 +6,7 @@
import org.matsim.simwrapper.Dashboard;
import org.matsim.simwrapper.Header;
import org.matsim.simwrapper.Layout;
+import org.matsim.simwrapper.viz.ColorScheme;
import org.matsim.simwrapper.viz.MapPlot;
import org.matsim.simwrapper.viz.Plotly;
import org.matsim.simwrapper.viz.Table;
@@ -53,7 +54,7 @@ public void configure(Header header, Layout layout) {
viz.addTrace(ScatterTrace.builder(Plotly.INPUT, Plotly.INPUT).mode(ScatterTrace.Mode.LINE).build(), ds.mapping()
.x("hour")
.y("congestion_index")
- .name("road_type", Plotly.ColorScheme.Spectral)
+ .name("road_type", ColorScheme.Spectral)
);
})
.el(Table.class, ((viz, data) -> {
@@ -82,7 +83,7 @@ public void configure(Header header, Layout layout) {
viz.display.lineColor.dataset = "traffic";
viz.display.lineColor.columnName = "avg_speed";
viz.display.lineColor.join = "link_id";
- viz.display.lineColor.setColorRamp(Plotly.ColorScheme.RdYlBu, 5, false);
+ viz.display.lineColor.setColorRamp(ColorScheme.RdYlBu, 5, false);
viz.display.lineWidth.dataset = "traffic";
viz.display.lineWidth.columnName = "simulated_traffic_volume";
diff --git a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/TripDashboard.java b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/TripDashboard.java
index 8e1a80a1be8..30c4a140e6b 100644
--- a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/TripDashboard.java
+++ b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/TripDashboard.java
@@ -4,6 +4,7 @@
import org.matsim.simwrapper.Dashboard;
import org.matsim.simwrapper.Header;
import org.matsim.simwrapper.Layout;
+import org.matsim.simwrapper.viz.ColorScheme;
import org.matsim.simwrapper.viz.Plotly;
import org.matsim.simwrapper.viz.Table;
import tech.tablesaw.plotly.components.Axis;
@@ -95,7 +96,7 @@ public void configure(Header header, Layout layout) {
first.el(Plotly.class, (viz, data) -> {
viz.title = "Trip distance distribution";
- viz.colorRamp = Plotly.ColorScheme.Viridis;
+ viz.colorRamp = ColorScheme.Viridis;
viz.addTrace(BarTrace.builder(Plotly.OBJ_INPUT, Plotly.INPUT).name("Simulated").build(),
viz.addDataset(data.compute(TripAnalysis.class, "mode_share.csv", args))
@@ -199,7 +200,7 @@ public void configure(Header header, Layout layout) {
viz.addTrace(BarTrace.builder(Plotly.OBJ_INPUT, Plotly.INPUT).build(),
viz.addDataset(data.compute(TripAnalysis.class, "trip_purposes_by_hour.csv")).mapping()
- .name("purpose", Plotly.ColorScheme.Spectral)
+ .name("purpose", ColorScheme.Spectral)
.x("h")
.y("departure")
);
@@ -218,7 +219,7 @@ public void configure(Header header, Layout layout) {
viz.addTrace(BarTrace.builder(Plotly.OBJ_INPUT, Plotly.INPUT).build(),
viz.addDataset(data.compute(TripAnalysis.class, "trip_purposes_by_hour.csv")).mapping()
- .name("purpose", Plotly.ColorScheme.Spectral)
+ .name("purpose", ColorScheme.Spectral)
.x("h")
.y("arrival")
);
diff --git a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/viz/ColorScheme.java b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/viz/ColorScheme.java
new file mode 100644
index 00000000000..37e31cc97ca
--- /dev/null
+++ b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/viz/ColorScheme.java
@@ -0,0 +1,34 @@
+package org.matsim.simwrapper.viz;
+
+/**
+ * Utility class that holds some, but not all available color schemes.
+ * See {@link here}
+ */
+public final class ColorScheme {
+
+ public static final String Accent = "Accent";
+ public static final String Dark2 = "Dark2";
+ public static final String Paired = "Paired";
+ public static final String Pastel1 = "Pastel1";
+ public static final String Pastel2 = "Pastel2";
+ public static final String Set1 = "Set1";
+ public static final String Set2 = "Set2";
+ public static final String Set3 = "Set3";
+ public static final String Tableau10 = "Tableau10";
+ public static final String RdGy = "RdGy";
+ public static final String RdYlBu = "RdYlBu";
+ public static final String RdBu = "RdBu";
+ public static final String PiYG = "PiYG";
+ public static final String RdYlGn = "RdYlGn";
+ public static final String Spectral = "Spectral";
+ public static final String Turbo = "Turbo";
+ public static final String CubehelixDefault = "CubehelixDefault";
+ public static final String Viridis = "Viridis";
+ public static final String Inferne = "Inferne";
+ public static final String Cividis = "Cividis";
+ public static final String Rainbow = "Rainbow";
+
+
+ private ColorScheme() {
+ }
+}
diff --git a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/viz/GridMap.java b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/viz/GridMap.java
new file mode 100644
index 00000000000..cdb56165c69
--- /dev/null
+++ b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/viz/GridMap.java
@@ -0,0 +1,64 @@
+package org.matsim.simwrapper.viz;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.Map;
+
+/**
+ * The Tile plug-in creates an overview of important key figures.
+ */
+public class GridMap extends Viz {
+
+ /**
+ * The filepath containing the data.
+ */
+ @JsonProperty(required = true)
+ public String file;
+
+ /**
+ * The projection containing the projection e.g. EPSG:25832.
+ */
+ @JsonProperty(required = true)
+ public String projection;
+
+ /**
+ * The cellSize containing the cellSize in meters.
+ */
+ @JsonProperty(required = false)
+ public Integer cellSize;
+
+ /**
+ * The opacity defines the opacity of the grids (between 0 and 1);
+ */
+ @JsonProperty(required = false)
+ public Double opacity;
+
+ /**
+ * The maxHeight defines the maximum height of the "towers".
+ */
+ @JsonProperty(required = false)
+ public Integer maxHeight;
+
+ private Map colorRamp;
+
+ public GridMap() {
+ super("gridmap");
+ }
+
+ /**
+ * Set the color ramp name.
+ */
+ public GridMap setColorRamp(String ramp) {
+ colorRamp = Map.of("ramp", ramp);
+ return this;
+ }
+
+ /**
+ * Sets the full color ramps settings.
+ */
+ public GridMap setColorRamp(String ramp, int steps, boolean reverse) {
+ colorRamp = Map.of("ramp", ramp, "reverse", reverse, "steps", steps);
+ return this;
+ }
+
+}
diff --git a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/viz/Plotly.java b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/viz/Plotly.java
index fa58e6e3337..4514035af4f 100644
--- a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/viz/Plotly.java
+++ b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/viz/Plotly.java
@@ -541,37 +541,4 @@ else if (columns.containsKey(ColumnType.Y))
}
}
- /**
- * Utility class that holds some, but not all available color schemes.
- * See {@link here}
- */
- public static final class ColorScheme {
-
- public static final String Accent = "Accent";
- public static final String Dark2 = "Dark2";
- public static final String Paired = "Paired";
- public static final String Pastel1 = "Pastel1";
- public static final String Pastel2 = "Pastel2";
- public static final String Set1 = "Set1";
- public static final String Set2 = "Set2";
- public static final String Set3 = "Set3";
- public static final String Tableau10 = "Tableau10";
- public static final String RdGy = "RdGy";
- public static final String RdYlBu = "RdYlBu";
- public static final String RdBu = "RdBu";
- public static final String PiYG = "PiYG";
- public static final String RdYlGn = "RdYlGn";
- public static final String Spectral = "Spectral";
- public static final String Turbo = "Turbo";
- public static final String CubehelixDefault = "CubehelixDefault";
- public static final String Viridis = "Viridis";
- public static final String Inferne = "Inferne";
- public static final String Cividis = "Cividis";
- public static final String Rainbow = "Rainbow";
-
-
- private ColorScheme() {
- }
- }
-
}
diff --git a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/viz/XYTime.java b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/viz/XYTime.java
index 5811582a528..031871980e2 100644
--- a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/viz/XYTime.java
+++ b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/viz/XYTime.java
@@ -1,6 +1,6 @@
package org.matsim.simwrapper.viz;
- import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonProperty;
/**
* The Tile plug-in creates an overview of important key figures.
diff --git a/contribs/simwrapper/src/test/java/org/matsim/simwrapper/dashboard/EmissionsDashboardTest.java b/contribs/simwrapper/src/test/java/org/matsim/simwrapper/dashboard/EmissionsDashboardTest.java
index a809edfc795..c82e08870df 100644
--- a/contribs/simwrapper/src/test/java/org/matsim/simwrapper/dashboard/EmissionsDashboardTest.java
+++ b/contribs/simwrapper/src/test/java/org/matsim/simwrapper/dashboard/EmissionsDashboardTest.java
@@ -70,7 +70,7 @@ void generate() {
Assertions.assertThat(out)
.isDirectoryContaining("glob:**emissions_total.csv")
- .isDirectoryContaining("glob:**emissions_grid_per_day.xyt.csv");
+ .isDirectoryContaining("glob:**emissions_grid_per_day.csv");
}