Skip to content

Commit

Permalink
Version bump.
Browse files Browse the repository at this point in the history
  • Loading branch information
romainsacchi committed Aug 21, 2023
1 parent aed33f6 commit ff33656
Show file tree
Hide file tree
Showing 5 changed files with 179 additions and 85 deletions.
239 changes: 161 additions & 78 deletions dev/Untitled.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,9 @@
"outputs": [],
"source": [
"scenarios = [\n",
" {\"model\":\"image\", \"pathway\":\"SSP1-Base\", \"year\":2030},\n",
" #{\"model\":\"image\", \"pathway\":\"SSP2-Base\", \"year\":2030},\n",
" #{\"model\":\"image\", \"pathway\":\"SSP2-RCP26\", \"year\":2030},\n",
" #{\"model\":\"image\", \"pathway\":\"SSP2-RCP19\", \"year\":2030},\n",
" #{\"model\":\"remind\", \"pathway\":\"SSP1-Base\", \"year\":2030},\n",
" #{\"model\":\"remind\", \"pathway\":\"SSP1-NPi\", \"year\":2030},\n",
" #{\"model\":\"remind\", \"pathway\":\"SSP1-NDC\", \"year\":2030},\n",
" #{\"model\":\"remind\", \"pathway\":\"SSP1-PkBudg1150\", \"year\":2030},\n",
" #{\"model\":\"remind\", \"pathway\":\"SSP1-PkBudg500\", \"year\":2030},\n",
" #{\"model\":\"remind\", \"pathway\":\"SSP2-Base\", \"year\":2030},\n",
" #{\"model\":\"remind\", \"pathway\":\"SSP2-NPi\", \"year\":2030},\n",
" #{\"model\":\"remind\", \"pathway\":\"SSP2-NDC\", \"year\":2030},\n",
" #{\"model\":\"remind\", \"pathway\":\"SSP2-PkBudg1150\", \"year\":2030},\n",
" #{\"model\":\"remind\", \"pathway\":\"SSP2-PkBudg500\", \"year\":2030},\n",
" #{\"model\":\"remind\", \"pathway\":\"SSP5-Base\", \"year\":2030},\n",
" #{\"model\":\"remind\", \"pathway\":\"SSP5-NPi\", \"year\":2030},\n",
" #{\"model\":\"remind\", \"pathway\":\"SSP5-NDC\", \"year\":2030},\n",
" #{\"model\":\"remind\", \"pathway\":\"SSP5-PkBudg1150\", \"year\":2030},\n",
" #{\"model\":\"remind\", \"pathway\":\"SSP5-PkBudg500\", \"year\":2030},\n",
" {\"model\":\"remind\", \"pathway\":\"SSP1-PkBudg500\", \"year\":2030}, # optimistic renewable scenario, 2.3-2.8 °C\n",
" #{\"model\":\"image\", \"pathway\":\"SSP2-RCP26\", \"year\":2030}, # historical development, Paris Agreement, 1.6-1.8 °C\n",
" #{\"model\":\"remind\", \"pathway\":\"SSP5-NPi\", \"year\":2030}, # optimistic fossil, National policies, 4.0°C\n",
"]"
]
},
Expand Down Expand Up @@ -100,12 +84,11 @@
],
"source": [
"ndb = NewDatabase(\n",
" scenarios = scenarios,\n",
" source_db= \"ecoinvent cutoff 3.9.1\",\n",
" scenarios=scenarios,\n",
" source_db=\"ecoinvent cutoff 3.9.1\",\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 @@ -125,7 +108,7 @@
"`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 7.17 seconds\n",
"Extracted 1 worksheets in 7.72 seconds\n",
"Migrating to 3.8 first\n",
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
Expand All @@ -134,6 +117,50 @@
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
"Done!\n",
"Done!\n",
"Extracted 1 worksheets in 8.06 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",
"Extracted 1 worksheets in 7.77 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",
"No fuel market for market for hydrogen, gaseous in BRA\n",
"No fuel market for market for hydrogen, gaseous in CAN\n",
"No fuel market for market for hydrogen, gaseous in CEU\n",
"No fuel market for market for hydrogen, gaseous in EAF\n",
"No fuel market for market for hydrogen, gaseous in INDIA\n",
"No fuel market for market for hydrogen, gaseous in INDO\n",
"No fuel market for market for hydrogen, gaseous in JAP\n",
"No fuel market for market for hydrogen, gaseous in KOR\n",
"No fuel market for market for hydrogen, gaseous in ME\n",
"No fuel market for market for hydrogen, gaseous in MEX\n",
"No fuel market for market for hydrogen, gaseous in NAF\n",
"No fuel market for market for hydrogen, gaseous in OCE\n",
"No fuel market for market for hydrogen, gaseous in RCAM\n",
"No fuel market for market for hydrogen, gaseous in RSAF\n",
"No fuel market for market for hydrogen, gaseous in RSAM\n",
"No fuel market for market for hydrogen, gaseous in RSAS\n",
"No fuel market for market for hydrogen, gaseous in RUS\n",
"No fuel market for market for hydrogen, gaseous in SAF\n",
"No fuel market for market for hydrogen, gaseous in SEAS\n",
"No fuel market for market for hydrogen, gaseous in STAN\n",
"No fuel market for market for hydrogen, gaseous in UKR\n",
"No fuel market for market for hydrogen, gaseous in USA\n",
"No fuel market for market for hydrogen, gaseous in WAF\n",
"No fuel market for market for hydrogen, gaseous in WEU\n",
"Incorrect market share for market for hydrogen, gaseous in BRA\n",
"Incorrect market share for market for hydrogen, gaseous in CAN\n",
"Incorrect market share for market for hydrogen, gaseous in CEU\n",
Expand All @@ -160,6 +187,78 @@
"Incorrect market share for market for hydrogen, gaseous in USA\n",
"Incorrect market share for market for hydrogen, gaseous in WAF\n",
"Incorrect market share for market for hydrogen, gaseous in WEU\n",
"No fuel market for market for hydrogen, gaseous, 20-year period in BRA\n",
"No fuel market for market for hydrogen, gaseous, 20-year period in CAN\n",
"No fuel market for market for hydrogen, gaseous, 20-year period in CEU\n",
"No fuel market for market for hydrogen, gaseous, 20-year period in EAF\n",
"No fuel market for market for hydrogen, gaseous, 20-year period in INDIA\n",
"No fuel market for market for hydrogen, gaseous, 20-year period in INDO\n",
"No fuel market for market for hydrogen, gaseous, 20-year period in JAP\n",
"No fuel market for market for hydrogen, gaseous, 20-year period in KOR\n",
"No fuel market for market for hydrogen, gaseous, 20-year period in ME\n",
"No fuel market for market for hydrogen, gaseous, 20-year period in MEX\n",
"No fuel market for market for hydrogen, gaseous, 20-year period in NAF\n",
"No fuel market for market for hydrogen, gaseous, 20-year period in OCE\n",
"No fuel market for market for hydrogen, gaseous, 20-year period in RCAM\n",
"No fuel market for market for hydrogen, gaseous, 20-year period in RSAF\n",
"No fuel market for market for hydrogen, gaseous, 20-year period in RSAM\n",
"No fuel market for market for hydrogen, gaseous, 20-year period in RSAS\n",
"No fuel market for market for hydrogen, gaseous, 20-year period in RUS\n",
"No fuel market for market for hydrogen, gaseous, 20-year period in SAF\n",
"No fuel market for market for hydrogen, gaseous, 20-year period in SEAS\n",
"No fuel market for market for hydrogen, gaseous, 20-year period in STAN\n",
"No fuel market for market for hydrogen, gaseous, 20-year period in UKR\n",
"No fuel market for market for hydrogen, gaseous, 20-year period in USA\n",
"No fuel market for market for hydrogen, gaseous, 20-year period in WAF\n",
"No fuel market for market for hydrogen, gaseous, 20-year period in WEU\n",
"No fuel market for market for hydrogen, gaseous, 40-year period in BRA\n",
"No fuel market for market for hydrogen, gaseous, 40-year period in CAN\n",
"No fuel market for market for hydrogen, gaseous, 40-year period in CEU\n",
"No fuel market for market for hydrogen, gaseous, 40-year period in EAF\n",
"No fuel market for market for hydrogen, gaseous, 40-year period in INDIA\n",
"No fuel market for market for hydrogen, gaseous, 40-year period in INDO\n",
"No fuel market for market for hydrogen, gaseous, 40-year period in JAP\n",
"No fuel market for market for hydrogen, gaseous, 40-year period in KOR\n",
"No fuel market for market for hydrogen, gaseous, 40-year period in ME\n",
"No fuel market for market for hydrogen, gaseous, 40-year period in MEX\n",
"No fuel market for market for hydrogen, gaseous, 40-year period in NAF\n",
"No fuel market for market for hydrogen, gaseous, 40-year period in OCE\n",
"No fuel market for market for hydrogen, gaseous, 40-year period in RCAM\n",
"No fuel market for market for hydrogen, gaseous, 40-year period in RSAF\n",
"No fuel market for market for hydrogen, gaseous, 40-year period in RSAM\n",
"No fuel market for market for hydrogen, gaseous, 40-year period in RSAS\n",
"No fuel market for market for hydrogen, gaseous, 40-year period in RUS\n",
"No fuel market for market for hydrogen, gaseous, 40-year period in SAF\n",
"No fuel market for market for hydrogen, gaseous, 40-year period in SEAS\n",
"No fuel market for market for hydrogen, gaseous, 40-year period in STAN\n",
"No fuel market for market for hydrogen, gaseous, 40-year period in UKR\n",
"No fuel market for market for hydrogen, gaseous, 40-year period in USA\n",
"No fuel market for market for hydrogen, gaseous, 40-year period in WAF\n",
"No fuel market for market for hydrogen, gaseous, 40-year period in WEU\n",
"No fuel market for market for hydrogen, gaseous, 60-year period in BRA\n",
"No fuel market for market for hydrogen, gaseous, 60-year period in CAN\n",
"No fuel market for market for hydrogen, gaseous, 60-year period in CEU\n",
"No fuel market for market for hydrogen, gaseous, 60-year period in EAF\n",
"No fuel market for market for hydrogen, gaseous, 60-year period in INDIA\n",
"No fuel market for market for hydrogen, gaseous, 60-year period in INDO\n",
"No fuel market for market for hydrogen, gaseous, 60-year period in JAP\n",
"No fuel market for market for hydrogen, gaseous, 60-year period in KOR\n",
"No fuel market for market for hydrogen, gaseous, 60-year period in ME\n",
"No fuel market for market for hydrogen, gaseous, 60-year period in MEX\n",
"No fuel market for market for hydrogen, gaseous, 60-year period in NAF\n",
"No fuel market for market for hydrogen, gaseous, 60-year period in OCE\n",
"No fuel market for market for hydrogen, gaseous, 60-year period in RCAM\n",
"No fuel market for market for hydrogen, gaseous, 60-year period in RSAF\n",
"No fuel market for market for hydrogen, gaseous, 60-year period in RSAM\n",
"No fuel market for market for hydrogen, gaseous, 60-year period in RSAS\n",
"No fuel market for market for hydrogen, gaseous, 60-year period in RUS\n",
"No fuel market for market for hydrogen, gaseous, 60-year period in SAF\n",
"No fuel market for market for hydrogen, gaseous, 60-year period in SEAS\n",
"No fuel market for market for hydrogen, gaseous, 60-year period in STAN\n",
"No fuel market for market for hydrogen, gaseous, 60-year period in UKR\n",
"No fuel market for market for hydrogen, gaseous, 60-year period in USA\n",
"No fuel market for market for hydrogen, gaseous, 60-year period in WAF\n",
"No fuel market for market for hydrogen, gaseous, 60-year period in WEU\n",
"Done!\n",
"Done!\n",
"\n"
Expand All @@ -175,26 +274,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"id": "cbbdd9c0-efc4-4d6b-b065-d921a9d87d24",
"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()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"id": "a85ca090-8d49-42c2-8b21-ffc69fabc12d",
"metadata": {},
"outputs": [
Expand All @@ -203,7 +283,7 @@
"output_type": "stream",
"text": [
"Write new database(s) to Brightway2.\n",
"Database ecoinvent_cutoff_3.9_image_SSP2-RCP26_2030 already exists: it will be overwritten.\n"
"Database ecoinvent_cutoff_3.9_remind_SSP1-PkBudg500_2030 already exists: it will be overwritten.\n"
]
},
{
Expand All @@ -212,24 +292,28 @@
"text": [
"Writing activities to SQLite3 database:\n",
"0% [##############################] 100% | ETA: 00:00:00\n",
"Total time elapsed: 00:00:53\n"
"Total time elapsed: 00:00:56\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Title: Writing activities to SQLite3 database:\n",
" Started: 08/08/2023 16:17:11\n",
" Finished: 08/08/2023 16:18:05\n",
" Total time elapsed: 00:00:53\n",
" CPU %: 99.60\n",
" Memory %: 10.14\n",
"Created database: ecoinvent_cutoff_3.9_image_SSP2-RCP26_2030\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"
]
}
],
Expand All @@ -239,44 +323,43 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 11,
"id": "1d863e7b-11ab-417b-96f7-3342529422ad",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
"name": "stdout",
"output_type": "stream",
"text": [
"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": [
"(\"market for hydrogen, gaseous\", \"hydrogen, gaseous\", \"GLO\", \"kilogram\") in ndb.modified_datasets[(\"image\", \"SSP2-RCP26\", 2030)][\"emptied\"]"
"for ds in ndb.scenarios[0][\"database\"]:\n",
" 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": 11,
"execution_count": 8,
"id": "407ea861-e723-4fda-9e23-d2c21f01d42a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[]"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
"name": "stdout",
"output_type": "stream",
"text": [
"Generate change report.\n",
"Report saved under /Users/romain/Github/premise/dev.\n"
]
}
],
"source": [
"ndb.modified_datasets[(\"image\", \"SSP2-RCP26\", 2030)][\"emptied\"]"
"ndb.generate_change_report()"
]
},
{
Expand Down Expand Up @@ -1669,7 +1752,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.0"
"version": "3.9.12"
}
},
"nbformat": 4,
Expand Down
Binary file modified dev/profile.prof
Binary file not shown.
21 changes: 16 additions & 5 deletions dev/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,22 @@
{"model": "remind", "pathway": "SSP5-Base", "year": 2050},
]

#ndb = NewDatabase(
# scenarios=scenarios,
# source_db="ecoinvent 3.9.1 cutoff",
# key=b"tUePmX_S5B8ieZkkM7WUU2CnO8SmShwmAeWK9x2rTFo=",
#)

ndb = NewDatabase(
scenarios=scenarios,
source_db="ecoinvent 3.9.1 cutoff",
key=b"tUePmX_S5B8ieZkkM7WUU2CnO8SmShwmAeWK9x2rTFo=",
scenarios = scenarios,
source_db= "ecoinvent cutoff 3.9.1",
source_version="3.9.1",
source_type="ecospold",
source_file_path=f"/Users/romain/Documents/ecoinvent 3.9.1_cutoff_ecoSpold02/datasets", # <-- this is NEW
key='tUePmX_S5B8ieZkkM7WUU2CnO8SmShwmAeWK9x2rTFo=',
#system_model="cutoff",
#system_args=combinations[0]
)

ndb.update_all()
ndb.write_db_to_brightway()
#ndb.update_all()
#ndb.write_db_to_brightway()
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, 5)
__version__ = (1, 6, 6)

from pathlib import Path

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def package_files(directory):

setup(
name="premise",
version="1.6.5",
version="1.6.6",
python_requires=">=3.9,<3.11",
packages=packages,
author="Romain Sacchi <[email protected]>, Alois Dirnaichner <[email protected]>, Chris Mutel "
Expand Down

0 comments on commit ff33656

Please sign in to comment.