Skip to content

Commit 10f2fc3

Browse files
committed
Add .transport.plot.MultiFE
1 parent 6904948 commit 10f2fc3

File tree

1 file changed

+41
-0
lines changed
  • message_ix_models/model/transport

1 file changed

+41
-0
lines changed

message_ix_models/model/transport/plot.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,43 @@ def generate(self, y0: int, data):
550550
yield ggplot
551551

552552

553+
class MultiFE(PlotFromIAMC):
554+
"""Final energy, passenger."""
555+
556+
basename = "multi-fe"
557+
single = False
558+
559+
inputs = ["all:n-s-UNIT-v-y"]
560+
561+
# NB This pattern excludes the total. A pattern which includes the total (as an
562+
# empty string in the 'v' dimension) is:
563+
# r"Final Energy\|Transportation\|P\|?(|Electricity|Gas|Hydrogen|Liquids.*)"
564+
iamc_variable_pattern = (
565+
r"Final Energy\|Transportation\|P\|(Electricity|Gas|Hydrogen|Liquids.*)"
566+
)
567+
568+
static = STATIC + [
569+
p9.aes(x="y", y="value", fill="v"),
570+
p9.facet_wrap("s", ncol=3, nrow=5),
571+
p9.geom_area(color="black", size=0.2),
572+
p9.scale_fill_brewer(type="qualitative", palette="Paired"),
573+
p9.labs(x="Period", y="", fill="Technology"),
574+
COMMON["A3 portrait"],
575+
]
576+
577+
def generate(self, data):
578+
# Show only data in the model horizon
579+
# TODO Remove once historical data are included in the input
580+
data = data.query("y >= 2020")
581+
582+
self.unit = data["unit"].unique()[0]
583+
584+
for _, ggplot in self.groupby_plot(data, "n"):
585+
# Maximum y-limit for this node
586+
y_max = max(ggplot.data["value"])
587+
yield ggplot + p9.expand_limits(y=[0, y_max])
588+
589+
553590
class MultiStock(PlotFromIAMC):
554591
"""LDV technology stock."""
555592

@@ -569,6 +606,10 @@ class MultiStock(PlotFromIAMC):
569606
]
570607

571608
def generate(self, data):
609+
# Show only data in the model horizon
610+
# TODO Remove once historical data are included in the input
611+
data = data.query("y >= 2020")
612+
572613
self.unit = data["unit"].unique()[0]
573614

574615
for _, ggplot in self.groupby_plot(data, "n"):

0 commit comments

Comments
 (0)