Skip to content

Commit

Permalink
Add processing for conventional CDR in Chapter 7
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhuppmann committed Jun 2, 2024
1 parent 66d452c commit 7b45fc3
Showing 1 changed file with 107 additions and 27 deletions.
134 changes: 107 additions & 27 deletions data/chapter-7-compilation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -55,92 +55,172 @@
{
"cell_type": "code",
"execution_count": null,
"id": "ae8810c4-2d4d-432c-afdf-f1763d8c5641",
"id": "e95a8933-448f-4c15-ab22-82a9a79a8fb5",
"metadata": {},
"outputs": [],
"source": [
"df_novel = pyam.IamDataFrame(\n",
" data,\n",
" **iamc_args,\n",
" value=data.columns,\n",
" unit=\"t CO2\",\n",
" region=\"World\",\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fb8a5635-38ca-4074-879e-a27fdd95792a",
"metadata": {},
"outputs": [],
"source": [
"df_novel.rename(\n",
" variable={\n",
" \"BECCS\": \"Bioenergy with CCS\",\n",
" \"Bio-oil Storage\": \"Bio-Oil Storage\",\n",
" \"DACCS\": \"Direct Air Capture with CCS\",\n",
" \"ERW\": \"Enhanced Weathering\",\n",
" \"Macroalgae\": \"Biomass Sinking\",\n",
" \"Mineralisation\": \"Mineral Products\",\n",
" },\n",
" inplace=True,\n",
")\n",
"df_novel.rename(\n",
" variable=dict([(i, f\"Carbon Removal|Novel|{i}\") for i in df_novel.variable]),\n",
" inplace=True,\n",
")\n",
"df_novel.aggregate(f\"Carbon Removal|Novel\", append=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "10c3d999-5b68-4039-80a1-995bcbd15855",
"metadata": {},
"outputs": [],
"source": [
"df_novel.rename(unit={\"t CO2\": \"t CO2/yr\"}, inplace=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "cafced12-86c6-4eeb-a40f-c784cf64f837",
"metadata": {},
"outputs": [],
"source": [
"df_novel.convert_unit(\"t CO2/yr\", \"Mt CO2/yr\", inplace=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7013bed3-333c-43a0-8eda-588cbaa28bab",
"metadata": {},
"outputs": [],
"source": [
"data = (\n",
" pd.read_excel(\"source/7_Deployment/Data_Chapter7_Figure2.xlsx\")\n",
" .rename(columns={\"Unnamed: 0\": \"year\"})\n",
" .set_index(\"year\")\n",
")\n",
"data"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e95a8933-448f-4c15-ab22-82a9a79a8fb5",
"id": "d47ec491-6152-4846-a8f1-81f58d72843e",
"metadata": {},
"outputs": [],
"source": [
"df = pyam.IamDataFrame(\n",
"df_conventional = pyam.IamDataFrame(\n",
" data,\n",
" **iamc_args,\n",
" value=data.columns,\n",
" unit=\"t CO2\",\n",
" unit=\"Mt CO2/yr\",\n",
" region=\"World\",\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f553c9ee-b625-4dbc-b8d0-24839f1ef677",
"id": "bff25dd8-42d4-4efc-b14f-4a1fa934978b",
"metadata": {},
"outputs": [],
"source": [
"df"
"df_conventional.rename(variable={\"Mean of models\": \"Mean of Models\"}, inplace=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "689b261a-9002-4f7a-8f12-beee22796910",
"id": "e633d9f3-cac8-4349-9481-65f75f05faae",
"metadata": {},
"outputs": [],
"source": [
"df.variable"
"df_conventional.variable"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fb8a5635-38ca-4074-879e-a27fdd95792a",
"id": "d1205de1-ebdf-4ee5-930f-d779016de7f9",
"metadata": {},
"outputs": [],
"source": [
"df.rename(\n",
" variable={\n",
" \"BECCS\": \"Bioenergy with CCS\",\n",
" \"Bio-oil Storage\": \"Bio-Oil Storage\",\n",
" \"DACCS\": \"Direct Air Capture with CCS\",\n",
" \"ERW\": \"Enhanced Weathering\",\n",
" \"Macroalgae\": \"Biomass Sinking\",\n",
" \"Mineralisation\": \"Mineral Products\",\n",
" },\n",
"df_conventional.rename(\n",
" variable= dict(\n",
" [(i, f\"Carbon Flux|Conventional CDR [{i}]\") for i in [\"BLUE\", \"H&C2023\", \"OSCAR\", \"Mean of Models\"]]\n",
" ),\n",
" inplace=True,\n",
")\n",
"df.rename(\n",
" variable=dict([(i, f\"Carbon Removal|Novel|{i}\") for i in df.variable]),\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "888d4fd5-3452-4533-9e19-b10d70fa0194",
"metadata": {},
"outputs": [],
"source": [
"nghgi_mapping = {\n",
" \"NGHGIs (lower-bound)\": \"Minimum\",\n",
" \"NGHGIs (mean)\": \"Median\",\n",
" \"NGHGIs (upper-bound)\": \"Maximum\",\n",
"}\n",
"\n",
"df_conventional.rename(\n",
" variable= dict(\n",
" [\n",
" (key, f\"Carbon Flux|Conventional CDR [Model-Adjusted Inventories][{value}]\")\n",
" for key, value in nghgi_mapping.items()\n",
" ]\n",
" ),\n",
" inplace=True,\n",
")\n",
"df.aggregate(f\"Carbon Removal|Novel\", append=True)"
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "10c3d999-5b68-4039-80a1-995bcbd15855",
"id": "5b6f1931-c26b-4b93-977d-b561af7878ca",
"metadata": {},
"outputs": [],
"source": [
"df.rename(unit={\"t CO2\": \"t CO2/yr\"}, inplace=True)"
"df_conventional.convert_unit(\"Mt CO2/yr\", \"Gt CO2/yr\", inplace=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "cafced12-86c6-4eeb-a40f-c784cf64f837",
"id": "c1ea1cf0-dd4c-485b-b3bf-f2b2377f0aad",
"metadata": {},
"outputs": [],
"source": [
"df.convert_unit(\"t CO2/yr\", \"Mt CO2/yr\", inplace=True)"
"df = pyam.concat([df_novel, df_conventional])"
]
},
{
Expand Down

0 comments on commit 7b45fc3

Please sign in to comment.