diff --git a/dev/Untitled.ipynb b/dev/Untitled.ipynb index 713eee8e..2a639785 100644 --- a/dev/Untitled.ipynb +++ b/dev/Untitled.ipynb @@ -12,6 +12,24 @@ "bw.projects.set_current(\"ei39\")" ] }, + { + "cell_type": "code", + "execution_count": 2, + "id": "e2a2dd03-d36a-462c-afc7-71fc24127353", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Cache folder cleared!\n" + ] + } + ], + "source": [ + "clear_cache()" + ] + }, { "cell_type": "code", "execution_count": 2, @@ -22,8 +40,10 @@ "scenarios = [\n", " #{\"model\": \"image\", \"pathway\":\"SSP1-RCP19\", \"year\": 2050, \"filepath\":\"/Users/romain/Documents\"},\n", " {\"model\": \"message\", \"pathway\":\"SSP2-Base\", \"year\": 2020,},\n", - " {\"model\": \"message\", \"pathway\":\"SSP2-Base\", \"year\": 2060,},\n", - " #{\"model\": \"remind\", \"pathway\":\"SSP1-PkBudg500\", \"year\": 2050,},\n", + " {\"model\": \"message\", \"pathway\":\"SSP2-Base\", \"year\": 2040,},\n", + " #{\"model\": \"message\", \"pathway\":\"SSP2-Base\", \"year\": 2060,},\n", + " #{\"model\": \"message\", \"pathway\":\"SSP2-Base\", \"year\": 2080,},\n", + " {\"model\": \"message\", \"pathway\":\"SSP2-Base\", \"year\": 2100,},\n", "]" ] }, @@ -76,6 +96,316 @@ "Done!\n", "\n", "////////////////// IMPORTING DEFAULT INVENTORIES ///////////////////\n", + "Cannot find cached inventories. Will create them now for next time...\n", + "Importing default inventories...\n", + "\n", + "Extracted 1 worksheets in 0.11 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", + "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.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", + "Remove uncertainty data.\n", + "Extracted 1 worksheets in 0.45 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% purity | fluorspar, 97% purity | GLO | lci-PV.xlsx |\n", + "| metallization paste production, back side | metallization paste, back side | RER | lci-PV.xlsx |\n", + "| metallization paste production, back side, alumini | metallization paste, back side | RER | lci-PV.xlsx |\n", + "| metallization paste production, front side | metallization paste, front sid | RER | lci-PV.xlsx |\n", + "| photovoltaic module production, building-integrate | photovoltaic module, building- | RER | lci-PV.xlsx |\n", + "| photovoltaic module production, building-integrate | photovoltaic module, building- | RER | lci-PV.xlsx |\n", + "| photovoltaic mounting system production, for facad | photovoltaic mounting system, | RER | lci-PV.xlsx |\n", + "| photovoltaic mounting system production, for flat- | photovoltaic mounting system, | RER | lci-PV.xlsx |\n", + "| photovoltaic mounting system production, for slant | photovoltaic mounting system, | RER | lci-PV.xlsx |\n", + "| photovoltaic panel factory construction | photovoltaic panel factory | GLO | lci-PV.xlsx |\n", + "| polyvinylfluoride production | polyvinylfluoride | US | lci-PV.xlsx |\n", + "| polyvinylfluoride production, dispersion | polyvinylfluoride, dispersion | US | lci-PV.xlsx |\n", + "| polyvinylfluoride, film production | polyvinylfluoride, film | US | lci-PV.xlsx |\n", + "| silicon production, metallurgical grade | 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", + "Remove uncertainty data.\n", + "Extracted 1 worksheets in 0.01 seconds\n", + "Remove uncertainty data.\n", + "Extracted 1 worksheets in 0.02 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", + "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", + "| carbon dioxide, captured at cement production plan | carbon dioxide, captured and r | RER | lci-synfuels-from-methanol-from-cement-plant.xlsx |\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.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 distillation, hydrogen from coal gasifica | methanol, purified | RER | lci-synfuels-from-methanol-from-coal.xlsx |\n", + "| methanol synthesis, hydrogen from coal gasificatio | methanol, unpurified | RER | lci-synfuels-from-methanol-from-coal.xlsx |\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 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.02 seconds\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 4 worksheets in 0.30 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.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.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.09 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", + "Remove uncertainty data.\n", + "Extracted 1 worksheets in 0.01 seconds\n", + "Remove uncertainty data.\n", + "Done!\n", + "\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", "Done!\n", "\n", "/////////////////////// EXTRACTING IAM DATA ////////////////////////\n", @@ -107,6 +437,14 @@ "name": "stdout", "output_type": "stream", "text": [ + "`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", + "\n", + "////////////////// MEDIUM AND HEAVY DUTY TRUCKS ////////////////////\n", + "No truck transport markets found in IAM data. Skipping.\n", + "No truck transport markets found in IAM data. Skipping.\n", + "No truck transport markets found in IAM data. Skipping.\n", "\n", "/////////////////////////// ELECTRICITY ////////////////////////////\n", "Adjust efficiency and emissions of coal power plants...\n", @@ -120,22 +458,22 @@ "Create low voltage markets.\n", "Done!\n", "Adjust efficiency of power plants...\n", - "Rescale inventories and emissions for Biomass IGCC\n", + "Rescale inventories and emissions for Gas OC\n", + "Rescale inventories and emissions for Gas ST\n", + "Rescale inventories and emissions for Nuclear\n", + "Rescale inventories and emissions for Biomass ST\n", "Rescale inventories and emissions for Oil CC\n", + "Rescale inventories and emissions for Coal SC\n", + "Rescale inventories and emissions for Foil ST\n", "Rescale inventories and emissions for Coal IGCC CCS\n", "Rescale inventories and emissions for Gas CC CCS\n", "Rescale inventories and emissions for Coal PCU\n", - "Rescale inventories and emissions for Nuclear\n", + "Rescale inventories and emissions for Coal PC\n", "Rescale inventories and emissions for Gas CC\n", - "Rescale inventories and emissions for Coal SC\n", + "Rescale inventories and emissions for Coal PC CCS\n", "Rescale inventories and emissions for Coal IGCC\n", - "Rescale inventories and emissions for Foil ST\n", - "Rescale inventories and emissions for Gas ST\n", - "Rescale inventories and emissions for Gas OC\n", "Rescale inventories and emissions for Oil ST\n", - "Rescale inventories and emissions for Coal PC CCS\n", - "Rescale inventories and emissions for Coal PC\n", - "Rescale inventories and emissions for Biomass ST\n", + "Rescale inventories and emissions for Biomass IGCC\n", "Adjust efficiency and emissions of coal power plants...\n", "Update efficiency of solar PV panels.\n", "Create biomass markets.\n", @@ -147,27 +485,205 @@ "Create low voltage markets.\n", "Done!\n", "Adjust efficiency of power plants...\n", - "Rescale inventories and emissions for Biomass IGCC\n", + "Rescale inventories and emissions for Gas OC\n", + "Rescale inventories and emissions for Gas ST\n", + "Rescale inventories and emissions for Nuclear\n", + "Rescale inventories and emissions for Biomass ST\n", "Rescale inventories and emissions for Oil CC\n", + "Rescale inventories and emissions for Coal SC\n", + "Rescale inventories and emissions for Foil ST\n", "Rescale inventories and emissions for Coal IGCC CCS\n", "Rescale inventories and emissions for Gas CC CCS\n", "Rescale inventories and emissions for Coal PCU\n", - "Rescale inventories and emissions for Nuclear\n", + "Rescale inventories and emissions for Coal PC\n", "Rescale inventories and emissions for Gas CC\n", - "Rescale inventories and emissions for Coal SC\n", + "Rescale inventories and emissions for Coal PC CCS\n", "Rescale inventories and emissions for Coal IGCC\n", - "Rescale inventories and emissions for Foil ST\n", - "Rescale inventories and emissions for Gas ST\n", - "Rescale inventories and emissions for Gas OC\n", "Rescale inventories and emissions for Oil ST\n", - "Rescale inventories and emissions for Coal PC CCS\n", + "Rescale inventories and emissions for Biomass IGCC\n", + "Adjust efficiency and emissions of coal power plants...\n", + "Update efficiency of solar PV panels.\n", + "Create biomass markets.\n", + "Replace biomass inputs.\n", + "Create region-specific power plants.\n", + "Empty old electricity datasets\n", + "Create high voltage markets.\n", + "Create medium voltage markets.\n", + "Create low voltage markets.\n", + "Done!\n", + "Adjust efficiency of power plants...\n", + "Rescale inventories and emissions for Gas OC\n", + "Rescale inventories and emissions for Gas ST\n", + "Rescale inventories and emissions for Nuclear\n", + "Rescale inventories and emissions for Biomass ST\n", + "Rescale inventories and emissions for Oil CC\n", + "Rescale inventories and emissions for Coal SC\n", + "Rescale inventories and emissions for Foil ST\n", + "Rescale inventories and emissions for Coal IGCC CCS\n", + "Rescale inventories and emissions for Gas CC CCS\n", + "Rescale inventories and emissions for Coal PCU\n", "Rescale inventories and emissions for Coal PC\n", - "Rescale inventories and emissions for Biomass ST\n" + "Rescale inventories and emissions for Gas CC\n", + "Rescale inventories and emissions for Coal PC CCS\n", + "Rescale inventories and emissions for Coal IGCC\n", + "Rescale inventories and emissions for Oil ST\n", + "Rescale inventories and emissions for Biomass IGCC\n", + "\n", + "//////////////////////// DIRECT AIR CAPTURE ////////////////////////\n", + "No DAC markets found in IAM data. Skipping.\n", + "No DAC markets found in IAM data. Skipping.\n", + "No DAC markets found in IAM data. Skipping.\n", + "\n", + "///////////////////////////// CEMENT //////////////////////////////\n", + "Start integration of cement data...\n", + "Create new clinker production datasets and delete old datasets\n", + "Create new clinker market datasets and delete old datasets\n", + "Create new cement market datasets\n", + "Create new cement production datasets and adjust electricity consumption\n", + "Done!\n", + "Start integration of cement data...\n", + "Create new clinker production datasets and delete old datasets\n", + "Create new clinker market datasets and delete old datasets\n", + "Create new cement market datasets\n", + "Create new cement production datasets and adjust electricity consumption\n", + "Done!\n", + "Start integration of cement data...\n", + "Create new clinker production datasets and delete old datasets\n", + "Create new clinker market datasets and delete old datasets\n", + "Create new cement market datasets\n", + "Create new cement production datasets and adjust electricity consumption\n", + "Done!\n", + "\n", + "////////////////////////////// STEEL //////////////////////////////\n", + "Create new steel production datasets and empty old datasets\n", + "Create pig iron production datasets\n", + "Create new steel production datasets and empty old datasets\n", + "Create pig iron production datasets\n", + "Create new steel production datasets and empty old datasets\n", + "Create pig iron production datasets\n", + "\n", + "////////////////////////////// FUELS ///////////////////////////////\n", + "Generate region-specific hydrogen production pathways.\n", + "{'name': 'hydrogen production, gaseous, 200 bar, from PEM electrolysis, from grid electricity', 'var': 'hydrogen, electrolysis', 'feedstock name': 'electricity, low voltage', 'feedstock unit': 'kilowatt hour', 'floor value': 48.0}\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/Users/romain/GitHub/premise/premise/fuels.py:506: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison\n", + " hydrogen_efficiency_variable\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'name': 'hydrogen production, steam methane reforming, from biomethane, high and low temperature, with CCS (MDEA, 98% eff.), 26 bar', 'var': 'hydrogen, biomass, with CCS', 'feedstock name': 'biomethane', 'feedstock unit': 'kilogram', 'floor value': 3.2}\n", + "{'name': 'hydrogen production, steam methane reforming, from biomethane, high and low temperature, 26 bar', 'var': 'hydrogen, biomass', 'feedstock name': 'biomethane', 'feedstock unit': 'kilogram', 'floor value': 3.2}\n", + "{'name': 'hydrogen production, steam methane reforming of natural gas, 25 bar', 'var': 'hydrogen, nat. gas', 'feedstock name': 'natural gas', 'feedstock unit': 'cubic meter', 'floor value': 3.5}\n", + "{'name': 'hydrogen production, steam methane reforming of natural gas, with CCS (MDEA, 98% eff.), 25 bar', 'var': 'hydrogen, nat. gas, with CCS', 'feedstock name': 'natural gas', 'feedstock unit': 'cubic meter', 'floor value': 3.5}\n", + "{'name': 'hydrogen production, gaseous, 25 bar, from gasification of woody biomass in entrained flow gasifier, with CCS, at gasification plant', 'var': 'hydrogen, biomass, with CCS', 'feedstock name': 'wood chips', 'feedstock unit': 'kilogram', 'floor value': 7}\n", + "{'name': 'hydrogen production, gaseous, 25 bar, from gasification of woody biomass in entrained flow gasifier, at gasification plant', 'var': 'hydrogen, biomass', 'feedstock name': 'wood chips', 'feedstock unit': 'kilogram', 'floor value': 7}\n", + "{'name': 'hydrogen production, gaseous, 30 bar, from hard coal gasification and reforming, at coal gasification plant', 'var': 'hydrogen, coal', 'feedstock name': 'hard coal', 'feedstock unit': 'kilogram', 'floor value': 5}\n", + "{'name': 'hydrogen production, gaseous, 30 bar, from hard coal gasification and reforming, with CCS, at coal gasification plant', 'var': 'hydrogen, coal', 'feedstock name': 'hard coal', 'feedstock unit': 'kilogram', 'floor value': 5}\n", + "{'name': 'hydrogen production, gaseous, 100 bar, from methane pyrolysis', 'var': 'hydrogen, pyrolsis', 'feedstock name': 'natural gas', 'feedstock unit': 'cubic meter', 'floor value': 6.5}\n", + "{'name': 'hydrogen production, gaseous, 25 bar, from thermochemical water splitting, at solar tower', 'var': 'hydrogen, solar', 'feedstock name': 'Energy, solar, converted', 'feedstock unit': 'megajoule', 'floor value': 180}\n", + "Generate region-specific hydrogen supply chains.\n", + "Generate region-specific biogas and syngas supply chains.\n", + "Generate region-specific synthetic fuel supply chains.\n", + "Generate region-specific biofuel supply chains.\n", + "Generate new fuel markets.\n", + "--> petrol, unleaded\n", + "--> petrol, low-sulfur\n", + "--> diesel, low-sulfur\n", + "--> diesel\n", + "Done!\n", + "Generate region-specific hydrogen production pathways.\n", + "{'name': 'hydrogen production, gaseous, 200 bar, from PEM electrolysis, from grid electricity', 'var': 'hydrogen, electrolysis', 'feedstock name': 'electricity, low voltage', 'feedstock unit': 'kilowatt hour', 'floor value': 48.0}\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/Users/romain/GitHub/premise/premise/fuels.py:506: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison\n", + " hydrogen_efficiency_variable\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'name': 'hydrogen production, steam methane reforming, from biomethane, high and low temperature, with CCS (MDEA, 98% eff.), 26 bar', 'var': 'hydrogen, biomass, with CCS', 'feedstock name': 'biomethane', 'feedstock unit': 'kilogram', 'floor value': 3.2}\n", + "{'name': 'hydrogen production, steam methane reforming, from biomethane, high and low temperature, 26 bar', 'var': 'hydrogen, biomass', 'feedstock name': 'biomethane', 'feedstock unit': 'kilogram', 'floor value': 3.2}\n", + "{'name': 'hydrogen production, steam methane reforming of natural gas, 25 bar', 'var': 'hydrogen, nat. gas', 'feedstock name': 'natural gas', 'feedstock unit': 'cubic meter', 'floor value': 3.5}\n", + "{'name': 'hydrogen production, steam methane reforming of natural gas, with CCS (MDEA, 98% eff.), 25 bar', 'var': 'hydrogen, nat. gas, with CCS', 'feedstock name': 'natural gas', 'feedstock unit': 'cubic meter', 'floor value': 3.5}\n", + "{'name': 'hydrogen production, gaseous, 25 bar, from gasification of woody biomass in entrained flow gasifier, with CCS, at gasification plant', 'var': 'hydrogen, biomass, with CCS', 'feedstock name': 'wood chips', 'feedstock unit': 'kilogram', 'floor value': 7}\n", + "{'name': 'hydrogen production, gaseous, 25 bar, from gasification of woody biomass in entrained flow gasifier, at gasification plant', 'var': 'hydrogen, biomass', 'feedstock name': 'wood chips', 'feedstock unit': 'kilogram', 'floor value': 7}\n", + "{'name': 'hydrogen production, gaseous, 30 bar, from hard coal gasification and reforming, at coal gasification plant', 'var': 'hydrogen, coal', 'feedstock name': 'hard coal', 'feedstock unit': 'kilogram', 'floor value': 5}\n", + "{'name': 'hydrogen production, gaseous, 30 bar, from hard coal gasification and reforming, with CCS, at coal gasification plant', 'var': 'hydrogen, coal', 'feedstock name': 'hard coal', 'feedstock unit': 'kilogram', 'floor value': 5}\n", + "{'name': 'hydrogen production, gaseous, 100 bar, from methane pyrolysis', 'var': 'hydrogen, pyrolsis', 'feedstock name': 'natural gas', 'feedstock unit': 'cubic meter', 'floor value': 6.5}\n", + "{'name': 'hydrogen production, gaseous, 25 bar, from thermochemical water splitting, at solar tower', 'var': 'hydrogen, solar', 'feedstock name': 'Energy, solar, converted', 'feedstock unit': 'megajoule', 'floor value': 180}\n", + "Generate region-specific hydrogen supply chains.\n", + "Generate region-specific biogas and syngas supply chains.\n", + "Generate region-specific synthetic fuel supply chains.\n", + "Generate region-specific biofuel supply chains.\n", + "Generate new fuel markets.\n", + "--> petrol, unleaded\n", + "--> petrol, low-sulfur\n", + "--> diesel, low-sulfur\n", + "--> diesel\n", + "Done!\n", + "Generate region-specific hydrogen production pathways.\n", + "{'name': 'hydrogen production, gaseous, 200 bar, from PEM electrolysis, from grid electricity', 'var': 'hydrogen, electrolysis', 'feedstock name': 'electricity, low voltage', 'feedstock unit': 'kilowatt hour', 'floor value': 48.0}\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/Users/romain/GitHub/premise/premise/fuels.py:506: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison\n", + " hydrogen_efficiency_variable\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'name': 'hydrogen production, steam methane reforming, from biomethane, high and low temperature, with CCS (MDEA, 98% eff.), 26 bar', 'var': 'hydrogen, biomass, with CCS', 'feedstock name': 'biomethane', 'feedstock unit': 'kilogram', 'floor value': 3.2}\n", + "{'name': 'hydrogen production, steam methane reforming, from biomethane, high and low temperature, 26 bar', 'var': 'hydrogen, biomass', 'feedstock name': 'biomethane', 'feedstock unit': 'kilogram', 'floor value': 3.2}\n", + "{'name': 'hydrogen production, steam methane reforming of natural gas, 25 bar', 'var': 'hydrogen, nat. gas', 'feedstock name': 'natural gas', 'feedstock unit': 'cubic meter', 'floor value': 3.5}\n", + "{'name': 'hydrogen production, steam methane reforming of natural gas, with CCS (MDEA, 98% eff.), 25 bar', 'var': 'hydrogen, nat. gas, with CCS', 'feedstock name': 'natural gas', 'feedstock unit': 'cubic meter', 'floor value': 3.5}\n", + "{'name': 'hydrogen production, gaseous, 25 bar, from gasification of woody biomass in entrained flow gasifier, with CCS, at gasification plant', 'var': 'hydrogen, biomass, with CCS', 'feedstock name': 'wood chips', 'feedstock unit': 'kilogram', 'floor value': 7}\n", + "{'name': 'hydrogen production, gaseous, 25 bar, from gasification of woody biomass in entrained flow gasifier, at gasification plant', 'var': 'hydrogen, biomass', 'feedstock name': 'wood chips', 'feedstock unit': 'kilogram', 'floor value': 7}\n", + "{'name': 'hydrogen production, gaseous, 30 bar, from hard coal gasification and reforming, at coal gasification plant', 'var': 'hydrogen, coal', 'feedstock name': 'hard coal', 'feedstock unit': 'kilogram', 'floor value': 5}\n", + "{'name': 'hydrogen production, gaseous, 30 bar, from hard coal gasification and reforming, with CCS, at coal gasification plant', 'var': 'hydrogen, coal', 'feedstock name': 'hard coal', 'feedstock unit': 'kilogram', 'floor value': 5}\n", + "{'name': 'hydrogen production, gaseous, 100 bar, from methane pyrolysis', 'var': 'hydrogen, pyrolsis', 'feedstock name': 'natural gas', 'feedstock unit': 'cubic meter', 'floor value': 6.5}\n", + "{'name': 'hydrogen production, gaseous, 25 bar, from thermochemical water splitting, at solar tower', 'var': 'hydrogen, solar', 'feedstock name': 'Energy, solar, converted', 'feedstock unit': 'megajoule', 'floor value': 180}\n", + "Generate region-specific hydrogen supply chains.\n", + "Generate region-specific biogas and syngas supply chains.\n", + "Generate region-specific synthetic fuel supply chains.\n", + "Generate region-specific biofuel supply chains.\n", + "Generate new fuel markets.\n", + "--> petrol, unleaded\n", + "--> petrol, low-sulfur\n", + "--> diesel, low-sulfur\n", + "--> diesel\n", + "Done!\n", + "\n", + "/////////////////////////// EMISSIONS //////////////////////////////\n", + "Integrating GAINS EU emission factors.\n", + "Integrating GAINS IAM emission factors.\n", + "Integrating GAINS EU emission factors.\n", + "Integrating GAINS IAM emission factors.\n", + "Integrating GAINS EU emission factors.\n", + "Integrating GAINS IAM emission factors.\n" ] } ], "source": [ - "ndb.update_electricity()" + "ndb.update_all()" ] }, { @@ -180,38 +696,24 @@ "name": "stdout", "output_type": "stream", "text": [ - "Write new database(s) to Brightway2.\n", "Prepare database 1.\n", "- check for duplicates...\n", "- check for values format...\n", "- relinking exchanges...\n", - "Done!\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:24\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Title: Writing activities to SQLite3 database:\n", - " Started: 07/25/2023 18:12:50\n", - " Finished: 07/25/2023 18:13:14\n", - " Total time elapsed: 00:00:24\n", - " CPU %: 85.90\n", - " Memory %: 14.54\n", - "Created database: message2020\n", + "Done!\n", "Prepare database 2.\n", "- check for duplicates...\n", "- check for values format...\n", "- relinking exchanges...\n", + "Done!\n", + "Prepare database 3.\n", + "- check for duplicates...\n", + "- check for values format...\n", + "- relinking exchanges...\n", + "Done!\n", + "Building superstructure database...\n", + "Dropped 0 duplicate(s).\n", + "Scenario difference file exported to /Users/romain/GitHub/premise/dev/export/scenario diff files!\n", "Done!\n" ] }, @@ -221,7 +723,7 @@ "text": [ "Writing activities to SQLite3 database:\n", "0% [##############################] 100% | ETA: 00:00:00\n", - "Total time elapsed: 00:00:25\n" + "Total time elapsed: 00:00:27\n" ] }, { @@ -229,12 +731,12 @@ "output_type": "stream", "text": [ "Title: Writing activities to SQLite3 database:\n", - " Started: 07/25/2023 18:16:19\n", - " Finished: 07/25/2023 18:16:45\n", - " Total time elapsed: 00:00:25\n", - " CPU %: 87.70\n", - " Memory %: 10.77\n", - "Created database: message2060\n", + " Started: 07/27/2023 11:08:01\n", + " Finished: 07/27/2023 11:08:29\n", + " Total time elapsed: 00:00:27\n", + " CPU %: 83.30\n", + " Memory %: 16.49\n", + "Created database: super_db_2023-07-27\n", "Generate scenario report.\n", "Report saved under /Users/romain/GitHub/premise/dev/export/scenario_report.\n", "Generate change report.\n", @@ -243,413 +745,20 @@ } ], "source": [ - "ndb.write_db_to_brightway([\"message2020\", \"message2060\"])" + "ndb.write_superstructure_db_to_brightway()" ] }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 5, "id": "4247493c-67c4-492c-a124-e3b5590a3c76", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
<xarray.DataArray 'value' (year: 14)>\n",
-       "array([1.        , 1.0125    , 1.02518939, 1.03768939, 1.05056818,\n",
-       "       1.05549242, 1.06060606, 1.06060606, 1.06060606, 1.06060606,\n",
-       "       1.06060606, 1.06060606, 1.06060606, 1.06060606])\n",
-       "Coordinates:\n",
-       "    region     <U3 'WEU'\n",
-       "    variables  <U13 'Gas CC'\n",
-       "  * year       (year) int64 2020 2025 2030 2035 2040 ... 2080 2090 2100 2110
" - ], - "text/plain": [ - "\n", - "array([1. , 1.0125 , 1.02518939, 1.03768939, 1.05056818,\n", - " 1.05549242, 1.06060606, 1.06060606, 1.06060606, 1.06060606,\n", - " 1.06060606, 1.06060606, 1.06060606, 1.06060606])\n", - "Coordinates:\n", - " region None: if "input" in e: del e["input"] + ds["comment"] = "This dataset is a proxy dataset for a power plant. " \ + "It is used to create missing power plant datasets." + self.database.extend(new_datasets.values()) mapping = InventorySet(self.database) diff --git a/premise/iam_variables_mapping/crops_variables.yaml b/premise/iam_variables_mapping/crops_variables.yaml index a8daf429..16fe6aed 100644 --- a/premise/iam_variables_mapping/crops_variables.yaml +++ b/premise/iam_variables_mapping/crops_variables.yaml @@ -10,6 +10,9 @@ sugar: remind: temperate: sugarbeet tropical: sugarcane + message: + temperate: sugarbeet + tropical: sugarcane land_use: image: Land Use|Marginal|Biomass|Sugar land_use_change: @@ -22,6 +25,9 @@ oil: remind: temperate: rapeseed tropical: palm oil + message: + temperate: rapeseed + tropical: palm oil land_use: image: Land Use|Marginal|Biomass|OilCrop land_use_change: @@ -34,6 +40,9 @@ wood: remind: temperate: poplar tropical: eucalyptus + message: + temperate: poplar + tropical: eucalyptus land_use: image: Land Use|Marginal|Biomass|Woody land_use_change: @@ -46,6 +55,9 @@ grass: remind: temperate: switchgrass tropical: miscanthus + message: + temperate: switchgrass + tropical: miscanthus land_use: image: Land Use|Marginal|Biomass|Grassy land_use_change: @@ -58,6 +70,9 @@ grain: remind: temperate: corn tropical: corn + message: + temperate: corn + tropical: corn land_use: image: Land Use|Marginal|Biomass|Maize land_use_change: diff --git a/premise/iam_variables_mapping/fuels_variables.yaml b/premise/iam_variables_mapping/fuels_variables.yaml index 166e3235..c7be27c9 100644 --- a/premise/iam_variables_mapping/fuels_variables.yaml +++ b/premise/iam_variables_mapping/fuels_variables.yaml @@ -444,7 +444,7 @@ hydrogen, electrolysis: remind: Tech|Hydrogen|Electricity|Efficiency ecoinvent_aliases: fltr: - - hydrogen production, gaseous, 200 bar, from PEM electrolysis, from grid electricity + - hydrogen production, gaseous, 30 bar, from PEM electrolysis, from grid electricity hydrogen, solar: lhv: 120 diff --git a/premise/inventory_imports.py b/premise/inventory_imports.py index 063f539c..8191a009 100644 --- a/premise/inventory_imports.py +++ b/premise/inventory_imports.py @@ -559,6 +559,7 @@ def add_biosphere_links(self, delete_missing: bool = False) -> None: assert ( key in self.biosphere_dict ), f"Could not find a biosphere flow for {key}." + y["name"] = new_key[0] else: print(key) continue @@ -568,6 +569,7 @@ def add_biosphere_links(self, delete_missing: bool = False) -> None: self.biosphere_dict[key], ) + def lower_case_technosphere_exchanges(self) -> None: blakclist = [ "NOx", diff --git a/premise/transformation.py b/premise/transformation.py index 6bc77806..e568555b 100644 --- a/premise/transformation.py +++ b/premise/transformation.py @@ -553,6 +553,8 @@ def fetch_proxies( :param relink: if `relink`, exchanges from the datasets will be relinked to the most geographically-appropriate providers from the database. This is computer-intensive. :param regions: regions to create proxy datasets for. if None, all regions are considered. + :param delete_original_dataset: if True, delete original datasets from the database. + :param empty_original_activity: if True, empty original activities from exchanges. :return: dictionary with IAM regions as keys, proxy datasets as values. """ @@ -592,10 +594,10 @@ def fetch_proxies( if "input" in d_act[region]: del d_act[region]["input"] - if production_variable: + if production_variable is not None: # Add `production volume` field if isinstance(production_variable, str): - production_variable = [production_variable] + production_variable = [production_variable, ] if all( i in self.iam_data.production_volumes.variables