generated from jupyterlite/xeus-python-demo
-
Notifications
You must be signed in to change notification settings - Fork 1
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
1ee09d7
commit 4f51b19
Showing
6 changed files
with
187 additions
and
1,048 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,154 @@ | ||
{ | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python (Pyodide)", | ||
"language": "python", | ||
"name": "python" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "python", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8" | ||
} | ||
}, | ||
"nbformat_minor": 4, | ||
"nbformat": 4, | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"source": "import micropip # required by Pyodide\nimport lzma # required by Pyodide", | ||
"metadata": { | ||
"trusted": true | ||
}, | ||
"outputs": [], | ||
"execution_count": 1 | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"source": "await micropip.install('bw2io==0.9.dev41', keep_going = True)\nawait micropip.install('bw2calc==2.0.dev23', keep_going = True)\nawait micropip.install('bw2data==4.0.dev59', keep_going = True)", | ||
"metadata": { | ||
"trusted": true | ||
}, | ||
"outputs": [], | ||
"execution_count": 2 | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"source": "import os\nos.environ[\"BRIGHTWAY_DIR\"] = \"/tmp/\"", | ||
"metadata": { | ||
"trusted": true | ||
}, | ||
"outputs": [], | ||
"execution_count": 3 | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"source": "import bw2data as bd\nimport bw2io as bi\nimport bw2calc as bc", | ||
"metadata": { | ||
"trusted": true | ||
}, | ||
"outputs": [], | ||
"execution_count": 7 | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"source": "bi.install_project(project_key=\"USEEIO-1.1\", overwrite_existing=True)", | ||
"metadata": { | ||
"trusted": true | ||
}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"text": "Downloading USEEIO-1.1.tar.gz to /home/pyodide/.local/share/Brightway3/bw2io_cache_dir/USEEIO-1.1.tar.gz\n", | ||
"output_type": "stream" | ||
}, | ||
{ | ||
"name": "stderr", | ||
"text": "/lib/python3.12/site-packages/bw2io/download_utils.py:73: TqdmMonitorWarning: tqdm:disabling monitor support (monitor_interval = 0) due to:\ncan't start new thread\n with tqdm(total=total_length) as pbar:\n15925248it [00:00, 455005969.90it/s] \n", | ||
"output_type": "stream" | ||
}, | ||
{ | ||
"name": "stdout", | ||
"text": "Restoring project backup archive - this could take a few minutes...\nRestored project: USEEIO-1.1\n", | ||
"output_type": "stream" | ||
}, | ||
{ | ||
"execution_count": 9, | ||
"output_type": "execute_result", | ||
"data": { | ||
"text/plain": "'USEEIO-1.1'" | ||
}, | ||
"metadata": {} | ||
} | ||
], | ||
"execution_count": 9 | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"source": "bd.projects.set_current('USEEIO-1.1')", | ||
"metadata": { | ||
"trusted": true | ||
}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"text": "\u001b[2m13:00:58\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mApplying automatic update: 4.0 database search directories FTS5\u001b[0m\n\u001b[2m13:00:58\u001b[0m [\u001b[32m\u001b[1minfo \u001b[0m] \u001b[1mReindexing database USEEIO-1.1\u001b[0m\n", | ||
"output_type": "stream" | ||
} | ||
], | ||
"execution_count": 13 | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"source": "activity_cars = bd.utils.get_node(\n database = 'USEEIO-1.1',\n name = 'Automobiles; at manufacturer',\n type = 'product',\n location = 'United States'\n)", | ||
"metadata": { | ||
"trusted": true | ||
}, | ||
"outputs": [], | ||
"execution_count": 15 | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"source": "method_gcc = bd.Method(('Impact Potential', 'GCC'))", | ||
"metadata": { | ||
"trusted": true | ||
}, | ||
"outputs": [], | ||
"execution_count": 16 | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"source": "lca = bc.LCA( \n demand={activity_cars: 1}, \n method = method_gcc.name\n) \nlca.lci() \nlca.lcia()", | ||
"metadata": { | ||
"trusted": true | ||
}, | ||
"outputs": [], | ||
"execution_count": 17 | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"source": "lca.score", | ||
"metadata": { | ||
"trusted": true | ||
}, | ||
"outputs": [ | ||
{ | ||
"execution_count": 18, | ||
"output_type": "execute_result", | ||
"data": { | ||
"text/plain": "0.3768834121437975" | ||
}, | ||
"metadata": {} | ||
} | ||
], | ||
"execution_count": 18 | ||
} | ||
] | ||
} |
Oops, something went wrong.