Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
romainsacchi committed Feb 7, 2024
1 parent bfcb360 commit 8cba74e
Show file tree
Hide file tree
Showing 12 changed files with 670 additions and 1,373 deletions.
837 changes: 321 additions & 516 deletions dev/test_premise.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/consequential.rst
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,6 @@ If not, the following default arguments value are used:
system_args=args
)
ndb.update_electricity()
ndb.update("electricity")
ndb.write_db_to_brightway()
2 changes: 1 addition & 1 deletion docs/extract.rst
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ They introduce the following datasets:
carbon dioxide, captured at cement production plant, for subsequent reuse RER
=============================================================================================================== ===========
Using the transformation function `update_dac()`, *premise* creates various configurations of these processes,
Using the transformation function `update("dac")`, *premise* creates various configurations of these processes,
using different sources for heat (industrial steam heat, high-temp heat
pump heat and excess heat), which are found under the following names, for each IAM region:
Expand Down
2 changes: 1 addition & 1 deletion docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ In theory, there is consistency between the IAM scenario and pLCA database
when 100% of the IAM variables and related projections are integrated
into the pLCA database.

This is not the case today, as ``premise`` only integrates a subset of IAM variables, namely those that relate to:
This is not the case today, as ``premise`` only integrates a subset of IAM variables, notably those that relate to:

- power production
- steel production
Expand Down
26 changes: 13 additions & 13 deletions docs/transform.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Run
source_version="3.7.1",
key='xxxxxxxxxxxxxxxxxxxxxxxxx'
)
ndb.update_electricity()
ndb.update("electricity")
Efficiency adjustment
Expand Down Expand Up @@ -257,7 +257,7 @@ emissions outputs, are re-scaled by 1/1.03 (=0.97).
While non-CO2 emissions (e.g., CO) are reduced because of the reduction in fuel consumption,
the emission factor per energy unit remains the same (i.e., gCO/MJ natural gas)).
It can be re-scaled using the `update_emissions` function, which updates emission factors according
It can be re-scaled using the `.update("emissions")` function, which updates emission factors according
to GAINS projections.


Expand Down Expand Up @@ -684,7 +684,7 @@ Run
source_version="3.7.1",
key='xxxxxxxxxxxxxxxxxxxxxxxxx'
)
ndb.update_cement()
ndb.update("cement")
Expand Down Expand Up @@ -752,7 +752,7 @@ Run
source_version="3.7.1",
key='xxxxxxxxxxxxxxxxxxxxxxxxx'
)
ndb.update_steel()
ndb.update("steel")"
Expand Down Expand Up @@ -925,10 +925,10 @@ Run
source_version="3.7.1",
key='xxxxxxxxxxxxxxxxxxxxxxxxx'
)
ndb.update_two_wheelers()
ndb.update_cars()
ndb.update_trucks()
ndb.update_buses()
ndb.update("two_wheelers")
ndb.update("cars")
ndb.update("trucks")
ndb.update("buses")
*premise* imports inventories for transport activity operated by:
Expand Down Expand Up @@ -1147,7 +1147,7 @@ Run
source_version="3.7.1",
key='xxxxxxxxxxxxxxxxxxxxxxxxx'
)
ndb.update_dac()
ndb.update("dac")
Expand Down Expand Up @@ -1209,7 +1209,7 @@ Run
source_version="3.7.1",
key='xxxxxxxxxxxxxxxxxxxxxxxxx'
)
ndb.update_fuels()
ndb.update("fuels")
Expand Down Expand Up @@ -1539,10 +1539,10 @@ Here is a list of the heat and steam production datasets that are regionalized:
- heat production, hardwood chips from forest, ...
These datasets are relinked to the corresponding regionalized fuel market only
if `.update_fuels()` has been run.
if `.update("fuels")` has been run.
Also, heat production datasets that use biomass as fuel input (e.g., softwood and
hardwood chips) relink to the dataset `market for biomass, used as fuel` if
`update_biomass()` has been run previously.
`update("biomass")` has been run previously.
CO2 emissions update
Expand Down Expand Up @@ -2025,7 +2025,7 @@ Final Steps
GAINS emission factors
""""""""""""""""""""""
When using `update_emissions()`, emission factors from the GAINS-EU_ and GAINS-IAM_ models are used to scale
When using `update("emissions")`, emission factors from the GAINS-EU_ and GAINS-IAM_ models are used to scale
non-CO2 emissions in various datasets.
.. _GAINS-EU: https://gains.iiasa.ac.at/gains/EUN/index.login
Expand Down
16 changes: 9 additions & 7 deletions docs/user_scenarios.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,29 @@ Example
]
The function **ndb.update_external_scenario()** can be called after that
The function **ndb.update("external")** can be called after that
to implement the user-defined scenario in the database.
.. code-block:: python
ndb.update_external_scenario()
ndb.update("external")
Of course, if you wish your database to also integrate the projections
of the global IAM model, you can run the function **ndb.update_all()**.
of the global IAM model, you can run the function **ndb.update()**.
.. code-block:: python
ndb.update_all()
ndb.update()
Or if you just want the IAM projections relating to, for example, electricity and steel:
.. code-block:: python
ndb.update_electricity()
ndb.update_steel()
ndb.update_external_scenario()
ndb.update([
"electricity",
"steel",
"external"
])
Once the integrations are complete, you can export your databases to
Brightway2, within the activated project:
Expand Down
6 changes: 0 additions & 6 deletions examples/.ipynb_checkpoints/Untitled-checkpoint.ipynb

This file was deleted.

Large diffs are not rendered by default.

96 changes: 33 additions & 63 deletions examples/.ipynb_checkpoints/examples-checkpoint.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
"metadata": {},
"outputs": [],
"source": [
"ndb.update_electricity()"
"ndb.update(\"electricity\")"
]
},
{
Expand Down Expand Up @@ -240,15 +240,6 @@
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ndb.update_all()"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -264,14 +255,14 @@
"metadata": {},
"outputs": [],
"source": [
"ndb.update_electricity()"
"ndb.update(\"electricity\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Or you can proceed instead to doing all the transformations available (minus any transformation you have listed in `exclude`), like so:"
"Or you can proceed instead to doing all the sectoral transformations available, like so:"
]
},
{
Expand All @@ -280,7 +271,7 @@
"metadata": {},
"outputs": [],
"source": [
"ndb.update_all()"
"ndb.update() # <- updates all sectors"
]
},
{
Expand Down Expand Up @@ -443,45 +434,36 @@
"\n",
"These functions modify the extracted database:\n",
"\n",
"* **update_electricity()**: alignment of regional electricity production mixes as well as efficiencies for a number of electricity production technologies, including Carbon Capture and Storage technologies and photovoltaic panels. Also updated the natural gas extraction datasets.\n",
"* **update(\"electricity\")**: alignment of regional electricity production mixes as well as efficiencies for a number of electricity production technologies, including Carbon Capture and Storage technologies and photovoltaic panels. Also updated the natural gas extraction datasets.\n",
"\n",
"* **update_cement()**: adjustment of technologies for cement production (dry, semi-dry, wet, with pre-heater or not), fuel efficiency of kilns, fuel mix of kilns (including biomass and waste fuels).\n",
"* **update(\"cement\")**: adjustment of technologies for cement production (dry, semi-dry, wet, with pre-heater or not), fuel efficiency of kilns, fuel mix of kilns (including biomass and waste fuels).\n",
"\n",
"* **update_steel()**: adjustment of process efficiency, fuel mix and share of secondary steel in steel markets.\n",
"* **update(\"steel\")**: adjustment of process efficiency, fuel mix and share of secondary steel in steel markets.\n",
"\n",
"* **update_dac()**: creates region- and scenario-specific inventories for DAC and DACCS systems. Applies a learning rate on energy and infrastructure needs if the IAM provides the variable.\n",
"* **update(\"dac\")**: creates region- and scenario-specific inventories for DAC and DACCS systems. Applies a learning rate on energy and infrastructure needs if the IAM provides the variable.\n",
"\n",
"* **update_fuels()**: creates regional markets for liquid and gaseous fuels and relinks fuel-conusming activities to them.\n",
"* **update(\"fuels\")**: creates regional markets for liquid and gaseous fuels and relinks fuel-conusming activities to them.\n",
"\n",
"* **update_heat()**: creates regionalized versions of heat and steam production datasets and relink them to heat-consuming activities.\n",
"* **update(\"heat\")**: creates regionalized versions of heat and steam production datasets and relink them to heat-consuming activities.\n",
"\n",
"* **update_emissions()**: adjusts emission of local air pollutants according to GAINS projections.\n",
"* **update(\"emissions\")**: adjusts emission of local air pollutants according to GAINS projections.\n",
"\n",
"* **update_cars()**: creates updated inventories for fleet average passenger cars and links back to activities that consume transport.\n",
"* **update(\"cars\")**: creates updated inventories for fleet average passenger cars and links back to activities that consume transport.\n",
"\n",
"* **update_trucks()**: creates updated inventories for fleet average lorry trucks and links back to activities that consume transport.\n",
"* **update(\"trucks\")**: creates updated inventories for fleet average lorry trucks and links back to activities that consume transport.\n",
"\n",
"* **update_two_wheelers()**: create inventories for two-wheelers.\n",
"* **update(\"two_wheelers\")**: create inventories for two-wheelers.\n",
"\n",
"* **update_buses()**: create inventories for buses.\n",
"* **update(\"buses\")**: create inventories for buses.\n",
"\n",
"A look at the documentation is advised.\n",
"\n",
"\n",
"These functions can be applied *separately*, *consecutively* or *altogether* (using instead **.update_all()**).\n",
"These functions can be applied *separately*, *consecutively* or *altogether* (using instead **.update()** without arguments).\n",
"\n",
"They will apply to all the scenario-specific databases listed in `scenarios`."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ndb.update_all()"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -516,7 +498,7 @@
"metadata": {},
"outputs": [],
"source": [
"ndb.update_all()"
"ndb.update()"
]
},
{
Expand Down Expand Up @@ -544,34 +526,6 @@
"ndb.write_db_to_brightway(name=[\"my_custom_name_1\", \"my_custom_name_2\"])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Exclude specific functions\n",
"Finally, we can exclude some transformation functions when executing `update_all()` like so:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ndb = NewDatabase(\n",
" scenarios=[\n",
" {\"model\":\"remind\", \"pathway\":\"SSP2-Base\", \"year\":2030,\n",
" \"exclude\": [\"update_steel\"], # <-- do not execute update_seel()\n",
" \"passenger cars\": {\"regions\":[\"EUR\"]},\"trucks\": {\"regions\":[\"EUR\"]}\n",
" },\n",
" {\"model\":\"remind\", \"pathway\":\"SSP2-Base\", \"year\":2030,},\n",
" ],\n",
" key='xxxxxxxxxxxxxxxxxxxxxxxxx',\n",
" source_db=\"ecoinvent 3.7 cutoff\",\n",
" source_version=\"3.7\", \n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -752,6 +706,22 @@
"ndb.write_db_to_simapro(filepath=r\"C:/Users/sacchi_r/Downloads/exported_simapro_file\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### As a SimaPro CSV file for OpenLCA"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ndb.write_db_to_olca(filepath=r\"C:/Users/sacchi_r/Downloads/exported_simapro_file\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
Loading

0 comments on commit 8cba74e

Please sign in to comment.