Skip to content

Commit

Permalink
scenarios metadata fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mrvisscher committed Sep 24, 2024
1 parent eda23d1 commit 8b2aacb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 3 additions & 3 deletions bw_scenarios/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from pathlib import Path

from .scenario import Scenario
from .strategies import separate_code_from_key


class SDFImporter:
Expand Down Expand Up @@ -133,8 +132,9 @@ def scenario_names(self) -> list:
return [
col
for col in self.data.columns
if col
not in self.TO_FIELDS + self.FROM_FIELDS + ["default", "from id", "to id"]
if not col.startswith("to ")
and not col.startswith("from ")
and col not in ["flow type", "default"]
]

def apply_strategies(self):
Expand Down
7 changes: 6 additions & 1 deletion bw_scenarios/meta.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
from bw2data.serialization import SerializedDict

from bw2data.configuration import config

class Scenarios(SerializedDict):
filename = "scenarios.json"

def serialize(self, filepath=None):
super().serialize(filepath)


scenarios = Scenarios()

config.metadata.extend([scenarios])
3 changes: 3 additions & 0 deletions bw_scenarios/scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ def add_exchange(self, from_id, to_id, exchange_type, amount):
def save(self):
self.write(self.exchanges)

def process(self, **extra_metadata):
return

0 comments on commit 8b2aacb

Please sign in to comment.