Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let data writer distinguish between m and g as product dimensions #41

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions sodym/export/data_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,20 @@ def visualize_sankey(self, mfa: MFASystem):
region_id = 0
carbon_only = True

# Get product dim letter
mfa_dim_letters = mfa.dims.letters
if 'm' in mfa_dim_letters:
product_dim_letter = 'm'
elif 'g' in mfa_dim_letters:
product_dim_letter = 'g'
assert 'product_dim_letter' in locals()

nodes = [p for p in mfa.processes.values() if p.name not in exclude_nodes]
ids_in_sankey = {p.id: i for i, p in enumerate(nodes)}
exclude_node_ids = [p.id for p in mfa.processes.values() if p.name in exclude_nodes]

if self.sankey["color_scheme"] == "blueish":
material_colors = [f"hsv({10 * i + 200},40,150)" for i in range(mfa.dims['m'].len)]
material_colors = [f"hsv({10 * i + 200},40,150)" for i in range(mfa.dims[product_dim_letter].len)]
# elif color_scheme == "antique":
# material_colors = pl.colors.qualitative.Antique[: mfa.dims[cfg.product_dimension_name].len]
# elif color_scheme == "viridis":
Expand All @@ -82,8 +90,6 @@ def add_link(**kwargs):
for key, value in kwargs.items():
link_dict[key].append(value)

product_dim_letter = 'm'

for f in mfa.flows.values():
if (
(f.name in exclude_flows)
Expand Down