-
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
0dc6669
commit 3228a54
Showing
6 changed files
with
3,014 additions
and
567 deletions.
There are no files selected for viewing
137 changes: 137 additions & 0 deletions
137
dev/.ipynb_checkpoints/datapackage creation-checkpoint.ipynb
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,137 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"id": "93725a69-da37-4dfb-913f-880652e04494", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"premise v.(2, 0, 1)\n", | ||
"+------------------------------------------------------------------+\n", | ||
"| Warning |\n", | ||
"+------------------------------------------------------------------+\n", | ||
"| Because some of the scenarios can yield LCI databases |\n", | ||
"| containing net negative emission technologies (NET), |\n", | ||
"| it is advised to account for biogenic CO2 flows when calculating |\n", | ||
"| Global Warming potential indicators. |\n", | ||
"| `premise_gwp` provides characterization factors for such flows. |\n", | ||
"| It also provides factors for hydrogen emissions to air. |\n", | ||
"| |\n", | ||
"| Within your bw2 project: |\n", | ||
"| from premise_gwp import add_premise_gwp |\n", | ||
"| add_premise_gwp() |\n", | ||
"+------------------------------------------------------------------+\n", | ||
"+--------------------------------+----------------------------------+\n", | ||
"| Utils functions | Description |\n", | ||
"+--------------------------------+----------------------------------+\n", | ||
"| clear_cache() | Clears the cache folder. Useful |\n", | ||
"| | when updating `premise`or |\n", | ||
"| | encountering issues with |\n", | ||
"| | inventories. |\n", | ||
"+--------------------------------+----------------------------------+\n", | ||
"| get_regions_definition(model) | Retrieves the list of countries |\n", | ||
"| | for each region of the model. |\n", | ||
"+--------------------------------+----------------------------------+\n", | ||
"| ndb.NewDatabase(...) | Generates a summary of the most |\n", | ||
"| ndb.generate_scenario_report() | important scenarios' variables. |\n", | ||
"+--------------------------------+----------------------------------+\n", | ||
"Keep uncertainty data?\n", | ||
"NewDatabase(..., keep_uncertainty_data=True)\n", | ||
"\n", | ||
"Disable multiprocessing?\n", | ||
"NewDatabase(..., use_multiprocessing=False)\n", | ||
"\n", | ||
"Hide these messages?\n", | ||
"NewDatabase(..., quiet=True)\n", | ||
"- Extracting source database\n", | ||
"- Extracting inventories\n", | ||
"- Fetching IAM data\n", | ||
"Done!\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"from premise import *\n", | ||
"import bw2data\n", | ||
"from datapackage import Package\n", | ||
"bw2data.projects.set_current(\"ei39\")\n", | ||
"ndb = PathwaysDataPackage(\n", | ||
" scenarios=[\n", | ||
" {\"model\": \"image\", \"pathway\": \"SSP2-RCP19\"},\n", | ||
" ],\n", | ||
" #years=[2005, 2010, 2020, 2030, 2040, 2050, 2060, 2070, 2080, 2090, 2100],\n", | ||
" #years=[2020, 2050],\n", | ||
" source_db=\"ecoinvent 3.9.1 cutoff\", # <-- name of the database in the BW2 project. Must be a string.\n", | ||
" source_version=\"3.9\", # <-- version of ecoinvent. Can be \"3.5\", \"3.6\", \"3.7\" or \"3.8\". Must be a string.\n", | ||
" key=\"tUePmX_S5B8ieZkkM7WUU2CnO8SmShwmAeWK9x2rTFo=\",\n", | ||
" #external_scenarios=[sps,]\n", | ||
")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "a6936b92-9ac1-49cb-95fb-a348a6cce296", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"`update()` will skip the following sectors: 'buses', 'cars', 'two_wheelers'.\n", | ||
"If you want to update these sectors, please run them separately afterwards.\n" | ||
] | ||
}, | ||
{ | ||
"name": "stderr", | ||
"output_type": "stream", | ||
"text": [ | ||
"Updating: biomass: 0%| | 0/11 [00:00<?, ?it/s]" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"ndb.create_datapackage(\n", | ||
" name=\"image-SSP2-stem-SPS1\",\n", | ||
" contributors=[\n", | ||
" {\"name\": \"Romain\",\n", | ||
" \"email\": \"r_s at me.com\",}\n", | ||
" ]\n", | ||
")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "5b4d251b-a537-49fd-b993-dfe66d6f30cc", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.11.8" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Oops, something went wrong.