-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7328d9f
commit d13f848
Showing
17 changed files
with
1,913 additions
and
1,069 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,10 +5,65 @@ | |
"id": "4d530e2b-8524-48b2-8259-38c8ce984a5b", | ||
"metadata": {}, | ||
"source": [ | ||
"### Example\n", | ||
"Author: [Romain Sacchi]([email protected])\n", | ||
"# Example\n", | ||
"Author: [Romain Sacchi]([email protected]), [Alvaro Hahn]([email protected])\n", | ||
"\n", | ||
"``pathways``allows calculating LCA impacts of a product or system along a time axis, combining time series of demand with scenario-based LCA databases.\n", | ||
"``pathways``allows calculating LCA impacts of a product or system along a time axis, combining time series of demand with scenario-based LCA databases.\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "f86c7c83-b59e-4043-b0f5-01463a1b75ca", | ||
"metadata": {}, | ||
"source": [ | ||
"## Introduction" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "3589debc-dfa2-48f7-96ef-4b8ab1724f92", | ||
"metadata": {}, | ||
"source": [ | ||
"This notebook presents a mock case to illustrate the use of `pathways`. The diagram below introduces the proposed production system.\n", | ||
"\n", | ||
"The goal of this exercise is to calculate the environmental impact (both direct and indirect) associated with meeting the demand over time (2020-2050) for **product A** under two different future scenarios.\n", | ||
"\n", | ||
"We present the technosphere and biosphere matrices at each timestep. According to LCA conventions, the technosphere matrix lists the different activities in columns, and the different products in rows. Positive values indicate outputs from an activity, while negative values indicate inputs. For example, in 2020: *activity A*, to produce 1 unit of *product A*, demands 0.8 units of *product B* and directly emits 1.5 units of CO2. Concurrently, *activity B* consumes 0.2 units of *product E* and emits 0.2 units of CO2 to produce 1 unit of *product B*. [...]\n", | ||
"\n", | ||
"For each timestep, we can identify different changes in the technosphere exchanges and emissions intensities caused by changes in the system." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "c32238d6-56c7-403e-adcc-51cd8b07a2ca", | ||
"metadata": {}, | ||
"source": [ | ||
"-------------------" | ||
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"id": "663fb68b-d328-48bc-985a-391ee82cb964", | ||
"metadata": {}, | ||
"source": [ | ||
"![LCA_system_diagram](figures/example_illustration.png)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "0b225594-e91f-44f4-9bfa-db02b893636a", | ||
"metadata": {}, | ||
"source": [ | ||
"-------------------" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "d2d439e4-254e-4d84-aa56-dccfb2de3f2f", | ||
"metadata": {}, | ||
"source": [ | ||
"## Application\n", | ||
"\n", | ||
"We start by instantiating the `Pathways` class, and give it a file path pointing to a datapackage.json of a datapackage or directly the datapackage itself (.zip file)." | ||
] | ||
|
@@ -158,7 +213,7 @@ | |
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 14, | ||
"execution_count": 3, | ||
"id": "e5260d0b-8042-44d3-be14-e78aa4a767b7", | ||
"metadata": {}, | ||
"outputs": [ | ||
|
@@ -168,7 +223,7 @@ | |
"{'units': {'technology A': 'kilogram'}}" | ||
] | ||
}, | ||
"execution_count": 14, | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
|
@@ -219,7 +274,7 @@ | |
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"execution_count": 5, | ||
"id": "b13df1c4-9e99-4f6d-a02a-5c908db8bfbe", | ||
"metadata": {}, | ||
"outputs": [ | ||
|
@@ -233,7 +288,7 @@ | |
" 'CML v4.8 2016 no LT - ecotoxicity: terrestrial no LT - terrestrial ecotoxicity (TETP inf) no LT']" | ||
] | ||
}, | ||
"execution_count": 3, | ||
"execution_count": 5, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
|
@@ -251,14 +306,15 @@ | |
"\n", | ||
"Arguments:\n", | ||
"\n", | ||
" * `methods`: list[str]. LCIA methods to use. To get a complete list of available LCIA methods, call `.lcia_methods`\n", | ||
" * `scenarios`: list[str]. List of scenarios you want to calculate the impacts for.\n", | ||
" * `variables`: list[str]. List of variables you want to calculate the impacts for (if the demand for them is non-null)\n", | ||
" * `regions`: list[str]. Regions for which you want to calculate the impacts, provided the specified variables have a non-null demand in these regions.\n", | ||
" * `years`: list[int]. Years for which you want to calculate the impacts.\n", | ||
" * `multiprocessing`: bool. Multiprocessing may accelerate the process, as it processes each year in parallel.\n", | ||
" * `demand_cutoff`: float. Between 0 and 1. Defines a ratio below which demand values are ignored. The default is 0.001.\n", | ||
" * `use_distributions`: bool. Number of iterations to use for Monte Carlo analyses. The default is 0 (i.e., regular analysis)." | ||
"* `methods`: list[str]. LCIA methods to use. To get a complete list of available LCIA methods, call `.lcia_methods`\n", | ||
"* `scenarios`: list[str]. List of scenarios you want to calculate the impacts for.\n", | ||
"* `variables`: list[str]. List of variables you want to calculate the impacts for (if the demand for them is non-null)\n", | ||
"* `regions`: list[str]. Regions for which you want to calculate the impacts, provided the specified variables have a non-null demand in these regions.\n", | ||
"* `years`: list[int]. Years for which you want to calculate the impacts.\n", | ||
"* `multiprocessing`: bool. Multiprocessing may accelerate the process, as it processes each year in parallel.\n", | ||
"* `demand_cutoff`: float. Between 0 and 1. Defines a ratio below which demand values are ignored. The default is 0.001.\n", | ||
"* `double_accounting`:list[list[str]]. List of predefined category paths to be adjusted to prevent double counting of activities. Each path indicates the hierarchical categories involved.\n", | ||
"* `use_distributions`: bool. Number of iterations to use for Monte Carlo analyses. The default is 0 (i.e., regular analysis)." | ||
] | ||
}, | ||
{ | ||
|
@@ -271,7 +327,7 @@ | |
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"execution_count": 6, | ||
"id": "87aa6b87-b677-4acb-ad03-226591c4d7b0", | ||
"metadata": {}, | ||
"outputs": [ | ||
|
@@ -283,21 +339,26 @@ | |
"--- Calculating LCA results for Scenario A...\n", | ||
"------ Calculating LCA results for 2020...\n", | ||
"Warning: No valid output stream.\n", | ||
"------ Calculating LCA results for 2030...\n", | ||
"Warning: No valid output stream.\n", | ||
"------ Calculating LCA results for 2050...\n", | ||
"Warning: No valid output stream.\n", | ||
"------ Calculating LCA results for 2040...\n", | ||
"Warning: No valid output stream.\n", | ||
"--- Calculating LCA results for Scenario B...\n", | ||
"------ Calculating LCA results for 2020...\n", | ||
"------ Calculating LCA results for 2030...\n", | ||
"Warning: No valid output stream.\n", | ||
"Analysis complete and results saved.\n", | ||
"Analysis complete and results saved.\n", | ||
"Analysis complete and results saved.\n", | ||
"--- Calculating LCA results for Scenario B...\n", | ||
"------ Calculating LCA results for 2030...\n", | ||
"Warning: No valid output stream.\n", | ||
"------ Calculating LCA results for 2020...\n", | ||
"Warning: No valid output stream.\n", | ||
"------ Calculating LCA results for 2050...\n", | ||
"Warning: No valid output stream.\n", | ||
"------ Calculating LCA results for 2040...\n", | ||
"Warning: No valid output stream.\n" | ||
"Warning: No valid output stream.\n", | ||
"Analysis complete and results saved.\n", | ||
"Analysis complete and results saved.\n" | ||
] | ||
}, | ||
{ | ||
|
@@ -341,7 +402,7 @@ | |
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 6, | ||
"execution_count": 7, | ||
"id": "ca80ad98-860e-4645-a533-8c1e7eba477c", | ||
"metadata": {}, | ||
"outputs": [], | ||
|
@@ -357,7 +418,7 @@ | |
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 7, | ||
"execution_count": 8, | ||
"id": "268f8502-e499-4ab5-8fe7-4882c7a181f3", | ||
"metadata": {}, | ||
"outputs": [], | ||
|
@@ -367,7 +428,7 @@ | |
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 8, | ||
"execution_count": 9, | ||
"id": "94ed4c32-bed3-46bf-84eb-580b4f336dcd", | ||
"metadata": {}, | ||
"outputs": [ | ||
|
@@ -388,7 +449,7 @@ | |
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 11, | ||
"execution_count": 10, | ||
"id": "00e0a5b9-1285-4272-898b-5c72df1b44cb", | ||
"metadata": {}, | ||
"outputs": [ | ||
|
@@ -407,10 +468,10 @@ | |
" " | ||
], | ||
"text/plain": [ | ||
"<IPython.lib.display.IFrame at 0x282fa1a50>" | ||
"<IPython.lib.display.IFrame at 0x1016e4cd0>" | ||
] | ||
}, | ||
"execution_count": 11, | ||
"execution_count": 10, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
|
@@ -429,7 +490,7 @@ | |
"source": [ | ||
"Impacts with process contributions\n", | ||
"\n", | ||
"![impacts with process contribution](fig2.png)" | ||
"![impacts with process contribution](figures/fig2.png)" | ||
] | ||
}, | ||
{ | ||
|
@@ -439,7 +500,7 @@ | |
"source": [ | ||
"Impacts with breakdown by geographical location of impacts\n", | ||
"\n", | ||
"![impacts with impacts origins](fig3.png)" | ||
"![impacts with impacts origins](figures/fig3.png)" | ||
] | ||
}, | ||
{ | ||
|
@@ -449,7 +510,7 @@ | |
"source": [ | ||
"Sum of impacts for the 5th, 50th and 95th quantiles\n", | ||
"\n", | ||
"![impacts with uncertainty](fig1.png)" | ||
"![impacts with uncertainty](figures/fig1.png)" | ||
] | ||
}, | ||
{ | ||
|
@@ -459,7 +520,7 @@ | |
"source": [ | ||
"Comparison between two scenarios\n", | ||
"\n", | ||
"![scenarios comparison](fig4.png)" | ||
"![scenarios comparison](figures/fig4.png)" | ||
] | ||
}, | ||
{ | ||
|
@@ -518,16 +579,94 @@ | |
"source": [ | ||
"Life cycle-based annual demand for cobalt, global electricity supply\n", | ||
"\n", | ||
"![cobalt projection](fig5.png)" | ||
"![cobalt projection](figures/fig5.png)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "a2f864f8-c9ef-492b-a8cb-23064abec5b0", | ||
"metadata": {}, | ||
"source": [ | ||
"### Avoiding double counting" | ||
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"id": "925b92d4-82c6-4943-aa80-a7022717f722", | ||
"metadata": {}, | ||
"source": [ | ||
"When working with IAM/ESM, the focus s in the **total** quantity (e.g., electricity production, transport, etc.) coming from the IAM/ESM output and not on our examination of the supply chain as provided by LCA. To avoid double counting, we need to identify activities modeled by the IAM/ESM and set their inputs to all activities to zero. \n", | ||
"\n", | ||
"`pathways` allows users to select the categories to be considered in the double-counting adjustment. The predefined categories are illustrated below:" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "45d3389d-ad9c-4224-886c-e3320110faa5", | ||
"metadata": {}, | ||
"source": [ | ||
"![LCA_system_diagram](figures/categories.png)" | ||
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"id": "f1aa7bd6-3ec6-4dda-a05f-cb8aec156e7f", | ||
"metadata": {}, | ||
"source": [ | ||
"This adjustment can be applied using the argument double_accounting." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "b926a237-22e3-487c-9203-d83b6fafa41c", | ||
"id": "d1c84257-461b-4814-af6b-a0b4d625f81d", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
"source": [ | ||
"p.calculate(\n", | ||
" methods=['EF v3.1 EN15804 - climate change - global warming potential (GWP100)',],\n", | ||
" regions=[\"EU\",],\n", | ||
" scenarios=[\n", | ||
" \"Scenario A\",\n", | ||
" \"Scenario B\",\n", | ||
" ],\n", | ||
" variables=[\n", | ||
" \"technology A\",\n", | ||
" ],\n", | ||
" years=[\n", | ||
" 2020,\n", | ||
" 2030,\n", | ||
" 2040,\n", | ||
" 2050\n", | ||
" ],\n", | ||
" use_distributions=500,\n", | ||
" multiprocessing=True\n", | ||
" double_accounting = [[\"Energy\"]]\n", | ||
")" | ||
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"id": "fcdc26f9-8964-4beb-a4a6-7e01bc10e2eb", | ||
"metadata": {}, | ||
"source": [ | ||
"Some examples would be:\n", | ||
"\n", | ||
"- If we are interested in zeroing \"Electricity, industrial\"\n", | ||
"\n", | ||
" `double_accounting = [[\"Energy\", \"Electricity\", \"Industrial\"]]`\n", | ||
"\n", | ||
"- To zero \"Electricity, industrial\", \"Electricity, residential\" and \"Freight\"\n", | ||
"\n", | ||
" `double_accounting = [[\"Energy\", \"Electricity\"], [\"Transport\", \"Freight\"]]`\n", | ||
"\n", | ||
"- To adjust for energy (both heat and electricity)\n", | ||
"\n", | ||
" `double_accounting = [[\"Energy\"]]`" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
|
Oops, something went wrong.