Skip to content

Commit

Permalink
Quickfix for directional-data processing (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhuppmann authored Mar 1, 2024
1 parent 4e4de1a commit 35bb33c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ def main(df: pyam.IamDataFrame) -> pyam.IamDataFrame:
# check if directional data exists in the scenario data, add to region codelist
if any([r for r in df.region if ">" in r]):
for r in df.region:
if r in definition.region:
if r in dsd.region:
continue
r_split = r.split(">")
if len(r_split) > 2:
raise ValueError(
f"Directional data other than `origin>destination` not allowed: {r}"
)
elif len(r_split) == 2:
if all([_r in definition.region for _r in r_split]):
if all([_r in dsd.region for _r in r_split]):
# add the directional-region to the codelist (without attributes)
definition.region[r] = None
dsd.region[r] = None

# run the validation and region-processing
df = process(df, dsd, processor=processor)
Expand Down

0 comments on commit 35bb33c

Please sign in to comment.