Skip to content

Commit

Permalink
Update docs on batteries.
Browse files Browse the repository at this point in the history
  • Loading branch information
romainsacchi committed Jul 18, 2024
1 parent 7cbdd02 commit a9d5a5e
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 22 deletions.
2 changes: 1 addition & 1 deletion dev/Untitled.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4395,7 +4395,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
"version": "3.11.8"
}
},
"nbformat": 4,
Expand Down
101 changes: 84 additions & 17 deletions dev/Untitled1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"Cannot find cached inventories. Will create them now for next time...\n",
"Importing default inventories...\n",
"\n",
"Extracted 1 worksheets in 0.10 seconds\n",
"Extracted 1 worksheets in 0.09 seconds\n",
"Migrating to 3.8 first\n",
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
Expand Down Expand Up @@ -135,7 +135,9 @@
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
"Remove uncertainty data.\n",
"Extracted 1 worksheets in 0.01 seconds\n",
"Extracted 4 worksheets in 0.17 seconds\n",
"Remove uncertainty data.\n",
"Extracted 1 worksheets in 0.02 seconds\n",
"Migrating to 3.8 first\n",
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
Expand Down Expand Up @@ -221,7 +223,7 @@
"Remove uncertainty data.\n",
"Extracted 1 worksheets in 0.01 seconds\n",
"Remove uncertainty data.\n",
"Extracted 1 worksheets in 0.39 seconds\n",
"Extracted 1 worksheets in 0.35 seconds\n",
"Migrating to 3.8 first\n",
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
Expand Down Expand Up @@ -251,7 +253,7 @@
"| vinyl fluoride production | vinyl fluoride | US | lci-PV.xlsx |\n",
"| wafer factory construction | wafer factory | DE | lci-PV.xlsx |\n",
"+--------------------------------+--------------------------------+----------+-------------+\n",
"Extracted 1 worksheets in 0.05 seconds\n",
"Extracted 1 worksheets in 0.04 seconds\n",
"Migrating to 3.8 first\n",
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
Expand Down Expand Up @@ -327,7 +329,7 @@
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
"Remove uncertainty data.\n",
"Extracted 1 worksheets in 0.02 seconds\n",
"Extracted 1 worksheets in 0.01 seconds\n",
"Migrating to 3.8 first\n",
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
Expand All @@ -336,7 +338,7 @@
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
"Remove uncertainty data.\n",
"Extracted 1 worksheets in 0.01 seconds\n",
"Extracted 1 worksheets in 0.02 seconds\n",
"Migrating to 3.8 first\n",
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
Expand Down Expand Up @@ -387,7 +389,7 @@
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
"Remove uncertainty data.\n",
"Extracted 1 worksheets in 0.00 seconds\n",
"Extracted 1 worksheets in 0.01 seconds\n",
"Migrating to 3.8 first\n",
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
Expand Down Expand Up @@ -438,7 +440,7 @@
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
"Remove uncertainty data.\n",
"Extracted 5 worksheets in 0.14 seconds\n",
"Extracted 5 worksheets in 0.62 seconds\n",
"Migrating to 3.8 first\n",
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
Expand Down Expand Up @@ -510,14 +512,14 @@
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
"Remove uncertainty data.\n",
"Extracted 1 worksheets in 0.00 seconds\n",
"Extracted 1 worksheets in 0.01 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",
"Remove uncertainty data.\n",
"Extracted 1 worksheets in 0.48 seconds\n",
"Extracted 1 worksheets in 0.09 seconds\n",
"Migrating to 3.8 first\n",
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
Expand Down Expand Up @@ -583,7 +585,7 @@
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
"Remove uncertainty data.\n",
"Extracted 1 worksheets in 0.04 seconds\n",
"Extracted 1 worksheets in 0.09 seconds\n",
"Migrating to 3.8 first\n",
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
Expand All @@ -608,7 +610,7 @@
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
"Remove uncertainty data.\n",
"Extracted 19 worksheets in 0.29 seconds\n",
"Extracted 19 worksheets in 0.28 seconds\n",
"Migrating to 3.8 first\n",
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
Expand All @@ -617,7 +619,7 @@
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
"Remove uncertainty data.\n",
"Extracted 1 worksheets in 0.21 seconds\n",
"Extracted 1 worksheets in 0.19 seconds\n",
"Migrating to 3.8 first\n",
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
Expand All @@ -626,7 +628,7 @@
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
"Remove uncertainty data.\n",
"Extracted 1 worksheets in 0.17 seconds\n",
"Extracted 1 worksheets in 0.15 seconds\n",
"Migrating to 3.8 first\n",
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
Expand All @@ -635,7 +637,7 @@
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
"Remove uncertainty data.\n",
"Extracted 1 worksheets in 0.81 seconds\n",
"Extracted 1 worksheets in 0.75 seconds\n",
"Migrating to 3.8 first\n",
"Applying strategy: migrate_datasets\n",
"Applying strategy: migrate_exchanges\n",
Expand All @@ -659,7 +661,7 @@
" #{\"model\":\"remind\", \"pathway\":\"SSP2-Base\", \"year\":2010},\n",
" #{\"model\":\"image\", \"pathway\":\"SSP2-Base\", \"year\":2020},\n",
" #{\"model\":\"remind\", \"pathway\":\"SSP2-Base\", \"year\":2050},\n",
" {\"model\":\"remind\", \"pathway\":\"SSP2-PkBudg1150\", \"year\":2050},\n",
" {\"model\":\"remind\", \"pathway\":\"SSP2-PkBudg1150\", \"year\":2020},\n",
" #{\"model\":\"image\", \"pathway\":\"SSP2-RCP26\", \"year\":2040},\n",
" #{\"model\":\"image\", \"pathway\":\"SSP2-RCP26\", \"year\":2060},\n",
" #{\"model\":\"image\", \"pathway\":\"SSP2-RCP19\", \"year\":2050},\n",
Expand All @@ -672,6 +674,71 @@
")"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "967ecac3-a402-4290-a095-8986bc2ae64b",
"metadata": {},
"outputs": [],
"source": [
"ndb.scenarios[0][\"database\"] = ndb.database"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "c353ff76-c1b2-4ccc-b311-44bfde9c3a98",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Write new database(s) to Brightway.\n",
"Running all checks...\n",
"Minor anomalies found: check the change report.\n",
"Database waste chp 3 already exists: it will be overwritten.\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Writing activities to SQLite3 database:\n",
"0% [##############################] 100% | ETA: 00:00:00\n",
"Total time elapsed: 00:00:17\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Title: Writing activities to SQLite3 database:\n",
" Started: 07/18/2024 10:37:54\n",
" Finished: 07/18/2024 10:38:12\n",
" Total time elapsed: 00:00:17\n",
" CPU %: 91.40\n",
" Memory %: 10.54\n",
"Created database: waste chp 3\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"
]
}
],
"source": [
"ndb.write_db_to_brightway(\"waste chp 3\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "62307835-ad98-41bd-bfc6-51f1119fc908",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 5,
Expand Down Expand Up @@ -11862,7 +11929,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
"version": "3.11.8"
}
},
"nbformat": 4,
Expand Down
10 changes: 7 additions & 3 deletions premise/clean_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,13 @@ def remove_categories(database: List[dict]) -> List[dict]:
if "categories" in dataset:
del dataset["categories"]
for exc in dataset["exchanges"]:
if exc["type"] in ["production", "technosphere"]:
if "categories" in exc:
del exc["categories"]
try:
if exc["type"] in ["production", "technosphere"]:
if "categories" in exc:
del exc["categories"]
except KeyError:
print(f"Exchange {exc['name']} in {dataset['name']} has no type")
pass

return database

Expand Down
Binary file modified premise/data/additional_inventories/lci-battery-capacity.xlsx
Binary file not shown.
Binary file modified premise/data/additional_inventories/lci-biofuels.xlsx
Binary file not shown.
Binary file modified premise/data/additional_inventories/lci-two_wheelers.xlsx
Binary file not shown.
Binary file modified premise/data/additional_inventories/lci-waste-CHP.xlsx
Binary file not shown.
2 changes: 1 addition & 1 deletion premise/iam_variables_mapping/electricity_variables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Biomass IGCC CCS:
Biomass MSW:
ecoinvent_aliases:
fltr:
name: treatment of municipal solid waste, incineration
name: treatment of municipal solid waste,
reference product: electricity
ecoinvent_fuel_aliases:
fltr:
Expand Down
2 changes: 2 additions & 0 deletions premise/new_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
FILEPATH_CC_INVENTORIES = INVENTORY_DIR / "lci-carbon-capture.xlsx"
FILEPATH_BIOFUEL_INVENTORIES = INVENTORY_DIR / "lci-biofuels.xlsx"
FILEPATH_BIOGAS_INVENTORIES = INVENTORY_DIR / "lci-biogas.xlsx"
FILEPATH_WASTE_CHP_INVENTORIES = INVENTORY_DIR / "lci-waste-CHP.xlsx"

FILEPATH_CARBON_FIBER_INVENTORIES = INVENTORY_DIR / "lci-carbon-fiber.xlsx"
FILEPATH_HYDROGEN_DISTRI_INVENTORIES = INVENTORY_DIR / "lci-hydrogen-distribution.xlsx"
Expand Down Expand Up @@ -709,6 +710,7 @@ def __import_inventories(self) -> List[dict]:
(FILEPATH_CHP_INVENTORIES, "3.5"),
(FILEPATH_CC_INVENTORIES, "3.9"),
(FILEPATH_BIOGAS_INVENTORIES, "3.6"),
(FILEPATH_WASTE_CHP_INVENTORIES, "3.10"),
(FILEPATH_CARBON_FIBER_INVENTORIES, "3.9"),
(FILEPATH_LITHIUM, "3.8"),
(FILEPATH_COBALT, "3.8"),
Expand Down

0 comments on commit a9d5a5e

Please sign in to comment.