From d61e3338b9dbabde6fea2963713a2ac1146855db Mon Sep 17 00:00:00 2001 From: SabineHaas Date: Thu, 10 Oct 2024 10:42:40 +0200 Subject: [PATCH 1/2] Adapt emission bus names in test --- .../examples/datapackages/GHG/data/elements/bus.csv | 6 +++--- .../GHG/data/elements/commodityGHG_import.csv | 6 +++--- .../datapackages/GHG/data/elements/conversionGHG.csv | 4 ++-- .../tabular/examples/datapackages/GHG/datapackage.json | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/oemof/tabular/examples/datapackages/GHG/data/elements/bus.csv b/src/oemof/tabular/examples/datapackages/GHG/data/elements/bus.csv index a1eb6e3..b67ade2 100644 --- a/src/oemof/tabular/examples/datapackages/GHG/data/elements/bus.csv +++ b/src/oemof/tabular/examples/datapackages/GHG/data/elements/bus.csv @@ -1,6 +1,6 @@ name;type;balanced -co2;bus;false -ch4;bus;false -n2o;bus;false +emi_co2;bus;false +emi_ch4;bus;false +emi_n2o;bus;false el_bus;bus;true gas_bus;bus;true diff --git a/src/oemof/tabular/examples/datapackages/GHG/data/elements/commodityGHG_import.csv b/src/oemof/tabular/examples/datapackages/GHG/data/elements/commodityGHG_import.csv index fc5e7c2..4d41d2f 100644 --- a/src/oemof/tabular/examples/datapackages/GHG/data/elements/commodityGHG_import.csv +++ b/src/oemof/tabular/examples/datapackages/GHG/data/elements/commodityGHG_import.csv @@ -1,3 +1,3 @@ -name;type;carrier;amount;bus;emission_bus_0;marginal_cost;output_parameters;emission_factor_co2 -green_gas_import;commodity_ghg;gas;300;gas_bus;co2;20;{"max": [1, 1, 1]};-56 -fossile_gas_import;commodity_ghg;gas;200;gas_bus;co2;10;{"max": [1, 0, 0]};56 +name;type;carrier;amount;bus;emission_bus_0;marginal_cost;output_parameters;emission_factor_emi_co2 +green_gas_import;commodity_ghg;gas;300;gas_bus;emi_co2;20;{"max": [1, 1, 1]};-56 +fossile_gas_import;commodity_ghg;gas;200;gas_bus;emi_co2;10;{"max": [1, 0, 0]};56 diff --git a/src/oemof/tabular/examples/datapackages/GHG/data/elements/conversionGHG.csv b/src/oemof/tabular/examples/datapackages/GHG/data/elements/conversionGHG.csv index 9db64f0..13cb5b7 100644 --- a/src/oemof/tabular/examples/datapackages/GHG/data/elements/conversionGHG.csv +++ b/src/oemof/tabular/examples/datapackages/GHG/data/elements/conversionGHG.csv @@ -1,2 +1,2 @@ -name;type;carrier;tech;capacity;from_bus;to_bus;emission_bus_0;emission_bus_1;emission_bus_2;marginal_cost;efficiency;emission_factor_co2;emission_factor_ch4;emission_factor_n2o -gtGHG;conversion_ghg;electricity;gt;300;gas_bus;el_bus;co2;ch4;n2o;10;0.5;56;0.4;0.017 +name;type;carrier;tech;capacity;from_bus;to_bus;emission_bus_0;emission_bus_1;emission_bus_2;marginal_cost;efficiency;emission_factor_emi_co2;emission_factor_emi_ch4;emission_factor_emi_n2o +gtGHG;conversion_ghg;electricity;gt;300;gas_bus;el_bus;emi_co2;emi_ch4;emi_n2o;10;0.5;56;0.4;0.017 diff --git a/src/oemof/tabular/examples/datapackages/GHG/datapackage.json b/src/oemof/tabular/examples/datapackages/GHG/datapackage.json index 6050686..ef021bf 100644 --- a/src/oemof/tabular/examples/datapackages/GHG/datapackage.json +++ b/src/oemof/tabular/examples/datapackages/GHG/datapackage.json @@ -105,17 +105,17 @@ "format": "default" }, { - "name": "emission_factor_co2", + "name": "emission_factor_emi_co2", "type": "number", "format": "default" }, { - "name": "emission_factor_ch4", + "name": "emission_factor_emi_ch4", "type": "number", "format": "default" }, { - "name": "emission_factor_n2o", + "name": "emission_factor_emi_n2o", "type": "number", "format": "default" } @@ -213,7 +213,7 @@ "format": "default" }, { - "name": "emission_factor_co2", + "name": "emission_factor_emi_co2", "type": "number", "format": "default" } From 249168067988db9761c80be8f7e7bf5fd59e5098 Mon Sep 17 00:00:00 2001 From: SabineHaas Date: Thu, 10 Oct 2024 10:43:14 +0200 Subject: [PATCH 2/2] Make naming of emission buses more open --- src/oemof/tabular/facades/commodity_ghg.py | 2 +- src/oemof/tabular/facades/conversion_ghg.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/oemof/tabular/facades/commodity_ghg.py b/src/oemof/tabular/facades/commodity_ghg.py index a454608..6240255 100644 --- a/src/oemof/tabular/facades/commodity_ghg.py +++ b/src/oemof/tabular/facades/commodity_ghg.py @@ -97,7 +97,7 @@ def init_emission_factors(self, buses, kwargs): emission_factors = {} for key, value in list(kwargs.items()): if key.startswith("emission_factor"): - bus_label = key.split("_")[-1] + bus_label = key.removeprefix("emission_factor_") try: bus = [ bus diff --git a/src/oemof/tabular/facades/conversion_ghg.py b/src/oemof/tabular/facades/conversion_ghg.py index 2e34530..0da58bc 100644 --- a/src/oemof/tabular/facades/conversion_ghg.py +++ b/src/oemof/tabular/facades/conversion_ghg.py @@ -111,7 +111,7 @@ def init_emission_factors(self, buses, kwargs): """Adds emission factors as `conversion_factors""" for key, value in list(kwargs.items()): if key.startswith("emission_factor"): - bus_label = key.split("_")[-1] + bus_label = key.removeprefix("emission_factor_") try: bus = [ bus