Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pathways' into pathways
Browse files Browse the repository at this point in the history
# Conflicts:
#	docs/transform.rst
#	premise/__init__.py
#	premise/data/additional_inventories/lci-pass_cars.xlsx
#	premise/data/additional_inventories/lci-trucks.xlsx
#	premise/data/consequential/leadtimes.yaml
#	premise/data/transport/vehicles_map.yaml
#	premise/data/utils/export/simapro_categories.csv
  • Loading branch information
romainsacchi authored and romainsacchi committed Oct 16, 2024
2 parents 32cb2bc + 72a160c commit 6a60b57
Show file tree
Hide file tree
Showing 14 changed files with 8,817 additions and 8,096 deletions.
393 changes: 189 additions & 204 deletions dev/Untitled1.ipynb

Large diffs are not rendered by default.

Binary file modified premise/data/additional_inventories/lci-PGM.xlsx
Binary file not shown.
Binary file modified premise/data/additional_inventories/lci-batteries-vanadium.xlsx
Binary file not shown.
Binary file modified premise/data/additional_inventories/lci-germanium.xlsx
Binary file not shown.
Binary file modified premise/data/additional_inventories/lci-pass_cars.xlsx
Binary file not shown.
Binary file modified premise/data/additional_inventories/lci-rhenium.xlsx
Binary file not shown.
Binary file modified premise/data/additional_inventories/lci-trucks.xlsx
Binary file not shown.
15,724 changes: 7,862 additions & 7,862 deletions premise/data/electricity/coal_power_emissions_2012_v1.csv

Large diffs are not rendered by default.

Binary file modified premise/data/metals/mining_shares_mapping.xlsx
Binary file not shown.
525 changes: 508 additions & 17 deletions premise/data/metals/post-allocation correction/corrections.yaml

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions premise/data/utils/export/simapro_categories.csv
Original file line number Diff line number Diff line change
Expand Up @@ -1631,8 +1631,8 @@ disodium disulphite,disodium disulphite,material,Others\Obsolete
disodium disulphite production,disodium disulphite,material,Chemicals\Inorganic\Transformation
"display production, cathode ray tube, 17 inches","display, cathode ray tube, 17 inches",material,Electronics\Devices\Transformation
"display production, liquid crystal, 17 inches","display, liquid crystal, 17 inches",material,Electronics\Devices\Transformation
Distiller"s Dried Grains with Solubles to generic market for protein feed,"energy feed, gross",material,Agricultural\Animal feed\Market
Distiller"s Dried Grains with Solubles to generic market for protein feed,"protein feed, 100% crude",material,Agricultural\Animal feed\Market
Distiller's Dried Grains with Solubles to generic market for protein feed,"energy feed, gross",material,Agricultural\Animal feed\Market
Distiller's Dried Grains with Solubles to generic market for protein feed,"protein feed, 100% crude",material,Agricultural\Animal feed\Market
"distribution network construction, electricity, low voltage","distribution network, electricity, low voltage",transport,Electricity\Transformation\Infrastructure
distribution sheds,distribution sheds,transport,Road\Transformation\Infrastructure
dithiocarbamate-compound production,dithiocarbamate-compound,material,Chemicals\Pesticides\Transformation
Expand Down Expand Up @@ -2073,11 +2073,11 @@ ethanol fermentation plant construction,ethanol fermentation plant,material,Fuel
ethanol production from grass,grass fibre,material,Agricultural\Animal feed\Transformation
ethanol production from grass,"protein feed, 100% crude",material,Agricultural\Animal feed\Transformation
ethanol production from grass,"ethanol, without water, in 95% solution state, from fermentation",material,Fuels\Biofuels\Ethanol\Transformation
ethanol production from maize,distiller"s Dried Grains with Solubles,material,Agricultural\Animal feed\Transformation
ethanol production from maize,distiller's Dried Grains with Solubles,material,Agricultural\Animal feed\Transformation
ethanol production from maize,"ethanol, without water, in 95% solution state, from fermentation",material,Fuels\Biofuels\Ethanol\Transformation
ethanol production from potatoes,distiller"s Dried Grains with Solubles,material,Agricultural\Animal feed\Transformation
ethanol production from potatoes,distiller's Dried Grains with Solubles,material,Agricultural\Animal feed\Transformation
ethanol production from potatoes,"ethanol, without water, in 95% solution state, from fermentation",material,Fuels\Biofuels\Ethanol\Transformation
ethanol production from rye,distiller"s Dried Grains with Solubles,material,Agricultural\Animal feed\Transformation
ethanol production from rye,distiller's Dried Grains with Solubles,material,Agricultural\Animal feed\Transformation
ethanol production from rye,"ethanol, without water, in 95% solution state, from fermentation",material,Fuels\Biofuels\Ethanol\Transformation
ethanol production from sugar beet,sugar beet pulp,material,Agricultural\Plant production\Sugar beets\Transformation
ethanol production from sugar beet,"ethanol, without water, in 95% solution state, from fermentation",material,Fuels\Biofuels\Ethanol\Transformation
Expand Down Expand Up @@ -5367,8 +5367,8 @@ market for dishwasher,dishwasher,material,Appliances\Market\Infrastructure
market for disodium disulphite,disodium disulphite,material,Chemicals\Inorganic\Market
"market for display, cathode ray tube, 17 inches","display, cathode ray tube, 17 inches",material,Electronics\Devices\Market
"market for display, liquid crystal, 17 inches","display, liquid crystal, 17 inches",material,Electronics\Devices\Market
market for Distiller"s Dried Grains with Solubles,distiller"s Dried Grains with Solubles,material,Agricultural\Animal feed\Market
market for Distiller"s Dried Grains with Solubles_obsolete,distiller"s Dried Grains with Solubles,waste treatment,Others\Obsolete
market for Distiller's Dried Grains with Solubles,distiller's Dried Grains with Solubles,material,Agricultural\Animal feed\Market
market for Distiller's Dried Grains with Solubles_obsolete,distiller's Dried Grains with Solubles,waste treatment,Others\Obsolete
"market for distribution network, electricity, low voltage","distribution network, electricity, low voltage",transport,Electricity\Market\Infrastructure
market for dithiocarbamate-compound,dithiocarbamate-compound,material,Chemicals\Pesticides\Market
market for dodecanol,dodecanol,material,Chemicals\Organic\Market
Expand Down Expand Up @@ -7719,7 +7719,7 @@ market for stone wool,stone wool,material,Construction\Insulation\Market
market for stone wool factory,stone wool factory,material,Construction\Insulation\Market\Infrastructure
"market for stone wool, packed","stone wool, packed",material,Construction\Insulation\Market
"market for storage building, chemicals, solid","storage building, chemicals, solid",material,Chemicals\Others\Market\Infrastructure
"market for storage, 10"000 l","storage, 10"000 l",energy,Cogeneration\Gas\Market\Infrastructure
"market for storage, 10'000 l","storage, 10'000 l",energy,Cogeneration\Gas\Market\Infrastructure
"market for storage, 650 l mini CHP plant","storage, 650 l mini CHP plant",energy,Cogeneration\Gas\Market\Infrastructure
market for straw,straw,material,Agricultural\Plant production\Roughage\Market
"market for straw, organic","straw, organic",material,Agricultural\Plant production\Roughage\Market
Expand Down Expand Up @@ -8772,8 +8772,8 @@ miscanthus production,"miscanthus, chopped",material,Agricultural\Plant producti
"miscanthus rhizome production, for planting","miscanthus rhizome, for planting",material,Agricultural\Plant seeds\Transformation
"mischmetal production, primary",mischmetal,material,Metals\Non ferro\Transformation
"mixed natural gas and biomethane production, high pressure","mixed natural gas and biomethane, high pressure",material,Fuels\Natural gas\Transformation
"modified Solvay process, Hou"s process",ammonium chloride,material,Chemicals\Inorganic\Transformation
"modified Solvay process, Hou"s process","soda ash, dense",material,Chemicals\Inorganic\Transformation
"modified Solvay process, Hou's process",ammonium chloride,material,Chemicals\Inorganic\Transformation
"modified Solvay process, Hou's process","soda ash, dense",material,Chemicals\Inorganic\Transformation
"module packaging, for li-o2 battery",module packaging,material,Electronics\Battery\Transformation
moisture separator-reheater HTP-LPT EPR,moisture separator-reheater HTP-LPT EPR,energy,Heat\Others\Transformation
"molasses, from sugar beet, to generic market for energy feed","energy feed, gross",material,Agricultural\Animal feed\Market
Expand Down Expand Up @@ -10656,8 +10656,8 @@ smelting and refining of nickel ore,"ammonium sulfate, as N",material,Others\Obs
"sng from wood, production plant","sng from wood, production plant",material,Others\Obsolete
sng production plant,sng production plant,material,Others\Obsolete
soap production,soap,material,Chemicals\Washing agents\Tensides\Transformation
"soda ash production, dense, Hou"s process",ammonium chloride,waste treatment,Landfill\Slag compartment\Transformation
"soda ash production, dense, Hou"s process","soda ash, dense",waste treatment,Landfill\Slag compartment\Transformation
"soda ash production, dense, Hou's process",ammonium chloride,waste treatment,Landfill\Slag compartment\Transformation
"soda ash production, dense, Hou's process","soda ash, dense",waste treatment,Landfill\Slag compartment\Transformation
"soda ash, dense, to generic market for neutralising agent","neutralising agent, sodium hydroxide-equivalent",material,Chemicals\Inorganic\Market
"soda ash, light, crystalline, heptahydrate, to generic market for neutralising agent","neutralising agent, sodium hydroxide-equivalent",material,Chemicals\Inorganic\Market
"soda production, solvay process",calcium chloride,material,Chemicals\Inorganic\Transformation
Expand Down Expand Up @@ -10842,7 +10842,7 @@ stone wool production,stone wool,material,Construction\Insulation\Transformation
"stone wool production, packed","stone wool, packed",material,Construction\Insulation\Transformation
storage battery,storage battery,transport,Road\Transformation\Infrastructure
"storage building construction, chemicals, solid","storage building, chemicals, solid",material,Chemicals\Others\Transformation\Infrastructure
"storage production, 10"000 l","storage, 10"000 l",energy,Cogeneration\Gas\Transformation\Infrastructure
"storage production, 10'000 l","storage, 10'000 l",energy,Cogeneration\Gas\Transformation\Infrastructure
"storage production, 650 l mini CHP plant","storage, 650 l mini CHP plant",energy,Cogeneration\Gas\Transformation\Infrastructure
"straw production, stand-alone production","straw, stand-alone production",material,Agricultural\Plant production\Roughage\Transformation
"strawberry production, in heated greenhouse",strawberry,material,Agricultural\Plant production\Fruits\Transformation
Expand Down
82 changes: 82 additions & 0 deletions tests/test_process_ei38_conseq.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import gc
import os

import bw2calc
import bw2data
import bw2io
import pytest
from dotenv import load_dotenv

from premise import NewDatabase, clear_inventory_cache
from premise.utils import delete_all_pickles

load_dotenv()


ei_user = os.environ["EI_USERNAME"]
ei_pass = os.environ["EI_PASSWORD"]
key = os.environ["IAM_FILES_KEY"]
# convert to bytes
key = key.encode()

ei_version = "3.8"
system_model = "consequential"


scenarios = [
{"model": "remind", "pathway": "SSP2-Base", "year": 2050},
{"model": "image", "pathway": "SSP2-RCP19", "year": 2050},
]


@pytest.mark.slow
def test_brightway():

bw2data.projects.set_current(f"ecoinvent-{ei_version}-{system_model}")

clear_inventory_cache()

if f"ecoinvent-{ei_version}-{system_model}" not in bw2data.databases:
bw2io.import_ecoinvent_release(
version=ei_version,
system_model=system_model,
username=ei_user,
password=ei_pass,
)

ndb = NewDatabase(
scenarios=scenarios,
source_db=f"ecoinvent-{ei_version}-{system_model}",
source_version=ei_version,
key=key,
system_model=system_model,
biosphere_name=f"ecoinvent-{ei_version}-biosphere",
)

ndb.update()

if "test1" in bw2data.databases:
del bw2data.databases["test1"]
if "test2" in bw2data.databases:
del bw2data.databases["test2"]

ndb.write_db_to_brightway(
[
"test1",
"test2",
]
)

method = [m for m in bw2data.methods if "IPCC" in m[0]][0]

lca = bw2calc.LCA({bw2data.Database("test1").random(): 1}, method)
lca.lci()
lca.lcia()
assert isinstance(lca.score, float)
print(lca.score)

# destroy all objects
del ndb
del lca
gc.collect()
delete_all_pickles()
81 changes: 81 additions & 0 deletions tests/test_process_ei38_cutoff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import gc
import os

import bw2calc
import bw2data
import bw2io
import pytest
from dotenv import load_dotenv

from premise import NewDatabase, clear_inventory_cache
from premise.utils import delete_all_pickles

load_dotenv()


ei_user = os.environ["EI_USERNAME"]
ei_pass = os.environ["EI_PASSWORD"]
key = os.environ["IAM_FILES_KEY"]
# convert to bytes
key = key.encode()

ei_version = "3.8"
system_model = "cutoff"


scenarios = [
{"model": "remind", "pathway": "SSP2-Base", "year": 2050},
{"model": "image", "pathway": "SSP2-RCP19", "year": 2050},
]


@pytest.mark.slow
def test_brightway():

bw2data.projects.set_current(f"ecoinvent-{ei_version}-{system_model}")
clear_inventory_cache()

if f"ecoinvent-{ei_version}-{system_model}" not in bw2data.databases:
bw2io.import_ecoinvent_release(
version=ei_version,
system_model=system_model,
username=ei_user,
password=ei_pass,
)

ndb = NewDatabase(
scenarios=scenarios,
source_db=f"ecoinvent-{ei_version}-{system_model}",
source_version=ei_version,
key=key,
system_model=system_model,
biosphere_name=f"ecoinvent-{ei_version}-biosphere",
)

ndb.update()

if "test1" in bw2data.databases:
del bw2data.databases["test1"]
if "test2" in bw2data.databases:
del bw2data.databases["test2"]

ndb.write_db_to_brightway(
[
"test1",
"test2",
]
)

method = [m for m in bw2data.methods if "IPCC" in m[0]][0]

lca = bw2calc.LCA({bw2data.Database("test1").random(): 1}, method)
lca.lci()
lca.lcia()
assert isinstance(lca.score, float)
print(lca.score)

# destroy all objects
del ndb
del lca
gc.collect()
delete_all_pickles()
82 changes: 82 additions & 0 deletions tests/test_process_ei39_conseq.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import gc
import os

import bw2calc
import bw2data
import bw2io
import pytest
from dotenv import load_dotenv

from premise import NewDatabase, clear_inventory_cache
from premise.utils import delete_all_pickles

load_dotenv()


ei_user = os.environ["EI_USERNAME"]
ei_pass = os.environ["EI_PASSWORD"]
key = os.environ["IAM_FILES_KEY"]
# convert to bytes
key = key.encode()

ei_version = "3.9.1"
system_model = "consequential"


scenarios = [
{"model": "remind", "pathway": "SSP2-Base", "year": 2050},
{"model": "image", "pathway": "SSP2-RCP19", "year": 2050},
]


@pytest.mark.slow
def test_brightway():

bw2data.projects.set_current(f"ecoinvent-{ei_version}-{system_model}")

clear_inventory_cache()

if f"ecoinvent-{ei_version}-{system_model}" not in bw2data.databases:
bw2io.import_ecoinvent_release(
version=ei_version,
system_model=system_model,
username=ei_user,
password=ei_pass,
)

ndb = NewDatabase(
scenarios=scenarios,
source_db=f"ecoinvent-{ei_version}-{system_model}",
source_version=ei_version,
key=key,
system_model=system_model,
biosphere_name=f"ecoinvent-{ei_version}-biosphere",
)

ndb.update()

if "test1" in bw2data.databases:
del bw2data.databases["test1"]
if "test2" in bw2data.databases:
del bw2data.databases["test2"]

ndb.write_db_to_brightway(
[
"test1",
"test2",
]
)

method = [m for m in bw2data.methods if "IPCC" in m[0]][0]

lca = bw2calc.LCA({bw2data.Database("test1").random(): 1}, method)
lca.lci()
lca.lcia()
assert isinstance(lca.score, float)
print(lca.score)

# destroy all objects
del ndb
del lca
gc.collect()
delete_all_pickles()

0 comments on commit 6a60b57

Please sign in to comment.