Skip to content

Commit

Permalink
Align with master.
Browse files Browse the repository at this point in the history
  • Loading branch information
romainsacchi committed Aug 21, 2023
1 parent 837d1c3 commit 4e45356
Show file tree
Hide file tree
Showing 26 changed files with 236 additions and 198 deletions.
160 changes: 65 additions & 95 deletions dev/Untitled.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"premise v.(1, 6, 0)\n",
"premise v.(1, 6, 6)\n",
"+------------------------------------------------------------------+\n",
"| Warning |\n",
"+------------------------------------------------------------------+\n",
Expand Down Expand Up @@ -84,12 +84,11 @@
],
"source": [
"ndb = NewDatabase(\n",
" scenarios = scenarios,\n",
" source_db= \"ecoinvent 3.9.1 cutoff\",\n",
" scenarios=scenarios,\n",
" source_db=\"ecoinvent 3.9.1 cutoff\",\n",
" source_version=\"3.9.1\",\n",
" #source_type=source,\n",
" #source_file_path=f\"/Users/romain/Documents/ecoinvent {ei}_cutoff_ecoSpold02/datasets\" if source == \"ecospold\" else None, # <-- this is NEW\n",
" #source_version=ei,\n",
" #source_type=\"ecospold\",\n",
" #source_file_path=f\"/Users/romain/Documents/ecoinvent 3.9.1_cutoff_ecoSpold02/datasets\", # <-- this is NEW\n",
" key='tUePmX_S5B8ieZkkM7WUU2CnO8SmShwmAeWK9x2rTFo=',\n",
" #system_model=\"cutoff\",\n",
" #system_args=combinations[0]\n",
Expand All @@ -106,96 +105,43 @@
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"////////////////////////////// METALS ///////////////////////////////\n",
"Creating metal markets\n",
"... for stibnite concentrate.\n",
"... for antimony.\n",
"... for Bauxite.\n",
"... for aluminium oxide, metallurgical.\n",
"... for aluminium, primary, ingot.\n",
"... for beryllium.\n",
"... for calcium borates.\n",
"... for sodium borates.\n",
"... for Cadmium.\n",
"... for chromite ore concentrate.\n",
"... for Cobalt, mine.\n",
"... for cobalt sulfate.\n",
"... for copper concentrate, sulfide ore.\n",
"... for copper, anode.\n",
"... for copper, cathode.\n",
"... for gallium, semiconductor-grade.\n",
"... for germanium, concentrate.\n",
"... for Gold.\n",
"... for natural graphite, coated.\n",
"... for Indium production.\n",
"... for iron ore concentrate.\n",
"... for pig iron.\n",
"... for lead concentrate.\n",
"... for lead.\n",
"... for lithium carbonate, battery grade.\n",
"... for spodumene.\n",
"... for dolomite.\n",
"... for magnesium.\n",
"... for manganese concentrate.\n",
"... for manganese.\n",
"... for molybdenite.\n",
"... for molybdenum.\n",
"... for nickel concentrate.\n",
"... for nickel, class 1.\n",
"... for phosphate rock, beneficiated.\n",
"New location CX for Christmas Island not found\n",
"... for Palladium .\n",
"... for Platinum .\n",
"... for potash salt.\n",
"... for rare earth carbonate concentrate.\n",
"... for Rhenium.\n",
"... for Selenium.\n",
"... for silica sand.\n",
"... for silicon, metallurgical grade.\n",
"... for Silver.\n",
"... for strontium sulfate, 90% SrSO4.\n",
"... for sulfur.\n",
"... for ferroniobium, 66% Nb.\n",
"... for tantalum concentrate, 30% Ta2O5.\n",
"... for tellurium, semiconductor-grade.\n",
"... for tin concentrate.\n",
"... for tin.\n",
"... for ilmenite, 54% titanium dioxide.\n",
"... for rutile, 95% titanium dioxide.\n",
"... for titanium.\n",
"... for tungsten concentrate.\n",
"... for uranium ore, as U.\n",
"... for vanadium pentoxide.\n",
"... for vanadium bearing magnetite.\n",
"New location not found for European Union not found\n",
"... for zinc concentrate.\n",
"... for zinc.\n",
"... for zircon.\n",
"Creating additional mining processes\n",
"`update_all()` will skip the following steps:\n",
"update_two_wheelers(), update_cars(), and update_buses()\n",
"If you want to update these steps, please run them separately afterwards.\n",
"Extracted 1 worksheets in 4.00 seconds\n",
"Migrating to 3.8 first\n",
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
"Done!\n",
"Done!\n",
"Done!\n",
"\n"
]
}
],
"source": [
"#ndb.update_electricity()\n",
"#ndb.update_all()\n",
"ndb.update_metals()\n",
"ndb.update_all()\n",
"#ndb.update_metals()\n",
"#ndb.update_fuels()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"id": "a85ca090-8d49-42c2-8b21-ffc69fabc12d",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Write new database(s) to Brightway2.\n"
"Write new database(s) to Brightway2.\n",
"Database ecoinvent_cutoff_3.9_remind_SSP1-PkBudg500_2030 already exists: it will be overwritten.\n"
]
},
{
Expand All @@ -204,50 +150,74 @@
"text": [
"Writing activities to SQLite3 database:\n",
"0% [##############################] 100% | ETA: 00:00:00\n",
"Total time elapsed: 00:00:36\n"
"Total time elapsed: 00:00:56\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Title: Writing activities to SQLite3 database:\n",
" Started: 08/05/2023 14:30:24\n",
" Finished: 08/05/2023 14:31:01\n",
" Total time elapsed: 00:00:36\n",
" CPU %: 87.60\n",
" Memory %: 12.16\n",
"Created database: test_metals3\n",
"Generate scenario report.\n",
"Report saved under /Users/romain/GitHub/premise/dev/export/scenario_report.\n",
"Generate change report.\n",
"Report saved under /Users/romain/GitHub/premise/dev.\n"
" Started: 08/08/2023 13:46:33\n",
" Finished: 08/08/2023 13:47:30\n",
" Total time elapsed: 00:00:56\n",
" CPU %: 99.20\n",
" Memory %: 23.54\n",
"Created database: ecoinvent_cutoff_3.9_remind_SSP1-PkBudg500_2030\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Writing activities to SQLite3 database:\n",
"0% [########### ] 100% | ETA: 00:00:35"
]
}
],
"source": [
"ndb.write_db_to_brightway(\"test_metals3\")"
"ndb.write_db_to_brightway()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "407ea861-e723-4fda-9e23-d2c21f01d42a",
"execution_count": 11,
"id": "1d863e7b-11ab-417b-96f7-3342529422ad",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"yes\n"
"methane, from electrochemical methanation, with carbon from atmospheric carbon dioxide capture RER\n",
"methane, from biological methanation, with carbon from atmospheric carbon dioxide capture RER\n"
]
}
],
"source": [
"key = ('market for sulfur', 'sulfur', 'GLO', 'kilogram')\n",
"for ds in ndb.scenarios[0][\"database\"]:\n",
" if (ds[\"name\"], ds[\"reference product\"], ds[\"location\"], ds[\"unit\"]) == key:\n",
" print(\"yes\")"
" for e in ds[\"exchanges\"]:\n",
" if e[\"name\"] == \"carbon dioxide, captured from atmosphere, with a sorbent-based direct air capture system, 100ktCO2\":\n",
" print(ds[\"name\"], ds[\"location\"])"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "407ea861-e723-4fda-9e23-d2c21f01d42a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Generate change report.\n",
"Report saved under /Users/romain/Github/premise/dev.\n"
]
}
],
"source": [
"ndb.generate_change_report()"
]
},
{
Expand Down
4 changes: 3 additions & 1 deletion docs/consequential.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@ Range time

Integer. Years. To measure the trend around the point where the additional
capital will be installed, a range of n years before and after the point
is taken as the time interval.
is taken as the time interval. Note that if set to a value other than 0,
the duration argument must be set to 0.

Duration
^^^^^^^^

Integer. Years. Duration over which the change in demand should be measured.
Note that if set to a value other than 0, the range time argument must be set to 0.

Foresight
^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion docs/transform.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ power plants on the basis of the excellent work done by Oberschelp_ et al. (2019
to update some datasets in ecoinvent, which are, for some of them, several decades
old. More specifically, the data provides plant-specific efficiency
and emissions factors. We average them by country and fuel type to obtain
volume-weighted factors. Rhe efficiency of the following datasets is updated:
volume-weighted factors. The efficiency of the following datasets is updated:
* electricity production, hard coal
* electricity production, lignite
Expand Down
2 changes: 1 addition & 1 deletion premise/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__all__ = ("NewDatabase", "clear_cache", "get_regions_definition")
__version__ = (1, 6, 0)
__version__ = (1, 6, 6)

from pathlib import Path

Expand Down
2 changes: 1 addition & 1 deletion premise/cement.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
logger = create_logger("cement")


def _update_cement(scenario, version, system_model, modified_datasets, cache):
def _update_cement(scenario, version, system_model, modified_datasets, cache=None):
cement = Cement(
database=scenario["database"],
model=scenario["model"],
Expand Down
Binary file modified premise/data/additional_inventories/lci-buses.xlsx
Binary file not shown.
Binary file modified premise/data/additional_inventories/lci-carbon-fiber.xlsx
Binary file not shown.
Binary file modified premise/data/additional_inventories/lci-hydrogen-distribution.xlsx
Binary file not shown.
Binary file modified premise/data/additional_inventories/lci-hydrogen-electrolysis.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-trucks.xlsx
Binary file not shown.
2 changes: 2 additions & 0 deletions premise/data/additional_inventories/migration_map.csv
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,8 @@ from;to;name_from;ref_prod_from;location_from;name_to;ref_prod_to;location_to
37;39;market for concrete, normal;concrete, normal;CH;market for concrete, normal strength;concrete, normal strength;CH
37;39;treatment of wastewater, average, capacity 1E9l/year;wastewater, average;RoW;treatment of wastewater, average, wastewater treatment;wastewater, average;RoW
37;39;treatment of wastewater, average, capacity 1E9l/year;wastewater, average;CH;treatment of wastewater, average, wastewater treatment;wastewater, average;CH
39;38;treatment of wastewater, average, wastewater treatment;wastewater, average;CH;treatment of wastewater, average, capacity 1E9l/year;wastewater, average;CH
39;37;treatment of wastewater, average, wastewater treatment;wastewater, average;CH;treatment of wastewater, average, capacity 1E9l/year;wastewater, average;CH
37;39;treatment of wastewater, average, capacity 1E9l/year;wastewater, average;Europe without Switzerland;treatment of wastewater, average, wastewater treatment;wastewater, average;Europe without Switzerland
38;39;treatment of wastewater, average, capacity 1E9l/year;wastewater, average;RoW;treatment of wastewater, average, wastewater treatment;wastewater, average;RoW
38;39;treatment of wastewater, average, capacity 1E9l/year;wastewater, average;CH;treatment of wastewater, average, wastewater treatment;wastewater, average;CH
Expand Down
56 changes: 25 additions & 31 deletions premise/data/consequential/blacklist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,19 @@
# if it is present, the activity is replaced by the activity
# specified in the `replacement` field.
---
- name: electricity production, at co-generation power plant/hard coal, oxy, pipeline 200km, storage 1000m
- name: electricity production, at co-generation hard coal-fired power plant, post, pipeline 200km, storage 1000m
reference product: electricity, high voltage
unit: kilowatt hour
- name: electricity production, at co-generation power plant/hard coal, oxy, pipeline 400km, storage 3000m
reference product: electricity, high voltage
unit: kilowatt hour
- name: electricity production, at co-generation power plant/hard coal, post, pipeline 200km, storage 1000m
reference product: electricity, high voltage
unit: kilowatt hour
- name: electricity production, at co-generation power plant/hard coal, post, pipeline 400km, storage 1000m
reference product: electricity, high voltage
unit: kilowatt hour
- name: electricity production, at co-generation power plant/hard coal, post, pipeline 400km, storage 3000m
reference product: electricity, high voltage
unit: kilowatt hour
- name: electricity production, at co-generation power plant/hard coal, pre, pipeline 200km, storage 1000m
reference product: electricity, high voltage
unit: kilowatt hour
- name: electricity production, at co-generation power plant/hard coal, pre, pipeline 400km, storage 3000m
reference product: electricity, high voltage
unit: kilowatt hour
- name: electricity production, at co-generation power plant/wood, post, pipeline 200km, storage 1000m
reference product: electricity, high voltage
unit: kilowatt hour
- name: electricity production, at co-generation power plant/wood, post, pipeline 400km, storage 3000m
reference product: electricity, high voltage
unit: kilowatt hour
- name: electricity production, at co-generation power plant/natural gas, post, pipeline 200km, storage 1000m
reference product: electricity, high voltage
unit: kilowatt hour
- name: electricity production, at co-generation power plant/natural gas, pre, pipeline 200km, storage 1000m

- name: electricity production, at co-generation wood-fired power plant, post, pipeline 200km, storage 1000m
reference product: electricity, high voltage
unit: kilowatt hour
- name: electricity production, at co-generation power plant/oil, post, pipeline 200km, storage 1000m

- name: electricity production, at co-generation natural gas-fired power plant, post, pipeline 200km, storage 1000m
reference product: electricity, high voltage
unit: kilowatt hour
- name: electricity production, at co-generation power plant/oil, pre, pipeline 200km, storage 1000m

- name: electricity production, at co-generation oil-fired power plant, post, pipeline 200km, storage 1000m
reference product: electricity, high voltage
unit: kilowatt hour

Expand Down Expand Up @@ -117,6 +93,24 @@
reference product: heat, central or small-scale, other than natural gas
location: CH

- name: heat and power co-generation, hard coal
reference product: electricity, high voltage
unit: kilowatt hour
location: DE
replacement:
name: electricity production, hard coal
reference product: electricity, high voltage
location: DE

- name: heat and power co-generation, oil
reference product: electricity, high voltage
unit: kilowatt hour
location: DE
replacement:
name: electricity production, oil
reference product: electricity, high voltage
location: DE

- name: air separation, cryogenic
reference product: nitrogen, liquid
unit: kilogram
Expand Down
14 changes: 14 additions & 0 deletions premise/data/consequential/leadtimes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,26 @@ Gas CC: 3
Gas CC CCS: 3
Gas CHP: 3
Gas CHP CCS: 3
Gas ST: 3
Oil ST: 3
Oil CC CCS: 3
Oil CC: 3
Oil CHP CCS: 3
Oil CHP: 3
Foil ST: 3
Geothermal: 3
Hydro: 4
Hydrogen: 3
Nuclear: 7
Nuclear_EPR: 7
Nuclear_SMR: 7
Solar CSP: 3
Solar CSP autonomous: 3
Solar PV Centralized: 2
Solar PV Residential: 2
Wind Onshore: 2
Wind Offshore: 3
Wave: 3
diesel: 3
gasoline: 3
diesel, synthetic, from wood: 3
Expand Down Expand Up @@ -65,3 +71,11 @@ hydrogen, biomass, with CCS: 3
hydrogen, coal: 3
hydrogen, nat. gas: 3
hydrogen, nat. gas, with CCS: 3
hydrogen, coal, with CCS: 3
hydrogen, solar: 3
cement, dry feed rotary kiln: 10
steel - primary: 10
steel - secondary: 10
daccs_sorbent: 3
biomass - residual: 3
biomass crops - purpose grown: 3
Loading

0 comments on commit 4e45356

Please sign in to comment.