This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Any | |
from tqdm import tqdm | |
import bw2calc as bc | |
import bw2data as bd | |
import pandas as pd | |
PRODUCT_NODE_TYPES = set(bd.labels.product_node_types + [bd.labels.chimaera_node_default]) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Add aggregated LCIA CFs as elementary flows | |
Usage: | |
aggregated_flows.py add <project_name> <lcia-stem> [--dryrun] [--aggregated-flow-db=<db-name>] | |
aggregated_flows.py list-stems <project_name> | |
aggregated_flows.py (-h | --help) | |
aggregated_flows.py --version | |
Options: | |
-h --help Show this screen. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Type | |
from pydantic import BaseModel | |
class Foo(BaseModel): | |
pass | |
class FooChild(Foo): | |
pass | |
class Bar(BaseModel): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bw2io.extractors.excel import ExcelExtractor | |
from ecoinvent_interface import EcoinventRelease, Settings, ReleaseType | |
from openpyxl import load_workbook | |
from scipy import sparse | |
from time import time | |
from tqdm import tqdm | |
import bw2calc as bc | |
import bw2data as bd | |
import bw2io as bi | |
import itertools |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Optional | |
from pydantic import BaseModel | |
import pandas as pd | |
from enum import Enum | |
class IRI: | |
# Can look up info | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bw2data as bd | |
import bw2calc as bc | |
ei = bd.Database("ecoinvent-3.9.1-cutoff") | |
banana_co = bd.get_node(database=ei.name, name='banana production', location="CO") | |
banana_cr = bd.get_node(database=ei.name, name='banana production', location="CR") | |
impact_categories = [ | |
('ReCiPe Endpoint (H,A)', 'ecosystem quality', 'climate change, ecosystems'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use MacOS built-in Python because it is universal | |
# i.e. works on both ARM and X64 via Rosetta | |
# Have to trick it into thinking we are x64 as pyside is not built for ARM | |
which python3 | |
arch -x86_64 python3 -m venv virtualenvs/ab_25_pypi_rosetta | |
source virtualenvs/ab_25_pypi_rosetta | |
arch -x86_64 pip install arrow networkx numpy pandas pint pyperclip pyside2 salib seaborn PyQtWebEngine ecoinvent_interface bw_graph_tools bw_simapro_csv | |
arch -x86_64 pip install --pre bw2data bw2calc bw2io bw2analyzer | |
wget https://github.com/cauldron/activity-browser/archive/refs/heads/brightway25.zip | |
unzip brightway25.zip |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bw2data, bw2io | |
BIOSPHERE_FLOW_DATABASE_LABELS = ["ecoinvent-3.9.1-biosphere"] | |
class Purolator(bw2io.package.BW2Package): | |
@classmethod | |
def _create_obj(cls, data): | |
instance = data["class"](data["name"]) | |
if data["name"] not in instance._metadata: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flowmapper.transformation_mapping import prepare_transformations | |
from flowmapper import Flow | |
from flowmapper.utils import load_standard_transformations | |
our_transform = [{ | |
"update": [{ | |
"source": | |
{ | |
"name": "2,4-D", | |
"context": "Emissions to air/" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"source": { | |
"name": "Zinc", | |
"context": "water/groundwater, long-term" | |
}, | |
"target": { | |
"name": "Zinc, ion", | |
"context": ["water", "ground-, long-term"] | |
} | |
} |
NewerOlder