From 9a066dc45b7d94d8372a58d5f50531000f784253 Mon Sep 17 00:00:00 2001 From: Jonas Hoersch Date: Wed, 20 Mar 2024 21:39:01 +0100 Subject: [PATCH] enh(docs): Improve introduction notebook --- CHANGELOG.rst | 1 + docs/notebooks/introduction.ipynb | 1957 ++++++++++++++++++----------- 2 files changed, 1254 insertions(+), 704 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 15a828f..f23ab6e 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,7 @@ Changelog v0.4.1 (2023-03-20) ------------------------------------------------------------ * Add :func:`~core.antijoin` for performing anti-joins :pull:`48` +* Update usage guide for ``antijoin``, but also with more focus on ``extractlevel`` v0.4.0 (2023-12-12) ------------------------------------------------------------ diff --git a/docs/notebooks/introduction.ipynb b/docs/notebooks/introduction.ipynb index 18b2d1d..dc4c176 100644 --- a/docs/notebooks/introduction.ipynb +++ b/docs/notebooks/introduction.ipynb @@ -404,7 +404,7 @@ "from pandas_indexing.core import describelevel\n", "\n", "\n", - "describelevel(df) # or: df.idx" + "describelevel(df) # or: df.pix" ] }, { @@ -433,7 +433,7 @@ } ], "source": [ - "df.idx" + "df.pix" ] }, { @@ -589,416 +589,416 @@ " DeepElec_SSP2_HighRE_Budg900\n", " World\n", " Biomass\n", - " GW\n", - " 42.9843\n", - " 62.4717\n", - " 85.6698\n", - " 108.8834\n", - " 128.5653\n", - " 137.8452\n", - " 132.8316\n", - " 122.7382\n", - " 106.3772\n", - " 86.0265\n", - " 65.6548\n", - " 45.7591\n", - " 14.5047\n", - " 3.9628\n", - " 0.8198\n", - " 0.2150\n", + " GWh/yr\n", + " 2.352778e+05\n", + " 3.407222e+05\n", + " 4.669444e+05\n", + " 5.942778e+05\n", + " 7.219167e+05\n", + " 8.496389e+05\n", + " 9.855833e+05\n", + " 1.173833e+06\n", + " 1.359639e+06\n", + " 1.471139e+06\n", + " 1.513056e+06\n", + " 1.544750e+06\n", + " 1.564583e+06\n", + " 1.557556e+06\n", + " 1.543056e+06\n", + " 1.574306e+06\n", " \n", " \n", " Coal\n", - " GW\n", - " 1238.8766\n", - " 1525.9497\n", - " 1876.5954\n", - " 2075.2321\n", - " 1225.4509\n", - " 182.0149\n", - " 1.3532\n", - " 1.0729\n", - " 0.7763\n", - " 0.5029\n", - " 0.3111\n", - " 0.1836\n", - " 0.0783\n", - " 0.0918\n", - " 0.0965\n", - " 0.0866\n", + " GWh/yr\n", + " 7.419778e+06\n", + " 8.252667e+06\n", + " 9.246333e+06\n", + " 1.075747e+07\n", + " 6.045972e+06\n", + " 8.733611e+05\n", + " 6.444444e+03\n", + " 5.027778e+03\n", + " 3.694444e+03\n", + " 2.416667e+03\n", + " 1.555556e+03\n", + " 9.444444e+02\n", + " 4.444444e+02\n", + " 5.277778e+02\n", + " 5.555556e+02\n", + " 5.000000e+02\n", " \n", " \n", " Gas\n", - " GW\n", - " 1096.6736\n", - " 1343.1077\n", - " 1603.1686\n", - " 1852.6485\n", - " 1761.8057\n", - " 1584.4033\n", - " 1423.5393\n", - " 1289.4777\n", - " 863.8716\n", - " 562.8482\n", - " 393.7209\n", - " 349.9091\n", - " 306.3883\n", - " 213.5970\n", - " 52.6045\n", - " 0.2717\n", + " GWh/yr\n", + " 3.816028e+06\n", + " 5.050500e+06\n", + " 5.968778e+06\n", + " 7.060083e+06\n", + " 6.469250e+06\n", + " 4.551528e+06\n", + " 2.907250e+06\n", + " 2.602278e+06\n", + " 1.752056e+06\n", + " 1.218361e+06\n", + " 6.538889e+05\n", + " 5.281944e+05\n", + " 2.423333e+05\n", + " 1.685833e+05\n", + " 4.166667e+04\n", + " 3.888889e+02\n", " \n", " \n", " Geothermal\n", - " GW\n", - " 8.1129\n", - " 12.9985\n", - " 24.1612\n", - " 46.6573\n", - " 70.6469\n", - " 83.4506\n", - " 84.4893\n", - " 82.9688\n", - " 79.1452\n", - " 69.6628\n", - " 58.2021\n", - " 48.4007\n", - " 39.2795\n", - " 33.4793\n", - " 27.6530\n", - " 26.0198\n", + " GWh/yr\n", + " 6.041667e+04\n", + " 9.677778e+04\n", + " 1.799167e+05\n", + " 3.474167e+05\n", + " 5.260278e+05\n", + " 6.213611e+05\n", + " 6.291111e+05\n", + " 6.177778e+05\n", + " 5.893056e+05\n", + " 5.187222e+05\n", + " 4.333611e+05\n", + " 3.603889e+05\n", + " 2.924722e+05\n", + " 2.492778e+05\n", + " 2.059167e+05\n", + " 1.937500e+05\n", " \n", " \n", " Hydro\n", - " GW\n", - " 806.5684\n", - " 963.3523\n", - " 1239.6174\n", - " 1500.4508\n", - " 1669.3565\n", - " 1786.0468\n", - " 1858.7821\n", - " 1902.6347\n", - " 1925.6535\n", - " 1933.5199\n", - " 1931.1096\n", - " 1922.5689\n", - " 1893.6410\n", - " 1860.8611\n", - " 1846.1020\n", - " 1805.1398\n", + " GWh/yr\n", + " 2.976944e+06\n", + " 3.557028e+06\n", + " 4.386694e+06\n", + " 5.302056e+06\n", + " 5.813167e+06\n", + " 6.173778e+06\n", + " 6.423194e+06\n", + " 6.604167e+06\n", + " 6.717417e+06\n", + " 6.770250e+06\n", + " 6.782028e+06\n", + " 6.775917e+06\n", + " 6.722667e+06\n", + " 6.655833e+06\n", + " 6.631806e+06\n", + " 6.533167e+06\n", " \n", " \n", " Nuclear\n", - " GW\n", - " 408.3700\n", - " 404.3094\n", - " 379.1375\n", - " 345.2239\n", - " 310.1729\n", - " 275.5920\n", - " 234.7028\n", - " 214.4376\n", - " 186.0849\n", - " 156.7766\n", - " 123.9472\n", - " 92.0667\n", - " 38.7760\n", - " 8.4550\n", - " 0.5580\n", - " 0.0190\n", + " GWh/yr\n", + " 2.861861e+06\n", + " 2.642750e+06\n", + " 2.448556e+06\n", + " 2.214167e+06\n", + " 2.055667e+06\n", + " 1.876222e+06\n", + " 1.617278e+06\n", + " 1.502778e+06\n", + " 1.304083e+06\n", + " 1.098694e+06\n", + " 8.686111e+05\n", + " 6.451944e+05\n", + " 2.717500e+05\n", + " 5.925000e+04\n", + " 3.916667e+03\n", + " 1.388889e+02\n", " \n", " \n", " Oil\n", - " GW\n", - " 511.2499\n", - " 463.0961\n", - " 370.9638\n", - " 281.7401\n", - " 193.2768\n", - " 90.2329\n", - " 31.5964\n", - " 21.9000\n", - " 14.5023\n", - " 5.3412\n", - " 3.0643\n", - " 0.0120\n", - " 0.0120\n", - " 0.0120\n", - " 0.0121\n", - " 0.0126\n", + " GWh/yr\n", + " 1.088861e+06\n", + " 1.016972e+06\n", + " 8.353889e+05\n", + " 6.174167e+05\n", + " 4.317778e+05\n", + " 1.960556e+05\n", + " 6.919444e+04\n", + " 4.797222e+04\n", + " 3.175000e+04\n", + " 1.169444e+04\n", + " 6.722222e+03\n", + " 2.777778e+01\n", + " 2.777778e+01\n", + " 2.777778e+01\n", + " 2.777778e+01\n", + " 2.777778e+01\n", " \n", " \n", " Other\n", - " GW\n", - " 0.0000\n", - " 0.0000\n", - " 0.3396\n", - " 1.6562\n", - " 81.1098\n", - " 469.5231\n", - " 1253.0780\n", - " 2254.0165\n", - " 3341.6986\n", - " 4267.0716\n", - " 4925.4025\n", - " 5433.3976\n", - " 6432.1678\n", - " 7478.3260\n", - " 8321.3843\n", - " 9334.4241\n", + " GWh/yr\n", + " 0.000000e+00\n", + " 0.000000e+00\n", + " 4.444444e+02\n", + " 2.166667e+03\n", + " 8.913889e+04\n", + " 4.938889e+05\n", + " 1.204583e+06\n", + " 1.985111e+06\n", + " 2.790639e+06\n", + " 3.488083e+06\n", + " 4.020806e+06\n", + " 4.434639e+06\n", + " 5.261472e+06\n", + " 6.099583e+06\n", + " 6.740833e+06\n", + " 7.547194e+06\n", " \n", " \n", " Solar\n", - " GW\n", - " 2.6824\n", - " 49.6138\n", - " 219.8533\n", - " 650.9654\n", - " 3785.6891\n", - " 11094.4847\n", - " 19063.7817\n", - " 25567.7463\n", - " 30970.0341\n", - " 36084.4749\n", - " 41103.9907\n", - " 45274.5671\n", - " 54433.9907\n", - " 63055.4508\n", - " 68848.0820\n", - " 77430.1702\n", + " GWh/yr\n", + " 4.083333e+03\n", + " 8.325000e+04\n", + " 2.616111e+05\n", + " 9.263611e+05\n", + " 5.500722e+06\n", + " 1.566242e+07\n", + " 2.575731e+07\n", + " 3.404253e+07\n", + " 4.088394e+07\n", + " 4.723214e+07\n", + " 5.327061e+07\n", + " 5.819236e+07\n", + " 6.826367e+07\n", + " 7.754106e+07\n", + " 8.359456e+07\n", + " 9.270394e+07\n", " \n", " \n", " Wind\n", - " GW\n", - " 32.2604\n", - " 181.1785\n", - " 412.4751\n", - " 668.2517\n", - " 1616.3341\n", - " 3522.8061\n", - " 5459.5956\n", - " 6821.7448\n", - " 7986.3052\n", - " 9064.9635\n", - " 9934.7790\n", - " 10828.8617\n", - " 13200.2239\n", - " 14593.1334\n", - " 16010.7062\n", - " 17368.8215\n", + " GWh/yr\n", + " 1.091389e+05\n", + " 5.946944e+05\n", + " 8.323889e+05\n", + " 1.482806e+06\n", + " 3.695778e+06\n", + " 8.141417e+06\n", + " 1.318953e+07\n", + " 1.727517e+07\n", + " 2.112919e+07\n", + " 2.367689e+07\n", + " 2.569986e+07\n", + " 2.771675e+07\n", + " 3.280081e+07\n", + " 3.570786e+07\n", + " 3.840797e+07\n", + " 4.123369e+07\n", " \n", " \n", "\n", "" ], "text/plain": [ - " 2005 \\\n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GW 42.9843 \n", - " Coal GW 1238.8766 \n", - " Gas GW 1096.6736 \n", - " Geothermal GW 8.1129 \n", - " Hydro GW 806.5684 \n", - " Nuclear GW 408.3700 \n", - " Oil GW 511.2499 \n", - " Other GW 0.0000 \n", - " Solar GW 2.6824 \n", - " Wind GW 32.2604 \n", - "\n", - " 2010 \\\n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GW 62.4717 \n", - " Coal GW 1525.9497 \n", - " Gas GW 1343.1077 \n", - " Geothermal GW 12.9985 \n", - " Hydro GW 963.3523 \n", - " Nuclear GW 404.3094 \n", - " Oil GW 463.0961 \n", - " Other GW 0.0000 \n", - " Solar GW 49.6138 \n", - " Wind GW 181.1785 \n", - "\n", - " 2015 \\\n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GW 85.6698 \n", - " Coal GW 1876.5954 \n", - " Gas GW 1603.1686 \n", - " Geothermal GW 24.1612 \n", - " Hydro GW 1239.6174 \n", - " Nuclear GW 379.1375 \n", - " Oil GW 370.9638 \n", - " Other GW 0.3396 \n", - " Solar GW 219.8533 \n", - " Wind GW 412.4751 \n", - "\n", - " 2020 \\\n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GW 108.8834 \n", - " Coal GW 2075.2321 \n", - " Gas GW 1852.6485 \n", - " Geothermal GW 46.6573 \n", - " Hydro GW 1500.4508 \n", - " Nuclear GW 345.2239 \n", - " Oil GW 281.7401 \n", - " Other GW 1.6562 \n", - " Solar GW 650.9654 \n", - " Wind GW 668.2517 \n", - "\n", - " 2025 \\\n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GW 128.5653 \n", - " Coal GW 1225.4509 \n", - " Gas GW 1761.8057 \n", - " Geothermal GW 70.6469 \n", - " Hydro GW 1669.3565 \n", - " Nuclear GW 310.1729 \n", - " Oil GW 193.2768 \n", - " Other GW 81.1098 \n", - " Solar GW 3785.6891 \n", - " Wind GW 1616.3341 \n", - "\n", - " 2030 \\\n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GW 137.8452 \n", - " Coal GW 182.0149 \n", - " Gas GW 1584.4033 \n", - " Geothermal GW 83.4506 \n", - " Hydro GW 1786.0468 \n", - " Nuclear GW 275.5920 \n", - " Oil GW 90.2329 \n", - " Other GW 469.5231 \n", - " Solar GW 11094.4847 \n", - " Wind GW 3522.8061 \n", - "\n", - " 2035 \\\n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GW 132.8316 \n", - " Coal GW 1.3532 \n", - " Gas GW 1423.5393 \n", - " Geothermal GW 84.4893 \n", - " Hydro GW 1858.7821 \n", - " Nuclear GW 234.7028 \n", - " Oil GW 31.5964 \n", - " Other GW 1253.0780 \n", - " Solar GW 19063.7817 \n", - " Wind GW 5459.5956 \n", - "\n", - " 2040 \\\n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GW 122.7382 \n", - " Coal GW 1.0729 \n", - " Gas GW 1289.4777 \n", - " Geothermal GW 82.9688 \n", - " Hydro GW 1902.6347 \n", - " Nuclear GW 214.4376 \n", - " Oil GW 21.9000 \n", - " Other GW 2254.0165 \n", - " Solar GW 25567.7463 \n", - " Wind GW 6821.7448 \n", - "\n", - " 2045 \\\n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GW 106.3772 \n", - " Coal GW 0.7763 \n", - " Gas GW 863.8716 \n", - " Geothermal GW 79.1452 \n", - " Hydro GW 1925.6535 \n", - " Nuclear GW 186.0849 \n", - " Oil GW 14.5023 \n", - " Other GW 3341.6986 \n", - " Solar GW 30970.0341 \n", - " Wind GW 7986.3052 \n", - "\n", - " 2050 \\\n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GW 86.0265 \n", - " Coal GW 0.5029 \n", - " Gas GW 562.8482 \n", - " Geothermal GW 69.6628 \n", - " Hydro GW 1933.5199 \n", - " Nuclear GW 156.7766 \n", - " Oil GW 5.3412 \n", - " Other GW 4267.0716 \n", - " Solar GW 36084.4749 \n", - " Wind GW 9064.9635 \n", - "\n", - " 2055 \\\n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GW 65.6548 \n", - " Coal GW 0.3111 \n", - " Gas GW 393.7209 \n", - " Geothermal GW 58.2021 \n", - " Hydro GW 1931.1096 \n", - " Nuclear GW 123.9472 \n", - " Oil GW 3.0643 \n", - " Other GW 4925.4025 \n", - " Solar GW 41103.9907 \n", - " Wind GW 9934.7790 \n", - "\n", - " 2060 \\\n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GW 45.7591 \n", - " Coal GW 0.1836 \n", - " Gas GW 349.9091 \n", - " Geothermal GW 48.4007 \n", - " Hydro GW 1922.5689 \n", - " Nuclear GW 92.0667 \n", - " Oil GW 0.0120 \n", - " Other GW 5433.3976 \n", - " Solar GW 45274.5671 \n", - " Wind GW 10828.8617 \n", - "\n", - " 2070 \\\n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GW 14.5047 \n", - " Coal GW 0.0783 \n", - " Gas GW 306.3883 \n", - " Geothermal GW 39.2795 \n", - " Hydro GW 1893.6410 \n", - " Nuclear GW 38.7760 \n", - " Oil GW 0.0120 \n", - " Other GW 6432.1678 \n", - " Solar GW 54433.9907 \n", - " Wind GW 13200.2239 \n", - "\n", - " 2080 \\\n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GW 3.9628 \n", - " Coal GW 0.0918 \n", - " Gas GW 213.5970 \n", - " Geothermal GW 33.4793 \n", - " Hydro GW 1860.8611 \n", - " Nuclear GW 8.4550 \n", - " Oil GW 0.0120 \n", - " Other GW 7478.3260 \n", - " Solar GW 63055.4508 \n", - " Wind GW 14593.1334 \n", - "\n", - " 2090 \\\n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GW 0.8198 \n", - " Coal GW 0.0965 \n", - " Gas GW 52.6045 \n", - " Geothermal GW 27.6530 \n", - " Hydro GW 1846.1020 \n", - " Nuclear GW 0.5580 \n", - " Oil GW 0.0121 \n", - " Other GW 8321.3843 \n", - " Solar GW 68848.0820 \n", - " Wind GW 16010.7062 \n", - "\n", - " 2100 \n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GW 0.2150 \n", - " Coal GW 0.0866 \n", - " Gas GW 0.2717 \n", - " Geothermal GW 26.0198 \n", - " Hydro GW 1805.1398 \n", - " Nuclear GW 0.0190 \n", - " Oil GW 0.0126 \n", - " Other GW 9334.4241 \n", - " Solar GW 77430.1702 \n", - " Wind GW 17368.8215 " + " 2005 \\\n", + "model scenario region variable unit \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GWh/yr 2.352778e+05 \n", + " Coal GWh/yr 7.419778e+06 \n", + " Gas GWh/yr 3.816028e+06 \n", + " Geothermal GWh/yr 6.041667e+04 \n", + " Hydro GWh/yr 2.976944e+06 \n", + " Nuclear GWh/yr 2.861861e+06 \n", + " Oil GWh/yr 1.088861e+06 \n", + " Other GWh/yr 0.000000e+00 \n", + " Solar GWh/yr 4.083333e+03 \n", + " Wind GWh/yr 1.091389e+05 \n", + "\n", + " 2010 \\\n", + "model scenario region variable unit \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GWh/yr 3.407222e+05 \n", + " Coal GWh/yr 8.252667e+06 \n", + " Gas GWh/yr 5.050500e+06 \n", + " Geothermal GWh/yr 9.677778e+04 \n", + " Hydro GWh/yr 3.557028e+06 \n", + " Nuclear GWh/yr 2.642750e+06 \n", + " Oil GWh/yr 1.016972e+06 \n", + " Other GWh/yr 0.000000e+00 \n", + " Solar GWh/yr 8.325000e+04 \n", + " Wind GWh/yr 5.946944e+05 \n", + "\n", + " 2015 \\\n", + "model scenario region variable unit \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GWh/yr 4.669444e+05 \n", + " Coal GWh/yr 9.246333e+06 \n", + " Gas GWh/yr 5.968778e+06 \n", + " Geothermal GWh/yr 1.799167e+05 \n", + " Hydro GWh/yr 4.386694e+06 \n", + " Nuclear GWh/yr 2.448556e+06 \n", + " Oil GWh/yr 8.353889e+05 \n", + " Other GWh/yr 4.444444e+02 \n", + " Solar GWh/yr 2.616111e+05 \n", + " Wind GWh/yr 8.323889e+05 \n", + "\n", + " 2020 \\\n", + "model scenario region variable unit \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GWh/yr 5.942778e+05 \n", + " Coal GWh/yr 1.075747e+07 \n", + " Gas GWh/yr 7.060083e+06 \n", + " Geothermal GWh/yr 3.474167e+05 \n", + " Hydro GWh/yr 5.302056e+06 \n", + " Nuclear GWh/yr 2.214167e+06 \n", + " Oil GWh/yr 6.174167e+05 \n", + " Other GWh/yr 2.166667e+03 \n", + " Solar GWh/yr 9.263611e+05 \n", + " Wind GWh/yr 1.482806e+06 \n", + "\n", + " 2025 \\\n", + "model scenario region variable unit \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GWh/yr 7.219167e+05 \n", + " Coal GWh/yr 6.045972e+06 \n", + " Gas GWh/yr 6.469250e+06 \n", + " Geothermal GWh/yr 5.260278e+05 \n", + " Hydro GWh/yr 5.813167e+06 \n", + " Nuclear GWh/yr 2.055667e+06 \n", + " Oil GWh/yr 4.317778e+05 \n", + " Other GWh/yr 8.913889e+04 \n", + " Solar GWh/yr 5.500722e+06 \n", + " Wind GWh/yr 3.695778e+06 \n", + "\n", + " 2030 \\\n", + "model scenario region variable unit \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GWh/yr 8.496389e+05 \n", + " Coal GWh/yr 8.733611e+05 \n", + " Gas GWh/yr 4.551528e+06 \n", + " Geothermal GWh/yr 6.213611e+05 \n", + " Hydro GWh/yr 6.173778e+06 \n", + " Nuclear GWh/yr 1.876222e+06 \n", + " Oil GWh/yr 1.960556e+05 \n", + " Other GWh/yr 4.938889e+05 \n", + " Solar GWh/yr 1.566242e+07 \n", + " Wind GWh/yr 8.141417e+06 \n", + "\n", + " 2035 \\\n", + "model scenario region variable unit \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GWh/yr 9.855833e+05 \n", + " Coal GWh/yr 6.444444e+03 \n", + " Gas GWh/yr 2.907250e+06 \n", + " Geothermal GWh/yr 6.291111e+05 \n", + " Hydro GWh/yr 6.423194e+06 \n", + " Nuclear GWh/yr 1.617278e+06 \n", + " Oil GWh/yr 6.919444e+04 \n", + " Other GWh/yr 1.204583e+06 \n", + " Solar GWh/yr 2.575731e+07 \n", + " Wind GWh/yr 1.318953e+07 \n", + "\n", + " 2040 \\\n", + "model scenario region variable unit \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GWh/yr 1.173833e+06 \n", + " Coal GWh/yr 5.027778e+03 \n", + " Gas GWh/yr 2.602278e+06 \n", + " Geothermal GWh/yr 6.177778e+05 \n", + " Hydro GWh/yr 6.604167e+06 \n", + " Nuclear GWh/yr 1.502778e+06 \n", + " Oil GWh/yr 4.797222e+04 \n", + " Other GWh/yr 1.985111e+06 \n", + " Solar GWh/yr 3.404253e+07 \n", + " Wind GWh/yr 1.727517e+07 \n", + "\n", + " 2045 \\\n", + "model scenario region variable unit \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GWh/yr 1.359639e+06 \n", + " Coal GWh/yr 3.694444e+03 \n", + " Gas GWh/yr 1.752056e+06 \n", + " Geothermal GWh/yr 5.893056e+05 \n", + " Hydro GWh/yr 6.717417e+06 \n", + " Nuclear GWh/yr 1.304083e+06 \n", + " Oil GWh/yr 3.175000e+04 \n", + " Other GWh/yr 2.790639e+06 \n", + " Solar GWh/yr 4.088394e+07 \n", + " Wind GWh/yr 2.112919e+07 \n", + "\n", + " 2050 \\\n", + "model scenario region variable unit \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GWh/yr 1.471139e+06 \n", + " Coal GWh/yr 2.416667e+03 \n", + " Gas GWh/yr 1.218361e+06 \n", + " Geothermal GWh/yr 5.187222e+05 \n", + " Hydro GWh/yr 6.770250e+06 \n", + " Nuclear GWh/yr 1.098694e+06 \n", + " Oil GWh/yr 1.169444e+04 \n", + " Other GWh/yr 3.488083e+06 \n", + " Solar GWh/yr 4.723214e+07 \n", + " Wind GWh/yr 2.367689e+07 \n", + "\n", + " 2055 \\\n", + "model scenario region variable unit \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GWh/yr 1.513056e+06 \n", + " Coal GWh/yr 1.555556e+03 \n", + " Gas GWh/yr 6.538889e+05 \n", + " Geothermal GWh/yr 4.333611e+05 \n", + " Hydro GWh/yr 6.782028e+06 \n", + " Nuclear GWh/yr 8.686111e+05 \n", + " Oil GWh/yr 6.722222e+03 \n", + " Other GWh/yr 4.020806e+06 \n", + " Solar GWh/yr 5.327061e+07 \n", + " Wind GWh/yr 2.569986e+07 \n", + "\n", + " 2060 \\\n", + "model scenario region variable unit \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GWh/yr 1.544750e+06 \n", + " Coal GWh/yr 9.444444e+02 \n", + " Gas GWh/yr 5.281944e+05 \n", + " Geothermal GWh/yr 3.603889e+05 \n", + " Hydro GWh/yr 6.775917e+06 \n", + " Nuclear GWh/yr 6.451944e+05 \n", + " Oil GWh/yr 2.777778e+01 \n", + " Other GWh/yr 4.434639e+06 \n", + " Solar GWh/yr 5.819236e+07 \n", + " Wind GWh/yr 2.771675e+07 \n", + "\n", + " 2070 \\\n", + "model scenario region variable unit \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GWh/yr 1.564583e+06 \n", + " Coal GWh/yr 4.444444e+02 \n", + " Gas GWh/yr 2.423333e+05 \n", + " Geothermal GWh/yr 2.924722e+05 \n", + " Hydro GWh/yr 6.722667e+06 \n", + " Nuclear GWh/yr 2.717500e+05 \n", + " Oil GWh/yr 2.777778e+01 \n", + " Other GWh/yr 5.261472e+06 \n", + " Solar GWh/yr 6.826367e+07 \n", + " Wind GWh/yr 3.280081e+07 \n", + "\n", + " 2080 \\\n", + "model scenario region variable unit \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GWh/yr 1.557556e+06 \n", + " Coal GWh/yr 5.277778e+02 \n", + " Gas GWh/yr 1.685833e+05 \n", + " Geothermal GWh/yr 2.492778e+05 \n", + " Hydro GWh/yr 6.655833e+06 \n", + " Nuclear GWh/yr 5.925000e+04 \n", + " Oil GWh/yr 2.777778e+01 \n", + " Other GWh/yr 6.099583e+06 \n", + " Solar GWh/yr 7.754106e+07 \n", + " Wind GWh/yr 3.570786e+07 \n", + "\n", + " 2090 \\\n", + "model scenario region variable unit \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GWh/yr 1.543056e+06 \n", + " Coal GWh/yr 5.555556e+02 \n", + " Gas GWh/yr 4.166667e+04 \n", + " Geothermal GWh/yr 2.059167e+05 \n", + " Hydro GWh/yr 6.631806e+06 \n", + " Nuclear GWh/yr 3.916667e+03 \n", + " Oil GWh/yr 2.777778e+01 \n", + " Other GWh/yr 6.740833e+06 \n", + " Solar GWh/yr 8.359456e+07 \n", + " Wind GWh/yr 3.840797e+07 \n", + "\n", + " 2100 \n", + "model scenario region variable unit \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GWh/yr 1.574306e+06 \n", + " Coal GWh/yr 5.000000e+02 \n", + " Gas GWh/yr 3.888889e+02 \n", + " Geothermal GWh/yr 1.937500e+05 \n", + " Hydro GWh/yr 6.533167e+06 \n", + " Nuclear GWh/yr 1.388889e+02 \n", + " Oil GWh/yr 2.777778e+01 \n", + " Other GWh/yr 7.547194e+06 \n", + " Solar GWh/yr 9.270394e+07 \n", + " Wind GWh/yr 4.123369e+07 " ] }, "execution_count": 7, @@ -1010,10 +1010,7 @@ "generation = df.loc[ismatch(variable=\"Secondary Energy|**\")].rename(\n", " index=lambda s: s.removeprefix(\"Secondary Energy|Electricity|\")\n", ")\n", - "capacity = df.loc[ismatch(variable=\"Capacity|**\")].rename(\n", - " index=lambda s: s.removeprefix(\"Capacity|Electricity|\")\n", - ")\n", - "capacity" + "generation" ] }, { @@ -1518,9 +1515,10 @@ "from pandas_indexing import extractlevel, formatlevel\n", "\n", "\n", - "splitdf = extractlevel(df, variable=\"Secondary Energy|{carrier}|{fuel}\", drop=True)\n", + "generation = extractlevel(df, variable=\"Secondary Energy|{carrier}|{fuel}\", drop=True)\n", + "capacity = extractlevel(df, variable=\"Capacity|{carrier}|{fuel}\", drop=True)\n", "# or: df.pix.extract(variable=\"Secondary Energy|{carrier}|{fuel}\")\n", - "splitdf" + "generation" ] }, { @@ -2013,29 +2011,175 @@ " Secondary Energy|Electricity|Wind 4.123369e+07 " ] }, - "execution_count": 9, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "formatlevel(generation, variable=\"Secondary Energy|{carrier}|{fuel}\", drop=True)\n", + "# or: df.pix.format(variable=\"Secondary Energy|{carrier}|{fuel}\")" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "id": "e78ace7d", + "metadata": {}, + "source": [ + "With `generation` and `capacity` conveniently split into separate variables, we can calculate capacity factors (ratios of generation and capacity) directly, as long as we take care of removing the conflicting `unit` level. Similarly to `ismatch`, `isin` can be provided as an argument to `.loc[]` to select on named index levels with the difference that only exact matches are considered." + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "9b4be2b0", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
20302035204020452050
modelscenarioregioncarrierfuel
REMIND-MAgPIE 2.1-4.3DeepElec_SSP2_HighRE_Budg900WorldElectricityGeothermal0.8499840.8500050.8499890.8499860.850021
Hydro0.3945970.3944740.3962400.3982170.399716
Solar0.1611560.1542370.1519940.1506980.149422
Wind0.2638200.2757810.2890830.3020180.298163
\n", + "
" + ], + "text/plain": [ + " 2030 \\\n", + "model scenario region carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Electricity Geothermal 0.849984 \n", + " Hydro 0.394597 \n", + " Solar 0.161156 \n", + " Wind 0.263820 \n", + "\n", + " 2035 \\\n", + "model scenario region carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Electricity Geothermal 0.850005 \n", + " Hydro 0.394474 \n", + " Solar 0.154237 \n", + " Wind 0.275781 \n", + "\n", + " 2040 \\\n", + "model scenario region carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Electricity Geothermal 0.849989 \n", + " Hydro 0.396240 \n", + " Solar 0.151994 \n", + " Wind 0.289083 \n", + "\n", + " 2045 \\\n", + "model scenario region carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Electricity Geothermal 0.849986 \n", + " Hydro 0.398217 \n", + " Solar 0.150698 \n", + " Wind 0.302018 \n", + "\n", + " 2050 \n", + "model scenario region carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Electricity Geothermal 0.850021 \n", + " Hydro 0.399716 \n", + " Solar 0.149422 \n", + " Wind 0.298163 " + ] + }, + "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "formatlevel(splitdf, variable=\"Secondary Energy|{carrier}|{fuel}\", drop=True)\n", - "# or: df.pix.format(variable=\"Secondary Energy|{carrier}|{fuel}\")" + "capacity_factor = generation.droplevel(\"unit\") / 8760 / capacity.droplevel(\"unit\")\n", + "capacity_factor.loc[isin(fuel=[\"Solar\", \"Wind\", \"Hydro\", \"Geothermal\"]), 2030:2051]" ] }, { - "attachments": {}, "cell_type": "markdown", - "id": "e78ace7d", + "id": "d62fabd9", "metadata": {}, "source": [ - "With `generation` and `capacity` conveniently split into separate variables, we can calculate capacity factors (ratios of generation and capacity) directly, as long as we take care of removing the conflicting `unit` level. Similarly to `ismatch`, `isin` can be provided as an argument to `.loc[]` to select on named index levels with the difference that only exact matches are considered." + "Instead of dropping the `unit` level, there is also a set of unit-aware calculation functions, so that this full capacity factor calculation can be performed in very few steps (the unit aware calculation realizes correctly that the capacity factor is unit-less):" ] }, { "cell_type": "code", - "execution_count": 10, - "id": "9b4be2b0", + "execution_count": 11, + "id": "94c1f308", "metadata": {}, "outputs": [ { @@ -2062,17 +2206,43 @@ " \n", " \n", " \n", + " \n", + " \n", + " 2005\n", + " 2010\n", + " 2015\n", + " 2020\n", + " 2025\n", " 2030\n", " 2035\n", " 2040\n", " 2045\n", " 2050\n", + " 2055\n", + " 2060\n", + " 2070\n", + " 2080\n", + " 2090\n", + " 2100\n", " \n", " \n", " model\n", " scenario\n", " region\n", - " variable\n", + " unit\n", + " carrier\n", + " fuel\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", " \n", @@ -2082,89 +2252,423 @@ " \n", " \n", " \n", - " REMIND-MAgPIE 2.1-4.3\n", - " DeepElec_SSP2_HighRE_Budg900\n", - " World\n", + " REMIND-MAgPIE 2.1-4.3\n", + " DeepElec_SSP2_HighRE_Budg900\n", + " World\n", + " \n", + " Electricity\n", + " Biomass\n", + " 0.624410\n", + " 0.622179\n", + " 0.621779\n", + " 0.622625\n", + " 0.640563\n", + " 0.703139\n", + " 0.846429\n", + " 1.091001\n", + " 1.458054\n", + " 1.950832\n", + " 2.628978\n", + " 3.851051\n", + " 12.305194\n", + " 44.837349\n", + " 214.719844\n", + " 835.312733\n", + " \n", + " \n", + " Coal\n", + " 0.683221\n", + " 0.616954\n", + " 0.562079\n", + " 0.591347\n", + " 0.562819\n", + " 0.547376\n", + " 0.543278\n", + " 0.534583\n", + " 0.542898\n", + " 0.548193\n", + " 0.570406\n", + " 0.586816\n", + " 0.647522\n", + " 0.655854\n", + " 0.656748\n", + " 0.658644\n", + " \n", + " \n", + " Gas\n", + " 0.396947\n", + " 0.428965\n", + " 0.424722\n", + " 0.434726\n", + " 0.418885\n", + " 0.327710\n", + " 0.232976\n", + " 0.230218\n", + " 0.231365\n", + " 0.246935\n", + " 0.189458\n", + " 0.172202\n", + " 0.090228\n", + " 0.090036\n", + " 0.090358\n", + " 0.163281\n", + " \n", + " \n", " Geothermal\n", - " 0.849984\n", - " 0.850005\n", - " 0.849989\n", - " 0.849986\n", - " 0.850021\n", + " 0.849531\n", + " 0.849339\n", + " 0.849477\n", + " 0.849434\n", + " 0.849404\n", + " 0.849402\n", + " 0.849423\n", + " 0.849407\n", + " 0.849404\n", + " 0.849440\n", + " 0.849395\n", + " 0.849412\n", + " 0.849410\n", + " 0.849387\n", + " 0.849469\n", + " 0.849447\n", " \n", " \n", " Hydro\n", - " 0.394597\n", - " 0.394474\n", - " 0.396240\n", - " 0.398217\n", - " 0.399716\n", + " 0.421045\n", + " 0.421212\n", + " 0.403690\n", + " 0.403108\n", + " 0.397248\n", + " 0.394327\n", + " 0.394204\n", + " 0.395969\n", + " 0.397945\n", + " 0.399443\n", + " 0.400637\n", + " 0.402054\n", + " 0.404988\n", + " 0.408025\n", + " 0.409803\n", + " 0.412868\n", + " \n", + " \n", + " Nuclear\n", + " 0.799454\n", + " 0.745660\n", + " 0.736736\n", + " 0.731658\n", + " 0.756045\n", + " 0.776634\n", + " 0.786077\n", + " 0.799452\n", + " 0.799453\n", + " 0.799455\n", + " 0.799442\n", + " 0.799441\n", + " 0.799475\n", + " 0.799417\n", + " 0.800720\n", + " 0.833897\n", + " \n", + " \n", + " Oil\n", + " 0.242962\n", + " 0.250517\n", + " 0.256895\n", + " 0.249993\n", + " 0.254847\n", + " 0.247864\n", + " 0.249823\n", + " 0.249887\n", + " 0.249750\n", + " 0.249769\n", + " 0.250253\n", + " 0.264067\n", + " 0.264067\n", + " 0.264067\n", + " 0.261885\n", + " 0.251493\n", + " \n", + " \n", + " Other\n", + " NaN\n", + " NaN\n", + " 0.149296\n", + " 0.149237\n", + " 0.125370\n", + " 0.119997\n", + " 0.109662\n", + " 0.100468\n", + " 0.095265\n", + " 0.093251\n", + " 0.093126\n", + " 0.093108\n", + " 0.093314\n", + " 0.093045\n", + " 0.092409\n", + " 0.092235\n", " \n", " \n", " Solar\n", - " 0.161156\n", - " 0.154237\n", - " 0.151994\n", - " 0.150698\n", - " 0.149422\n", + " 0.173656\n", + " 0.191417\n", + " 0.135744\n", + " 0.162338\n", + " 0.165758\n", + " 0.161046\n", + " 0.154131\n", + " 0.151890\n", + " 0.150595\n", + " 0.149319\n", + " 0.147843\n", + " 0.146626\n", + " 0.143060\n", + " 0.140284\n", + " 0.138511\n", + " 0.136580\n", " \n", " \n", " Wind\n", - " 0.263820\n", - " 0.275781\n", - " 0.289083\n", - " 0.302018\n", - " 0.298163\n", + " 0.385930\n", + " 0.374443\n", + " 0.230212\n", + " 0.253129\n", + " 0.260839\n", + " 0.263639\n", + " 0.275592\n", + " 0.288885\n", + " 0.301811\n", + " 0.297959\n", + " 0.295101\n", + " 0.291983\n", + " 0.283467\n", + " 0.279135\n", + " 0.273659\n", + " 0.270820\n", " \n", " \n", "\n", "" ], "text/plain": [ - " 2030 \\\n", - "model scenario region variable \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Geothermal 0.849984 \n", - " Hydro 0.394597 \n", - " Solar 0.161156 \n", - " Wind 0.263820 \n", - "\n", - " 2035 \\\n", - "model scenario region variable \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Geothermal 0.850005 \n", - " Hydro 0.394474 \n", - " Solar 0.154237 \n", - " Wind 0.275781 \n", - "\n", - " 2040 \\\n", - "model scenario region variable \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Geothermal 0.849989 \n", - " Hydro 0.396240 \n", - " Solar 0.151994 \n", - " Wind 0.289083 \n", - "\n", - " 2045 \\\n", - "model scenario region variable \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Geothermal 0.849986 \n", - " Hydro 0.398217 \n", - " Solar 0.150698 \n", - " Wind 0.302018 \n", - "\n", - " 2050 \n", - "model scenario region variable \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Geothermal 0.850021 \n", - " Hydro 0.399716 \n", - " Solar 0.149422 \n", - " Wind 0.298163 " + " 2005 \\\n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Electricity Biomass 0.624410 \n", + " Coal 0.683221 \n", + " Gas 0.396947 \n", + " Geothermal 0.849531 \n", + " Hydro 0.421045 \n", + " Nuclear 0.799454 \n", + " Oil 0.242962 \n", + " Other NaN \n", + " Solar 0.173656 \n", + " Wind 0.385930 \n", + "\n", + " 2010 \\\n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Electricity Biomass 0.622179 \n", + " Coal 0.616954 \n", + " Gas 0.428965 \n", + " Geothermal 0.849339 \n", + " Hydro 0.421212 \n", + " Nuclear 0.745660 \n", + " Oil 0.250517 \n", + " Other NaN \n", + " Solar 0.191417 \n", + " Wind 0.374443 \n", + "\n", + " 2015 \\\n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Electricity Biomass 0.621779 \n", + " Coal 0.562079 \n", + " Gas 0.424722 \n", + " Geothermal 0.849477 \n", + " Hydro 0.403690 \n", + " Nuclear 0.736736 \n", + " Oil 0.256895 \n", + " Other 0.149296 \n", + " Solar 0.135744 \n", + " Wind 0.230212 \n", + "\n", + " 2020 \\\n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Electricity Biomass 0.622625 \n", + " Coal 0.591347 \n", + " Gas 0.434726 \n", + " Geothermal 0.849434 \n", + " Hydro 0.403108 \n", + " Nuclear 0.731658 \n", + " Oil 0.249993 \n", + " Other 0.149237 \n", + " Solar 0.162338 \n", + " Wind 0.253129 \n", + "\n", + " 2025 \\\n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Electricity Biomass 0.640563 \n", + " Coal 0.562819 \n", + " Gas 0.418885 \n", + " Geothermal 0.849404 \n", + " Hydro 0.397248 \n", + " Nuclear 0.756045 \n", + " Oil 0.254847 \n", + " Other 0.125370 \n", + " Solar 0.165758 \n", + " Wind 0.260839 \n", + "\n", + " 2030 \\\n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Electricity Biomass 0.703139 \n", + " Coal 0.547376 \n", + " Gas 0.327710 \n", + " Geothermal 0.849402 \n", + " Hydro 0.394327 \n", + " Nuclear 0.776634 \n", + " Oil 0.247864 \n", + " Other 0.119997 \n", + " Solar 0.161046 \n", + " Wind 0.263639 \n", + "\n", + " 2035 \\\n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Electricity Biomass 0.846429 \n", + " Coal 0.543278 \n", + " Gas 0.232976 \n", + " Geothermal 0.849423 \n", + " Hydro 0.394204 \n", + " Nuclear 0.786077 \n", + " Oil 0.249823 \n", + " Other 0.109662 \n", + " Solar 0.154131 \n", + " Wind 0.275592 \n", + "\n", + " 2040 \\\n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Electricity Biomass 1.091001 \n", + " Coal 0.534583 \n", + " Gas 0.230218 \n", + " Geothermal 0.849407 \n", + " Hydro 0.395969 \n", + " Nuclear 0.799452 \n", + " Oil 0.249887 \n", + " Other 0.100468 \n", + " Solar 0.151890 \n", + " Wind 0.288885 \n", + "\n", + " 2045 \\\n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Electricity Biomass 1.458054 \n", + " Coal 0.542898 \n", + " Gas 0.231365 \n", + " Geothermal 0.849404 \n", + " Hydro 0.397945 \n", + " Nuclear 0.799453 \n", + " Oil 0.249750 \n", + " Other 0.095265 \n", + " Solar 0.150595 \n", + " Wind 0.301811 \n", + "\n", + " 2050 \\\n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Electricity Biomass 1.950832 \n", + " Coal 0.548193 \n", + " Gas 0.246935 \n", + " Geothermal 0.849440 \n", + " Hydro 0.399443 \n", + " Nuclear 0.799455 \n", + " Oil 0.249769 \n", + " Other 0.093251 \n", + " Solar 0.149319 \n", + " Wind 0.297959 \n", + "\n", + " 2055 \\\n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Electricity Biomass 2.628978 \n", + " Coal 0.570406 \n", + " Gas 0.189458 \n", + " Geothermal 0.849395 \n", + " Hydro 0.400637 \n", + " Nuclear 0.799442 \n", + " Oil 0.250253 \n", + " Other 0.093126 \n", + " Solar 0.147843 \n", + " Wind 0.295101 \n", + "\n", + " 2060 \\\n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Electricity Biomass 3.851051 \n", + " Coal 0.586816 \n", + " Gas 0.172202 \n", + " Geothermal 0.849412 \n", + " Hydro 0.402054 \n", + " Nuclear 0.799441 \n", + " Oil 0.264067 \n", + " Other 0.093108 \n", + " Solar 0.146626 \n", + " Wind 0.291983 \n", + "\n", + " 2070 \\\n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Electricity Biomass 12.305194 \n", + " Coal 0.647522 \n", + " Gas 0.090228 \n", + " Geothermal 0.849410 \n", + " Hydro 0.404988 \n", + " Nuclear 0.799475 \n", + " Oil 0.264067 \n", + " Other 0.093314 \n", + " Solar 0.143060 \n", + " Wind 0.283467 \n", + "\n", + " 2080 \\\n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Electricity Biomass 44.837349 \n", + " Coal 0.655854 \n", + " Gas 0.090036 \n", + " Geothermal 0.849387 \n", + " Hydro 0.408025 \n", + " Nuclear 0.799417 \n", + " Oil 0.264067 \n", + " Other 0.093045 \n", + " Solar 0.140284 \n", + " Wind 0.279135 \n", + "\n", + " 2090 \\\n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Electricity Biomass 214.719844 \n", + " Coal 0.656748 \n", + " Gas 0.090358 \n", + " Geothermal 0.849469 \n", + " Hydro 0.409803 \n", + " Nuclear 0.800720 \n", + " Oil 0.261885 \n", + " Other 0.092409 \n", + " Solar 0.138511 \n", + " Wind 0.273659 \n", + "\n", + " 2100 \n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Electricity Biomass 835.312733 \n", + " Coal 0.658644 \n", + " Gas 0.163281 \n", + " Geothermal 0.849447 \n", + " Hydro 0.412868 \n", + " Nuclear 0.833897 \n", + " Oil 0.251493 \n", + " Other 0.092235 \n", + " Solar 0.136580 \n", + " Wind 0.270820 " ] }, - "execution_count": 10, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "capacity_factor = generation.droplevel(\"unit\") / 8760 / capacity.droplevel(\"unit\")\n", - "capacity_factor.loc[isin(variable=[\"Solar\", \"Wind\", \"Hydro\", \"Geothermal\"]), 2030:2051]" + "generation = extractlevel(df, variable=\"Secondary Energy|{carrier}|{fuel}\", drop=True)\n", + "capacity = extractlevel(df, variable=\"Capacity|{carrier}|{fuel}\", drop=True)\n", + "generation.pix.unitdiv(capacity)" ] }, { @@ -2178,23 +2682,23 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 12, "id": "4197be7d", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "And(a=Isin(filters={'variable': ['Coal', 'Gas', 'Nuclear'], 'unit': 'GW'}), b=Not(a=Ismatch(filters={'variable': 'S*'}, regex=False)))" + "And(a=Isin(filters={'fuel': ['Coal', 'Gas', 'Nuclear'], 'unit': 'GW'}), b=Not(a=Ismatch(filters={'fuel': 'S*'}, regex=False)))" ] }, - "execution_count": 11, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "query = isin(variable=[\"Coal\", \"Gas\", \"Nuclear\"], unit=\"GW\") & ~ismatch(variable=\"S*\")\n", + "query = isin(fuel=[\"Coal\", \"Gas\", \"Nuclear\"], unit=\"GW\") & ~ismatch(fuel=\"S*\")\n", "query" ] }, @@ -2209,28 +2713,28 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 13, "id": "18401aa0", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "model scenario region variable unit\n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Biomass GW False\n", - " Coal GW True\n", - " Gas GW True\n", - " Geothermal GW False\n", - " Hydro GW False\n", - " Nuclear GW True\n", - " Oil GW False\n", - " Other GW False\n", - " Solar GW False\n", - " Wind GW False\n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW Electricity Biomass False\n", + " Coal True\n", + " Gas True\n", + " Geothermal False\n", + " Hydro False\n", + " Nuclear True\n", + " Oil False\n", + " Other False\n", + " Solar False\n", + " Wind False\n", "dtype: bool" ] }, - "execution_count": 12, + "execution_count": 13, "metadata": {}, "output_type": "execute_result" } @@ -2259,7 +2763,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 14, "id": "8b421dba", "metadata": {}, "outputs": [ @@ -2288,6 +2792,7 @@ " \n", " \n", " \n", + " \n", " 2005\n", " 2010\n", " 2015\n", @@ -2301,8 +2806,9 @@ " model\n", " scenario\n", " region\n", - " variable\n", " unit\n", + " carrier\n", + " fuel\n", " \n", " \n", " \n", @@ -2318,8 +2824,9 @@ " REMIND-MAgPIE 2.1-4.3\n", " DeepElec_SSP2_HighRE_Budg900\n", " World\n", + " GW\n", + " Electricity\n", " Gas\n", - " GW\n", " 1096.6736\n", " 1343.1077\n", " 1603.1686\n", @@ -2331,7 +2838,6 @@ " \n", " \n", " Nuclear\n", - " GW\n", " 408.3700\n", " 404.3094\n", " 379.1375\n", @@ -2346,55 +2852,55 @@ "" ], "text/plain": [ - " 2005 \\\n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Gas GW 1096.6736 \n", - " Nuclear GW 408.3700 \n", - "\n", - " 2010 \\\n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Gas GW 1343.1077 \n", - " Nuclear GW 404.3094 \n", - "\n", - " 2015 \\\n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Gas GW 1603.1686 \n", - " Nuclear GW 379.1375 \n", - "\n", - " 2020 \\\n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Gas GW 1852.6485 \n", - " Nuclear GW 345.2239 \n", - "\n", - " 2025 \\\n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Gas GW 1761.8057 \n", - " Nuclear GW 310.1729 \n", - "\n", - " 2030 \\\n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Gas GW 1584.4033 \n", - " Nuclear GW 275.5920 \n", - "\n", - " 2035 \\\n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Gas GW 1423.5393 \n", - " Nuclear GW 234.7028 \n", - "\n", - " 2040 \n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Gas GW 1289.4777 \n", - " Nuclear GW 214.4376 " + " 2005 \\\n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW Electricity Gas 1096.6736 \n", + " Nuclear 408.3700 \n", + "\n", + " 2010 \\\n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW Electricity Gas 1343.1077 \n", + " Nuclear 404.3094 \n", + "\n", + " 2015 \\\n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW Electricity Gas 1603.1686 \n", + " Nuclear 379.1375 \n", + "\n", + " 2020 \\\n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW Electricity Gas 1852.6485 \n", + " Nuclear 345.2239 \n", + "\n", + " 2025 \\\n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW Electricity Gas 1761.8057 \n", + " Nuclear 310.1729 \n", + "\n", + " 2030 \\\n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW Electricity Gas 1584.4033 \n", + " Nuclear 275.5920 \n", + "\n", + " 2035 \\\n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW Electricity Gas 1423.5393 \n", + " Nuclear 234.7028 \n", + "\n", + " 2040 \n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW Electricity Gas 1289.4777 \n", + " Nuclear 214.4376 " ] }, - "execution_count": 13, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "high_capacity_fossil = capacity.loc[\n", - " isin(variable=[\"Coal\", \"Gas\", \"Nuclear\"], unit=\"GW\") & (capacity[2030] > 250),\n", + " isin(fuel=[\"Coal\", \"Gas\", \"Nuclear\"], unit=\"GW\") & (capacity[2030] > 250),\n", " :2041,\n", "]\n", "high_capacity_fossil" @@ -2411,7 +2917,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 15, "id": "71d7aa7d", "metadata": {}, "outputs": [ @@ -2440,6 +2946,7 @@ " \n", " \n", " \n", + " \n", " 2005\n", " 2010\n", " 2015\n", @@ -2453,8 +2960,9 @@ " model\n", " scenario\n", " region\n", - " variable\n", " unit\n", + " carrier\n", + " fuel\n", " \n", " \n", " \n", @@ -2470,8 +2978,9 @@ " REMIND-MAgPIE 2.1-4.3\n", " DeepElec_SSP2_HighRE_Budg900\n", " World\n", + " GW\n", + " Electricity\n", " Gas\n", - " GW\n", " 1096.6736\n", " 1343.1077\n", " 1603.1686\n", @@ -2483,7 +2992,6 @@ " \n", " \n", " Nuclear\n", - " GW\n", " 408.3700\n", " 404.3094\n", " 379.1375\n", @@ -2498,54 +3006,54 @@ "" ], "text/plain": [ - " 2005 \\\n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Gas GW 1096.6736 \n", - " Nuclear GW 408.3700 \n", - "\n", - " 2010 \\\n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Gas GW 1343.1077 \n", - " Nuclear GW 404.3094 \n", - "\n", - " 2015 \\\n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Gas GW 1603.1686 \n", - " Nuclear GW 379.1375 \n", - "\n", - " 2020 \\\n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Gas GW 1852.6485 \n", - " Nuclear GW 345.2239 \n", - "\n", - " 2025 \\\n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Gas GW 1761.8057 \n", - " Nuclear GW 310.1729 \n", - "\n", - " 2030 \\\n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Gas GW 1000.000 \n", - " Nuclear GW 275.592 \n", - "\n", - " 2035 \\\n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Gas GW 1000.0000 \n", - " Nuclear GW 234.7028 \n", - "\n", - " 2040 \n", - "model scenario region variable unit \n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Gas GW 1000.0000 \n", - " Nuclear GW 214.4376 " + " 2005 \\\n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW Electricity Gas 1096.6736 \n", + " Nuclear 408.3700 \n", + "\n", + " 2010 \\\n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW Electricity Gas 1343.1077 \n", + " Nuclear 404.3094 \n", + "\n", + " 2015 \\\n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW Electricity Gas 1603.1686 \n", + " Nuclear 379.1375 \n", + "\n", + " 2020 \\\n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW Electricity Gas 1852.6485 \n", + " Nuclear 345.2239 \n", + "\n", + " 2025 \\\n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW Electricity Gas 1761.8057 \n", + " Nuclear 310.1729 \n", + "\n", + " 2030 \\\n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW Electricity Gas 1000.000 \n", + " Nuclear 275.592 \n", + "\n", + " 2035 \\\n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW Electricity Gas 1000.0000 \n", + " Nuclear 234.7028 \n", + "\n", + " 2040 \n", + "model scenario region unit carrier fuel \n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW Electricity Gas 1000.0000 \n", + " Nuclear 214.4376 " ] }, - "execution_count": 14, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "high_capacity_fossil.loc[isin(variable=\"Gas\"), 2030:] = 1000.0\n", + "high_capacity_fossil.loc[isin(fuel=\"Gas\"), 2030:] = 1000.0\n", "high_capacity_fossil" ] }, @@ -2560,37 +3068,37 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 16, "id": "e0ff32d5", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "model scenario region variable unit year\n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Coal GW 2030 182.0149\n", - " 2040 1.0729\n", - " 2050 0.5029\n", - " 2060 0.1836\n", - " Gas GW 2030 1584.4033\n", - " 2040 1289.4777\n", - " 2050 562.8482\n", - " 2060 349.9091\n", - " Nuclear GW 2030 275.5920\n", - " 2040 214.4376\n", - " 2050 156.7766\n", - " 2060 92.0667\n", + "model scenario region unit carrier fuel year\n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW Electricity Coal 2030 182.0149\n", + " 2040 1.0729\n", + " 2050 0.5029\n", + " 2060 0.1836\n", + " Gas 2030 1584.4033\n", + " 2040 1289.4777\n", + " 2050 562.8482\n", + " 2060 349.9091\n", + " Nuclear 2030 275.5920\n", + " 2040 214.4376\n", + " 2050 156.7766\n", + " 2060 92.0667\n", "dtype: float64" ] }, - "execution_count": 15, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "fossil_series = (\n", - " capacity.loc[isin(variable=[\"Coal\", \"Gas\", \"Nuclear\"]), [2030, 2040, 2050, 2060]]\n", + " capacity.loc[isin(fuel=[\"Coal\", \"Gas\", \"Nuclear\"]), [2030, 2040, 2050, 2060]]\n", " .rename_axis(columns=\"year\")\n", " .stack()\n", ")\n", @@ -2599,24 +3107,24 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 17, "id": "6d4686e6", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "model scenario region variable unit year\n", - "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World Coal GW 2030 182.0149\n", - " 2050 0.5029\n", - " Gas GW 2030 1584.4033\n", - " 2050 562.8482\n", - " Nuclear GW 2030 275.5920\n", - " 2050 156.7766\n", + "model scenario region unit carrier fuel year\n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW Electricity Coal 2030 182.0149\n", + " 2050 0.5029\n", + " Gas 2030 1584.4033\n", + " 2050 562.8482\n", + " Nuclear 2030 275.5920\n", + " 2050 156.7766\n", "dtype: float64" ] }, - "execution_count": 16, + "execution_count": 17, "metadata": {}, "output_type": "execute_result" } @@ -2627,7 +3135,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 18, "id": "8d4e91fb", "metadata": {}, "outputs": [ @@ -2638,13 +3146,13 @@ " True, True, True])" ] }, - "execution_count": 17, + "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "isin(fossil_series.index, variable=\"Nuclear\")" + "isin(fossil_series.index, fuel=\"Nuclear\")" ] }, { @@ -2660,7 +3168,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 19, "id": "cde4ff9f", "metadata": {}, "outputs": [ @@ -2671,10 +3179,10 @@ " ( 'Gas', 2035),\n", " ('Nuclear', 2040),\n", " ('Nuclear', 2050)],\n", - " names=['variable', 'year'])" + " names=['fuel', 'year'])" ] }, - "execution_count": 18, + "execution_count": 19, "metadata": {}, "output_type": "execute_result" } @@ -2682,29 +3190,29 @@ "source": [ "idx = pd.MultiIndex.from_tuples(\n", " [(\"Coal\", 2030), (\"Gas\", 2035), (\"Nuclear\", 2040), (\"Nuclear\", 2050)],\n", - " names=[\"variable\", \"year\"],\n", + " names=[\"fuel\", \"year\"],\n", ")\n", "idx" ] }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 20, "id": "dc294f2f", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "variable year model scenario region unit\n", - "Coal 2030 REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW 182.0149\n", - "Gas 2035 NaN NaN NaN NaN NaN\n", - "Nuclear 2040 REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW 214.4376\n", - " 2050 REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW 156.7766\n", + "fuel year model scenario region unit carrier \n", + "Coal 2030 REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW Electricity 182.0149\n", + "Gas 2035 NaN NaN NaN NaN NaN NaN\n", + "Nuclear 2040 REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW Electricity 214.4376\n", + " 2050 REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW Electricity 156.7766\n", "dtype: float64" ] }, - "execution_count": 19, + "execution_count": 20, "metadata": {}, "output_type": "execute_result" } @@ -2729,21 +3237,21 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 21, "id": "f82d6bf4", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "variable year model scenario region unit\n", - "Coal 2030 REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW 182.0149\n", - "Nuclear 2040 REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW 214.4376\n", - " 2050 REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW 156.7766\n", + "fuel year model scenario region unit carrier \n", + "Coal 2030 REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW Electricity 182.0149\n", + "Nuclear 2040 REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW Electricity 214.4376\n", + " 2050 REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW Electricity 156.7766\n", "dtype: float64" ] }, - "execution_count": 20, + "execution_count": 21, "metadata": {}, "output_type": "execute_result" } @@ -2752,6 +3260,49 @@ "semijoin(fossil_series, idx, how=\"inner\")" ] }, + { + "cell_type": "markdown", + "id": "4c420dc1", + "metadata": {}, + "source": [ + "It is also possible to get the inverted result, with only the not matching rows, with an `antijoin`" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "id": "bed99ac9", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "model scenario region unit carrier fuel year\n", + "REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 World GW Electricity Coal 2040 1.0729\n", + " 2050 0.5029\n", + " 2060 0.1836\n", + " Gas 2030 1584.4033\n", + " 2040 1289.4777\n", + " 2050 562.8482\n", + " 2060 349.9091\n", + " Nuclear 2030 275.5920\n", + " 2060 92.0667\n", + "dtype: float64" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "from pandas_indexing import antijoin\n", + "\n", + "\n", + "antijoin(fossil_series, idx)\n", + "# or: fossil_series.pix.antijoin(idx)" + ] + }, { "attachments": {}, "cell_type": "markdown", @@ -2765,30 +3316,30 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 23, "id": "6d0000aa", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "variable year\n", - "Coal 2030 182.0149\n", - " 2040 1.0729\n", - " 2050 0.5029\n", - " 2060 0.1836\n", - "Gas 2030 1584.4033\n", - " 2040 1289.4777\n", - " 2050 562.8482\n", - " 2060 349.9091\n", - "Nuclear 2030 275.5920\n", - " 2040 214.4376\n", - " 2050 156.7766\n", - " 2060 92.0667\n", + "fuel year\n", + "Coal 2030 182.0149\n", + " 2040 1.0729\n", + " 2050 0.5029\n", + " 2060 0.1836\n", + "Gas 2030 1584.4033\n", + " 2040 1289.4777\n", + " 2050 562.8482\n", + " 2060 349.9091\n", + "Nuclear 2030 275.5920\n", + " 2040 214.4376\n", + " 2050 156.7766\n", + " 2060 92.0667\n", "dtype: float64" ] }, - "execution_count": 21, + "execution_count": 23, "metadata": {}, "output_type": "execute_result" } @@ -2797,8 +3348,8 @@ "from pandas_indexing import projectlevel\n", "\n", "\n", - "simple_fossil_series = projectlevel(fossil_series, [\"variable\", \"year\"])\n", - "# or: fossil_series.pix.project([\"variable\", \"year\"])\n", + "simple_fossil_series = projectlevel(fossil_series, [\"fuel\", \"year\"])\n", + "# or: fossil_series.pix.project([\"fuel\", \"year\"])\n", "simple_fossil_series" ] }, @@ -2813,7 +3364,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 24, "id": "308fb920", "metadata": {}, "outputs": [ @@ -2836,14 +3387,14 @@ "dtype: bool" ] }, - "execution_count": 22, + "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "projectlevel(fossil_series, [\"model\", \"scenario\"]) == fossil_series.droplevel(\n", - " [\"variable\", \"unit\", \"region\", \"year\"]\n", + " [\"carrier\", \"fuel\", \"unit\", \"region\", \"year\"]\n", ")" ] }, @@ -2860,7 +3411,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 25, "id": "ca2a3c70", "metadata": {}, "outputs": [ @@ -3708,7 +4259,7 @@ " Updated|Secondary Energy|Electricity|Wind bla 4.123369e+07 " ] }, - "execution_count": 23, + "execution_count": 25, "metadata": {}, "output_type": "execute_result" } @@ -3732,7 +4283,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 26, "id": "f4cb55c2", "metadata": {}, "outputs": [ @@ -4580,7 +5131,7 @@ " Updated|Secondary Energy|Electricity|Wind bla 4.123369e+07 " ] }, - "execution_count": 24, + "execution_count": 26, "metadata": {}, "output_type": "execute_result" } @@ -4604,7 +5155,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 27, "id": "72d60d5e", "metadata": {}, "outputs": [ @@ -5433,7 +5984,7 @@ " GWh/yr 4.123369e+07 " ] }, - "execution_count": 25, + "execution_count": 27, "metadata": {}, "output_type": "execute_result" } @@ -5455,7 +6006,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 28, "id": "029603e9", "metadata": {}, "outputs": [ @@ -5490,7 +6041,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 29, "id": "f9fe7174", "metadata": {}, "outputs": [ @@ -5514,7 +6065,7 @@ " dtype='object', name='variable')" ] }, - "execution_count": 27, + "execution_count": 29, "metadata": {}, "output_type": "execute_result" } @@ -5530,7 +6081,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 30, "id": "23378320", "metadata": {}, "outputs": [ @@ -5560,7 +6111,7 @@ " names=['variable', 'unit'])" ] }, - "execution_count": 28, + "execution_count": 30, "metadata": {}, "output_type": "execute_result" } @@ -5589,7 +6140,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 31, "id": "24d42af8-ffd3-4281-9d75-1449046fd6fd", "metadata": {}, "outputs": [ @@ -5623,7 +6174,7 @@ "dtype: float64" ] }, - "execution_count": 29, + "execution_count": 31, "metadata": {}, "output_type": "execute_result" } @@ -5634,42 +6185,42 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 32, "id": "254197c5-8498-4c69-a30d-044e7edb7b53", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "variable year\n", - "Coal 2030 182.0149\n", - " 2040 1.0729\n", - " 2050 0.5029\n", - " 2060 0.1836\n", - "Gas 2030 1584.4033\n", - " 2040 1289.4777\n", - " 2050 562.8482\n", - " 2060 349.9091\n", - "Nuclear 2030 275.5920\n", - " 2040 214.4376\n", - " 2050 156.7766\n", - " 2060 92.0667\n", - "Coal 2030 182.0149\n", - " 2040 1.0729\n", - " 2050 0.5029\n", - " 2060 0.1836\n", - "Gas 2030 1584.4033\n", - " 2040 1289.4777\n", - " 2050 562.8482\n", - " 2060 349.9091\n", - "Nuclear 2030 275.5920\n", - " 2040 214.4376\n", - " 2050 156.7766\n", - " 2060 92.0667\n", + "fuel year\n", + "Coal 2030 182.0149\n", + " 2040 1.0729\n", + " 2050 0.5029\n", + " 2060 0.1836\n", + "Gas 2030 1584.4033\n", + " 2040 1289.4777\n", + " 2050 562.8482\n", + " 2060 349.9091\n", + "Nuclear 2030 275.5920\n", + " 2040 214.4376\n", + " 2050 156.7766\n", + " 2060 92.0667\n", + "Coal 2030 182.0149\n", + " 2040 1.0729\n", + " 2050 0.5029\n", + " 2060 0.1836\n", + "Gas 2030 1584.4033\n", + " 2040 1289.4777\n", + " 2050 562.8482\n", + " 2060 349.9091\n", + "Nuclear 2030 275.5920\n", + " 2040 214.4376\n", + " 2050 156.7766\n", + " 2060 92.0667\n", "dtype: float64" ] }, - "execution_count": 30, + "execution_count": 32, "metadata": {}, "output_type": "execute_result" } @@ -5696,42 +6247,42 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 33, "id": "ef1d54c6", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "variable year\n", - "Coal 2030 182.0149\n", - " 2040 1.0729\n", - " 2050 0.5029\n", - " 2060 0.1836\n", - "Gas 2030 1584.4033\n", - " 2040 1289.4777\n", - " 2050 562.8482\n", - " 2060 349.9091\n", - "Nuclear 2030 275.5920\n", - " 2040 214.4376\n", - " 2050 156.7766\n", - " 2060 92.0667\n", - "Coal 2030 182.0149\n", - " 2040 1.0729\n", - " 2050 0.5029\n", - " 2060 0.1836\n", - "Gas 2030 1584.4033\n", - " 2040 1289.4777\n", - " 2050 562.8482\n", - " 2060 349.9091\n", - "Nuclear 2030 275.5920\n", - " 2040 214.4376\n", - " 2050 156.7766\n", - " 2060 92.0667\n", + "fuel year\n", + "Coal 2030 182.0149\n", + " 2040 1.0729\n", + " 2050 0.5029\n", + " 2060 0.1836\n", + "Gas 2030 1584.4033\n", + " 2040 1289.4777\n", + " 2050 562.8482\n", + " 2060 349.9091\n", + "Nuclear 2030 275.5920\n", + " 2040 214.4376\n", + " 2050 156.7766\n", + " 2060 92.0667\n", + "Coal 2030 182.0149\n", + " 2040 1.0729\n", + " 2050 0.5029\n", + " 2060 0.1836\n", + "Gas 2030 1584.4033\n", + " 2040 1289.4777\n", + " 2050 562.8482\n", + " 2060 349.9091\n", + "Nuclear 2030 275.5920\n", + " 2040 214.4376\n", + " 2050 156.7766\n", + " 2060 92.0667\n", "dtype: float64" ] }, - "execution_count": 31, + "execution_count": 33, "metadata": {}, "output_type": "execute_result" } @@ -5763,7 +6314,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 34, "id": "5b7cb7db", "metadata": {}, "outputs": [ @@ -5782,21 +6333,21 @@ " ('REMIND-MAgPIE 2.1-4.3', 'DeepElec_SSP2_HighRE_Budg900', ...),\n", " ('REMIND-MAgPIE 2.1-4.3', 'DeepElec_SSP2_HighRE_Budg900', ...),\n", " ('REMIND-MAgPIE 2.1-4.3', 'DeepElec_SSP2_HighRE_Budg900', ...)],\n", - " names=['model', 'scenario', 'variable'])" + " names=['model', 'scenario', 'fuel'])" ] }, - "execution_count": 32, + "execution_count": 34, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "projectlevel(fossil_series.index, [\"model\", \"scenario\", \"variable\"])" + "projectlevel(fossil_series.index, [\"model\", \"scenario\", \"fuel\"])" ] }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 35, "id": "5b7cb7db", "metadata": {}, "outputs": [ @@ -5823,7 +6374,7 @@ " \n", " model\n", " scenario\n", - " variable\n", + " fuel\n", " \n", " \n", " \n", @@ -5904,7 +6455,7 @@ "" ], "text/plain": [ - " model scenario variable\n", + " model scenario fuel\n", "0 REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 Coal\n", "1 REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 Coal\n", "2 REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 Coal\n", @@ -5919,15 +6470,13 @@ "11 REMIND-MAgPIE 2.1-4.3 DeepElec_SSP2_HighRE_Budg900 Nuclear" ] }, - "execution_count": 33, + "execution_count": 35, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "projectlevel(fossil_series.index, [\"model\", \"scenario\", \"variable\"]).to_frame(\n", - " index=False\n", - ")" + "projectlevel(fossil_series.index, [\"model\", \"scenario\", \"fuel\"]).to_frame(index=False)" ] } ],