diff --git a/dev/Untitled1.ipynb b/dev/Untitled1.ipynb index 06fcf5c9..9a50fef5 100644 --- a/dev/Untitled1.ipynb +++ b/dev/Untitled1.ipynb @@ -26,19 +26,11 @@ { "cell_type": "code", "execution_count": 3, - "id": "776096ec-6e11-42ba-9604-4876ae234207", + "id": "36f6ad96-f512-48c5-80e8-b36276d42b43", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Inventory cache cleared!\n" - ] - } - ], + "outputs": [], "source": [ - "clear_inventory_cache()" + "# clear_inventory_cache()" ] }, { @@ -51,7 +43,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "premise v.(2, 1, 1, 'dev2')\n", + "premise v.(2, 1, 1, 'dev4')\n", "+------------------------------------------------------------------+\n", "| Warning |\n", "+------------------------------------------------------------------+\n", @@ -87,564 +79,6 @@ "NewDatabase(..., quiet=True)\n", "- Extracting source database\n", "- Extracting inventories\n", - "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", - "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", - "Remove uncertainty data.\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", - "Applying strategy: migrate_datasets\n", - "Applying strategy: migrate_exchanges\n", - "Remove uncertainty data.\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", - "Applying strategy: migrate_datasets\n", - "Applying strategy: migrate_exchanges\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", - "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.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", - "Applying strategy: migrate_datasets\n", - "Applying strategy: migrate_exchanges\n", - "Remove uncertainty data.\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", - "Applying strategy: migrate_datasets\n", - "Applying strategy: migrate_exchanges\n", - "Remove uncertainty data.\n", - "Extracted 7 worksheets in 0.03 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.02 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.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.02 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.03 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", - "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", - "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.03 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", - "Could not find a biosphere flow for ('Iron, 72% in magnetite, 14% in crude ore', 'natural resource', 'in ground', 'kilogram') in lci-vanadium.xlsx. Exchange deleted.\n", - "Could not find a biosphere flow for ('TiO2, 54% in ilmenite, 18% in crude ore, in ground', 'natural resource', 'in ground', 'kilogram') in lci-vanadium.xlsx. Exchange deleted.\n", - "Remove uncertainty data.\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", - "Applying strategy: migrate_datasets\n", - "Applying strategy: migrate_exchanges\n", - "Remove uncertainty data.\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", - "Applying strategy: migrate_datasets\n", - "Applying strategy: migrate_exchanges\n", - "Remove uncertainty data.\n", - "Extracted 1 worksheets in 0.38 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", - "Remove uncertainty data.\n", - "The following datasets to import already exist in the source database. They will not be imported\n", - "+--------------------------------+--------------------------------+----------+-------------+\n", - "| Name | Reference product | Location | File |\n", - "+--------------------------------+--------------------------------+----------+-------------+\n", - "| fluorspar production, 97% puri | fluorspar, 97% purity | GLO | lci-PV.xlsx |\n", - "| metallization paste production | metallization paste, back side | RER | lci-PV.xlsx |\n", - "| metallization paste production | metallization paste, back side | RER | lci-PV.xlsx |\n", - "| metallization paste production | metallization paste, front sid | RER | lci-PV.xlsx |\n", - "| photovoltaic module production | photovoltaic module, building- | RER | lci-PV.xlsx |\n", - "| photovoltaic module production | photovoltaic module, building- | RER | lci-PV.xlsx |\n", - "| photovoltaic mounting system p | photovoltaic mounting system, | RER | lci-PV.xlsx |\n", - "| photovoltaic mounting system p | photovoltaic mounting system, | RER | lci-PV.xlsx |\n", - "| photovoltaic mounting system p | photovoltaic mounting system, | RER | lci-PV.xlsx |\n", - "| photovoltaic panel factory con | photovoltaic panel factory | GLO | lci-PV.xlsx |\n", - "| polyvinylfluoride production | polyvinylfluoride | US | lci-PV.xlsx |\n", - "| polyvinylfluoride production, | polyvinylfluoride, dispersion | US | lci-PV.xlsx |\n", - "| polyvinylfluoride, film produc | polyvinylfluoride, film | US | lci-PV.xlsx |\n", - "| silicon production, metallurgi | silicon, metallurgical grade | NO | lci-PV.xlsx |\n", - "| 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", - "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", - "Remove uncertainty data.\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", - "Applying strategy: migrate_datasets\n", - "Applying strategy: migrate_exchanges\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", - "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.02 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", - "Remove uncertainty data.\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", - "Applying strategy: migrate_datasets\n", - "Applying strategy: migrate_exchanges\n", - "Remove uncertainty data.\n", - "The following datasets to import already exist in the source database. They will not be imported\n", - "+--------------------------------+--------------------------------+----------+--------------------------------+\n", - "| Name | Reference product | Location | File |\n", - "+--------------------------------+--------------------------------+----------+--------------------------------+\n", - "| carbon dioxide, captured at ce | carbon dioxide, captured and r | RER | lci-synfuels-from-methanol-fro |\n", - "+--------------------------------+--------------------------------+----------+--------------------------------+\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", - "Applying strategy: migrate_datasets\n", - "Applying strategy: migrate_exchanges\n", - "Remove uncertainty data.\n", - "The following datasets to import already exist in the source database. They will not be imported\n", - "+--------------------------------+--------------------------------+----------+--------------------------------+\n", - "| Name | Reference product | Location | File |\n", - "+--------------------------------+--------------------------------+----------+--------------------------------+\n", - "| hydrogen production, coal gasi | hydrogen, gaseous, low pressur | RoW | lci-hydrogen-coal-gasification |\n", - "| methanol production, coal gasi | methanol | RoW | lci-hydrogen-coal-gasification |\n", - "+--------------------------------+--------------------------------+----------+--------------------------------+\n", - "Extracted 1 worksheets in 0.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", - "Remove uncertainty data.\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", - "Applying strategy: migrate_datasets\n", - "Applying strategy: migrate_exchanges\n", - "Remove uncertainty data.\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", - "Applying strategy: migrate_datasets\n", - "Applying strategy: migrate_exchanges\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", - "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.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", - "Applying strategy: migrate_datasets\n", - "Applying strategy: migrate_exchanges\n", - "Remove uncertainty data.\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", - "Applying strategy: migrate_datasets\n", - "Applying strategy: migrate_exchanges\n", - "Remove uncertainty data.\n", - "The following datasets to import already exist in the source database. They will not be imported\n", - "+--------------------------------+--------------------------------+----------+--------------------------------+\n", - "| Name | Reference product | Location | File |\n", - "+--------------------------------+--------------------------------+----------+--------------------------------+\n", - "| hydrogen production, steam met | hydrogen, gaseous, low pressur | RER | lci-hydrogen-smr-atr-natgas.xl |\n", - "+--------------------------------+--------------------------------+----------+--------------------------------+\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", - "Applying strategy: migrate_datasets\n", - "Applying strategy: migrate_exchanges\n", - "Remove uncertainty data.\n", - "Extracted 1 worksheets in 0.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", - "Remove uncertainty data.\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", - "Applying strategy: migrate_datasets\n", - "Applying strategy: migrate_exchanges\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", - "Applying strategy: migrate_datasets\n", - "Applying strategy: migrate_exchanges\n", - "Applying strategy: migrate_datasets\n", - "Applying strategy: migrate_exchanges\n", - "Remove uncertainty data.\n", - "The following datasets to import already exist in the source database. They will not be imported\n", - "+--------------------------------+--------------------------------+----------+--------------------------------+\n", - "| Name | Reference product | Location | File |\n", - "+--------------------------------+--------------------------------+----------+--------------------------------+\n", - "| methanol production facility, | methanol production facility, | RER | lci-synfuels-from-methanol-fro |\n", - "+--------------------------------+--------------------------------+----------+--------------------------------+\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", - "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.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", - "Applying strategy: migrate_datasets\n", - "Applying strategy: migrate_exchanges\n", - "Remove uncertainty data.\n", - "Extracted 5 worksheets in 0.54 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", - "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", - "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.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", - "Applying strategy: migrate_datasets\n", - "Applying strategy: migrate_exchanges\n", - "Remove uncertainty data.\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", - "Applying strategy: migrate_datasets\n", - "Applying strategy: migrate_exchanges\n", - "Remove uncertainty data.\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", - "Applying strategy: migrate_datasets\n", - "Applying strategy: migrate_exchanges\n", - "Remove uncertainty data.\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", - "Applying strategy: migrate_datasets\n", - "Applying strategy: migrate_exchanges\n", - "Remove uncertainty data.\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", - "Applying strategy: migrate_datasets\n", - "Applying strategy: migrate_exchanges\n", - "Remove uncertainty data.\n", - "Extracted 1 worksheets in 0.03 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", - "Remove uncertainty data.\n", - "Extracted 1 worksheets in 0.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", - "Remove uncertainty data.\n", - "Extracted 1 worksheets in 0.07 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.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.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.02 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", - "Remove uncertainty data.\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", - "Applying strategy: migrate_datasets\n", - "Applying strategy: migrate_exchanges\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", - "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.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", - "Applying strategy: migrate_datasets\n", - "Applying strategy: migrate_exchanges\n", - "Remove uncertainty data.\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", - "Applying strategy: migrate_datasets\n", - "Applying strategy: migrate_exchanges\n", - "Remove uncertainty data.\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", - "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.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", - "Applying strategy: migrate_datasets\n", - "Applying strategy: migrate_exchanges\n", - "Remove uncertainty data.\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 39 worksheets in 0.36 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", - "Remove uncertainty data.\n", - "Extracted 1 worksheets in 0.21 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", - "Remove uncertainty data.\n", - "Extracted 1 worksheets in 0.17 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", - "Remove uncertainty data.\n", - "Extracted 1 worksheets in 1.23 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", - "Remove uncertainty data.\n", - "Data cached. It is advised to restart your workflow at this point.\n", - "This allows premise to use the cached data instead, which results in\n", - "a faster workflow.\n", "- Fetching IAM data\n", "Done!\n" ] @@ -656,9 +90,11 @@ " #{\"model\":\"remind\", \"pathway\":\"SSP2-Base\", \"year\":2050},\n", " #{\"model\":\"remind\", \"pathway\":\"SSP2-Base\", \"year\":2010},\n", " #{\"model\":\"image\", \"pathway\":\"SSP2-Base\", \"year\":2020},\n", - " {\"model\":\"remind\", \"pathway\":\"SSP2-Base\", \"year\":2028},\n", - " #{\"model\":\"remind\", \"pathway\":\"SSP2-Base\", \"year\":2040},\n", - " #{\"model\":\"image\", \"pathway\":\"SSP2-Base\", \"year\":2050},\n", + " #{\"model\":\"remind\", \"pathway\":\"SSP2-Base\", \"year\":2050},\n", + " {\"model\":\"remind\", \"pathway\":\"SSP2-PkBudg1150\", \"year\":2050},\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", " #{\"model\":\"image\", \"pathway\":\"SSP2-Base\", \"year\":2050},\n", " ],\n", " source_db=\"ecoinvent-3.10-cutoff\", # <-- name of the database in the BW2 project. Must be a string.\n", @@ -668,14 +104,6 @@ ")" ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "0f71d709-497d-4454-9545-aafd07387bdf", - "metadata": {}, - "outputs": [], - "source": [] - }, { "cell_type": "code", "execution_count": 5, @@ -686,7 +114,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "Processing scenarios: 100%|█████████████| 1/1 [01:06<00:00, 66.21s/it]" + "Processing scenarios: 100%|█████████████| 1/1 [00:08<00:00, 8.58s/it]" ] }, { @@ -706,12 +134,75 @@ } ], "source": [ - "ndb.update()" + "ndb.update(\"battery\")" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, + "id": "d423f5a1-7bd5-4d0e-8e1f-38634dc80d1a", + "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": 6, + "id": "3b0e71e7-2fbb-4247-abcf-60ebb1909d4a", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "gearbox, for lorry 201.6\n", + "transmission, for lorry 291.2\n", + "treatment of used lorry, 40 metric ton -1\n", + "market for power distribution unit, for electric passenger car 4\n", + "assembly operation, for lorry 29223.50287857302\n", + "market for converter, for electric passenger car 25\n", + "market for inverter, for electric passenger car 41.19999946653843\n", + "suspension, for lorry 3440\n", + "power electronics, for lorry 265\n", + "tires and wheels, for lorry 1422\n", + "market for battery management system, for Li-ion battery 125.73132358067981\n", + "glider lightweighting 268.7599962415552\n", + "cabin, for lorry 1153\n", + "other components, for electric lorry 1059\n", + "maintenance, lorry 40 metric ton 1\n", + "frame, blanks and saddle, for lorry 5539\n", + "market for electric motor, electric passenger car 600\n", + "market for used Li-ion battery -314.32832768712774\n", + "retarder, for lorry 67.2\n", + "market for battery cell, Li-ion, NMC622 188.597004106448\n", + "heavy duty truck, battery electric, NMC-622 battery, 40t gross weight, long haul 1\n" + ] + } + ], + "source": [ + "from premise.utils import load_database\n", + "ndb.scenarios[0] = load_database(ndb.scenarios[0])\n", + "\n", + "for ds in ndb.scenarios[0][\"database\"]:\n", + " if ds[\"name\"] == \"heavy duty truck, battery electric, NMC-622 battery, 40t gross weight, long haul\":\n", + " for e in ds[\"exchanges\"]:\n", + " print(e[\"name\"], e[\"amount\"])" + ] + }, + { + "cell_type": "code", + "execution_count": 5, "id": "dff4efb1-69ab-4bd5-8d52-4038df180a85", "metadata": {}, "outputs": [ @@ -730,7 +221,7 @@ "text": [ "Writing activities to SQLite3 database:\n", "0% [##############################] 100% | ETA: 00:00:00\n", - "Total time elapsed: 00:00:32\n" + "Total time elapsed: 00:00:36\n" ] }, { @@ -738,11 +229,16 @@ "output_type": "stream", "text": [ "Title: Writing activities to SQLite3 database:\n", - " Started: 07/01/2024 17:19:47\n", - " Finished: 07/01/2024 17:20:20\n", - " Total time elapsed: 00:00:32\n", - " CPU %: 94.20\n", - " Memory %: 15.94\n" + " Started: 07/13/2024 20:50:02\n", + " Finished: 07/13/2024 20:50:39\n", + " Total time elapsed: 00:00:36\n", + " CPU %: 90.50\n", + " Memory %: 11.02\n", + "Created database: ei_cutoff_3.10_remind_SSP2-PkBudg1150_2050 2024-07-13\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" ] } ], @@ -752,197 +248,408 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 8, "id": "a3b56b3f-9583-4c90-ad21-551c5530e27c", "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "aluminium, primary, liquid\n", - "cooling energy, at -25 °c\n", - "1,1-dimethylcyclopentane\n", - "aluminium, primary, liquid\n", - "cooling energy, at -45 °c\n", - "cooling energy, at -45 °c\n", - "cooling energy, at -25 °c\n", - "fraction 8 from naphtha separation\n", - "fraction 8 from naphtha separation\n", - "fraction 1 from naphtha separation\n", - "2,3-dimethylbutane\n", - "heptane\n", - "fraction 7 from naphtha separation\n", - "2,3-dimethylbutane\n", - "cooling energy, at -55 °c\n", - "heptane\n", - "electricity, low voltage\n", - "cooling energy, at -55 °c\n", - "cooling energy, at -15 °c\n", - "2-methylpentane\n", - "sawnwood, paraná pine, dried (u=10%)\n", - "hexane\n", - "hexane\n", - "residual wood, dry\n", - "formaldehyde\n", - "sawlog and veneer log, paraná pine, measured as solid wood under bark\n", - "cooling energy, at -25 °c\n", - "cooling energy, at -100 °c\n", - "ventilation duct, elbow 90°, steel, 100x50 mm\n", - "cooling energy, at -160 °c\n", - "cooling energy, at -15 °c\n", - "cooling energy, at -45 °c\n", - "steam, in chemical industry\n", - "ventilation duct, elbow 90°, steel, 100x50 mm\n", - "cooling energy, at -100 °c\n", - "sawnwood, paraná pine, dried (u=10%)\n", - "residual wood, dry\n", - "aluminium, primary, liquid\n", - "sawnwood, paraná pine, dried (u=10%)\n", - "sawlog and veneer log, paraná pine, measured as solid wood under bark\n", - "fraction 1 from naphtha separation\n", - "cooling energy, at -100 °c\n", - "sawlog and veneer log, paraná pine, measured as solid wood under bark\n", - "aluminium, primary, liquid\n", - "steam, in chemical industry\n", - "sawnwood, paraná pine, dried (u=10%)\n", - "2-methylpentane\n", - "sawnwood, paraná pine, dried (u=10%)\n", - "cooling energy, at -160 °c\n", - "fraction 7 from naphtha separation\n", - "ventilation duct, elbow 90°, steel, 100x50 mm\n", - "electricity, low voltage\n", - "1,1-dimethylcyclopentane\n", - "aluminium, primary, liquid\n", - "sawlog and veneer log, paraná pine, measured as solid wood under bark\n", - "formaldehyde\n", - "methylcyclopentane\n", - "methylcyclohexane\n", - "methylcyclopentane\n", - "methylcyclohexane\n", - "electricity, high voltage\n", - "electricity, high voltage\n", - "electricity, high voltage\n", - "electricity, high voltage\n", - "electricity, high voltage\n", - "electricity, high voltage\n", - "electricity, high voltage\n", - "electricity, high voltage\n", - "electricity, high voltage\n", - "electricity, high voltage\n", - "electricity, high voltage\n", - "electricity, high voltage\n", - "electricity, high voltage\n", - "electricity, high voltage\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "natural gas, high pressure\n", - "transport, passenger car\n", - "transport, passenger car\n", - "transport, passenger car\n", - "transport, passenger car\n", - "transport, passenger car\n", - "transport, passenger car\n", - "transport, passenger car\n", - "transport, passenger car\n", - "transport, passenger car\n", - "transport, passenger car\n", - "transport, passenger car\n", - "transport, passenger car\n", - "transport, passenger car\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, freight, lorry\n", - "transport, passenger bus\n", - "transport, passenger bus\n", - "transport, passenger bus\n", - "transport, passenger bus\n", - "transport, passenger bus\n", - "transport, passenger bus\n", - "transport, passenger bus\n", - "transport, passenger bus\n", - "transport, passenger bus\n", - "transport, passenger bus\n", - "transport, passenger bus\n", - "transport, passenger bus\n", - "transport, passenger bus\n" - ] + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
<xarray.DataArray 'value' (region: 13)> Size: 104B\n",
+       "array([0.24319538, 0.11075869, 0.37354394, 0.1023092 , 0.41335137,\n",
+       "       0.10468423, 0.19437585, 0.19803933, 0.10542634, 0.1051091 ,\n",
+       "       0.09484875, 0.39999575, 0.14865214])\n",
+       "Coordinates:\n",
+       "  * region     (region) object 104B 'CAZ' 'CHA' 'EUR' ... 'SSA' 'USA' 'World'\n",
+       "    year       int64 8B 2050\n",
+       "    variables  <U6 24B 'cement'
" + ], + "text/plain": [ + " Size: 104B\n", + "array([0.24319538, 0.11075869, 0.37354394, 0.1023092 , 0.41335137,\n", + " 0.10468423, 0.19437585, 0.19803933, 0.10542634, 0.1051091 ,\n", + " 0.09484875, 0.39999575, 0.14865214])\n", + "Coordinates:\n", + " * region (region) object 104B 'CAZ' 'CHA' 'EUR' ... 'SSA' 'USA' 'World'\n", + " year int64 8B 2050\n", + " variables None: + super().__init__( + database, + iam_data, + model, + pathway, + year, + version, + system_model, + cache, + index, + ) + self.system_model = system_model + + def adjust_battery_mass(self) -> None: + """ + Adjust vehicle components (e.g., battery). + Adjust the battery mass to reflect progress in battery technology. + Specifically, we adjust the battery mass to reflect progress in + terms of cell energy density. + We leave the density unchanged after 2050. + """ + + energy_density = load_cell_energy_density() + + filters = [ws.contains("name", x) for x in energy_density] + + for ds in ws.get_many( + self.database, + ws.exclude( + ws.either( + *[ + ws.contains("name", x) + for x in [ + "market for battery", + "battery production", + "battery cell production", + "cell module production", + ] + ] + ) + ), + ): + + for exc in ws.technosphere(ds, ws.either(*filters)): + name = [x for x in energy_density if x in exc["name"]][0] + + scaling_factor = energy_density[name][2020] / np.clip( + np.interp( + self.year, + list(energy_density[name].keys()), + list(energy_density[name].values()), + ), + 0.1, + 0.5, + ) + + if "log parameters" not in ds: + ds["log parameters"] = {} + + ds["log parameters"]["battery input"] = exc["name"] + ds["log parameters"]["old battery mass"] = exc["amount"] + exc["amount"] *= scaling_factor + ds["log parameters"]["new battery mass"] = exc["amount"] + + self.write_log(ds, status="modified") + + def write_log(self, dataset, status="created"): + """ + Write log file. + """ + + logger.info( + f"{status}|{self.model}|{self.scenario}|{self.year}|" + f"{dataset['name']}|{dataset['location']}|" + f"{dataset.get('log parameters', {}).get('battery input', '')}|" + f"{dataset.get('log parameters', {}).get('old battery mass', '')}|" + f"{dataset.get('log parameters', {}).get('new battery mass', '')}" + ) diff --git a/premise/data/additional_inventories/lci-batteries-LiO2.xlsx b/premise/data/additional_inventories/lci-batteries-LiO2.xlsx index d2b338f0..af786c2c 100644 Binary files a/premise/data/additional_inventories/lci-batteries-LiO2.xlsx and b/premise/data/additional_inventories/lci-batteries-LiO2.xlsx differ diff --git a/premise/data/battery/energy_density.yaml b/premise/data/battery/energy_density.yaml new file mode 100644 index 00000000..707041c5 --- /dev/null +++ b/premise/data/battery/energy_density.yaml @@ -0,0 +1,78 @@ +# Battery cell energy densities, in kWh/kg cell +--- + +NMC111: + ecoinvent_aliases: + name: + - market for battery cell, Li-ion, NMC111 + - market for battery, Li-ion, NMC111, rechargeable, prismatic + target: + 2020: 0.150 + 2050: 0.200 + +NMC622: + ecoinvent_aliases: + name: + - market for battery cell, Li-ion, NMC622 + - market for battery, Li-ion, NMC622, rechargeable, prismatic + target: + 2020: 0.200 + 2050: 0.350 + +NMC811: + ecoinvent_aliases: + name: + - market for battery cell, Li-ion, NMC811 + - market for battery, Li-ion, NMC811, rechargeable, prismatic + target: + 2020: 0.220 + 2050: 0.500 + +NCA: + ecoinvent_aliases: + name: + - market for battery cell, Li-ion, NCA + - market for battery, Li-ion, NCA, rechargeable, prismatic + target: + 2020: 0.280 + 2050: 0.350 + +LFP: + ecoinvent_aliases: + name: + - market for battery cell, Li-ion, LFP + - market for battery, Li-ion, LFP, rechargeable, prismatic + target: + 2020: 0.140 + 2050: 0.250 + +LTO: + ecoinvent_aliases: + name: market for battery cell, Li-ion, LTO + target: + 2020: 0.080 + 2050: 0.150 + +LMO: + ecoinvent_aliases: + name: + - market for battery cell, Li-ion, LiMn2O4 + - market for battery, Li-ion, LiMn2O4, rechargeable, prismatic + + target: + 2020: 0.130 + 2050: 0.200 + +Li-O2: + ecoinvent_aliases: + name: market for battery, Li-oxygen, Li-O2 + target: + 2020: 0.24 + 2050: 0.50 + +BoP: + ecoinvent_aliases: + name: market for battery management system + target: + 2020: 0.2 + 2050: 0.5 diff --git a/premise/data/utils/logging/logconfig.yaml b/premise/data/utils/logging/logconfig.yaml index 71b3ad7d..1732f9b2 100644 --- a/premise/data/utils/logging/logconfig.yaml +++ b/premise/data/utils/logging/logconfig.yaml @@ -72,6 +72,14 @@ handlers: formatter: simple mode: a + file_battery: + class: logging.FileHandler + level: INFO + filename: "export/logs/premise_battery.log" + encoding: utf8 + formatter: simple + mode: a + file_emissions: class: logging.FileHandler level: INFO @@ -132,6 +140,11 @@ loggers: handlers: [ file_fuel ] propagate: False + battery: + level: INFO + handlers: [ file_battery ] + propagate: False + heat: level: INFO handlers: [ file_heat ] diff --git a/premise/data/utils/logging/reporting.yaml b/premise/data/utils/logging/reporting.yaml index d5901cf6..b4bc4854 100644 --- a/premise/data/utils/logging/reporting.yaml +++ b/premise/data/utils/logging/reporting.yaml @@ -462,6 +462,49 @@ premise_heat: unit: kg CO2/reference flow tab: Heat +premise_battery: + columns: + timestamp: + name: timestamp + description: Timestamp of the log entry + module: + name: module + description: Module name + level: + name: level + description: Log level + status: + name: status + description: Status of the dataset + model: + name: model + description: IAM model name + pathway: + name: pathway + description: Pathway name + year: + name: year + description: Year + dataset: + name: dataset + description: Dataset name + region: + name: region + description: Region name + battery input: + name: Battery provider + description: Name of the battery provider + unit: unitless + old battery mass: + name: Old battery mass + description: Mass of the battery before adjustment + unit: kg + new battery mass: + name: New battery mass + description: Mass of the battery after adjustment + unit: kg + tab: Battery + premise_emissions: columns: timestamp: diff --git a/premise/data_collection.py b/premise/data_collection.py index 8f71da8c..4f143f30 100644 --- a/premise/data_collection.py +++ b/premise/data_collection.py @@ -949,7 +949,12 @@ def __fetch_market_data( # check if values of input_vars are strings or lists if any(isinstance(x, list) for x in input_vars.values()): - vars = list(chain.from_iterable(input_vars.values())) + vars = [ + item + for sublist in input_vars.values() + for item in (sublist if isinstance(sublist, list) else [sublist]) + ] + else: vars = list(input_vars.values()) @@ -966,7 +971,12 @@ def __fetch_market_data( return None if any(isinstance(x, list) for x in input_vars.values()): - rev_input_vars = {x: k for k, v in input_vars.items() for x in v} + rev_input_vars = { + v: k + for k, val in input_vars.items() + for v in (val if isinstance(val, list) else [val]) + } + else: rev_input_vars = {v: k for k, v in input_vars.items()} @@ -994,6 +1004,9 @@ def __fetch_market_data( # fill NaNs with zeros market_data = market_data.fillna(0) + # remove attrs + market_data.attrs = {} + return market_data def get_iam_efficiencies( @@ -1012,6 +1025,7 @@ def get_iam_efficiencies( :param efficiency_labels: The efficiency labels to use. :param production_labels: The production labels to use. :param energy_labels: The energy labels to use. + :param use_absolute_efficiency: If True, the efficiency is considered as absolute. :return: a multidimensional array with sector's technologies market share for a given year, for all regions. @@ -1057,7 +1071,6 @@ def get_iam_efficiencies( elif production_labels and energy_labels: eff_data = xr.DataArray(dims=["variables"], coords={"variables": []}) for k, v in production_labels.items(): - # check that each element of energy.values() is in data.variables.values # knowing that energy.values() is a list of lists # and that each element of prod.values() is in data.variables.values diff --git a/premise/iam_variables_mapping/electricity_variables.yaml b/premise/iam_variables_mapping/electricity_variables.yaml index b3f75482..d2e9c3dd 100644 --- a/premise/iam_variables_mapping/electricity_variables.yaml +++ b/premise/iam_variables_mapping/electricity_variables.yaml @@ -1,7 +1,7 @@ Biogas CHP: ecoinvent_aliases: fltr: - - heat and power co-generation, biogas, gas engine + - heat and power co-generation, biogas, gas engine mask: reference product: heat ecoinvent_fuel_aliases: diff --git a/premise/new_database.py b/premise/new_database.py index c03e45b6..4d5c4cc8 100644 --- a/premise/new_database.py +++ b/premise/new_database.py @@ -16,6 +16,7 @@ from tqdm import tqdm from . import __version__ +from .battery import _update_battery from .biomass import _update_biomass from .cement import _update_cement from .clean_datasets import DatabaseCleaner @@ -865,6 +866,10 @@ def update(self, sectors: [str, list, None] = None) -> None: "steel": {"func": _update_steel, "args": (self.version, self.system_model)}, "fuels": {"func": _update_fuels, "args": (self.version, self.system_model)}, "heat": {"func": _update_heat, "args": (self.version, self.system_model)}, + "battery": { + "func": _update_battery, + "args": (self.version, self.system_model), + }, "emissions": { "func": _update_emissions, "args": (self.version, self.system_model, self.gains_scenario), diff --git a/premise/report.py b/premise/report.py index 0bac1598..616b160e 100644 --- a/premise/report.py +++ b/premise/report.py @@ -382,7 +382,7 @@ def generate_summary_report(scenarios: list, filename: Path) -> None: }, } - with open(REPORT_METADATA_FILEPATH, "r", encoding="utf-8") as stream: + with open(REPORT_METADATA_FILEPATH, encoding="utf-8") as stream: metadata = yaml.safe_load(stream) workbook = openpyxl.Workbook() @@ -423,7 +423,7 @@ def generate_summary_report(scenarios: list, filename: Path) -> None: ) if "CCS" in sector and iam_data is not None: - iam_data = iam_data * 100 + iam_data *= 100 if iam_data is None: continue @@ -536,6 +536,7 @@ def generate_change_report(source, version, source_type, system_model): "premise_electricity", "premise_fuel", "premise_heat", + "premise_battery", "premise_transport", "premise_steel", "premise_metal", diff --git a/premise/transport.py b/premise/transport.py index e27104d4..a11c858e 100644 --- a/premise/transport.py +++ b/premise/transport.py @@ -4,7 +4,6 @@ IAM data, and integrate them into the database. """ -import re import uuid from typing import Any, Dict, List, Union @@ -12,7 +11,6 @@ import xarray as xr import yaml from wurst import searching as ws -from wurst import transformations as wt from .filesystem_constants import DATA_DIR, IAM_OUTPUT_DIR, INVENTORY_DIR from .inventory_imports import VariousVehicles