From f617e06422f7a4d8e2514ad8e9c18187fa638bbf Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 10 May 2022 07:32:25 +0200 Subject: [PATCH] Add link to PR on Github in the tutorial --- tutorial/westeros/westeros_investment.ipynb | 199 ++++++++++++++++++-- 1 file changed, 181 insertions(+), 18 deletions(-) diff --git a/tutorial/westeros/westeros_investment.ipynb b/tutorial/westeros/westeros_investment.ipynb index 8803403de..d8c87a8cb 100644 --- a/tutorial/westeros/westeros_investment.ipynb +++ b/tutorial/westeros/westeros_investment.ipynb @@ -15,9 +15,32 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "C:\\Users\\zakeri\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\numpy\\_distributor_init.py:32: UserWarning: loaded more than 1 DLL from .libs:\n", + "C:\\Users\\zakeri\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\numpy\\.libs\\libopenblas.NOIJJG62EMASZI6NYURL6JBKM4EVBGM7.gfortran-win_amd64.dll\n", + "C:\\Users\\zakeri\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\numpy\\.libs\\libopenblas.XWYDX2IKJW2NMTWSFYNGFUWKQU3LYTCZ.gfortran-win_amd64.dll\n", + " stacklevel=1)\n" + ] + }, + { + "data": { + "application/javascript": [ + "IPython.OutputArea.prototype._should_scroll = function(lines) { return false; }" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "import pandas as pd\n", "import ixmp\n", @@ -30,7 +53,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -54,7 +77,7 @@ " INVEST(node, year) =E= SUM(tec$( map_tec(node,tec,year) ), ( inv_cost(node,tec,year) * construction_time_factor(node,tec,year) * end_of_horizon_factor(node,tec,year) * CAP_NEW(node,tec,year) )$( inv_tec(tec) )\n", ");`\n", "\n", - "If you are not sure, you can check these changes here:\n", + "If you are not sure, you can check these changes here: https://github.com/iiasa/message_ix/pull/602\n", "\n", "At this stage, you do not need to update the model documentation as it is done in the link above. But this is a good modeling practice for documenting the new sets, parameters, variables, and equations in the GAMS files using inline Latex notes." ] @@ -69,9 +92,17 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "This Scenario has a solution, use `Scenario.remove_solution()` or `Scenario.clone(..., keep_solution=False)`\n" + ] + } + ], "source": [ "# Loading the baseline scenario and cloning to a new scenario\n", "model = \"Westeros Electrified\"\n", @@ -81,7 +112,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -99,7 +130,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": {}, "outputs": [], "source": [ @@ -109,7 +140,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ @@ -142,9 +173,52 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
nodeyearlvlmrg
\n", + "
" + ], + "text/plain": [ + "Empty DataFrame\n", + "Columns: [node, year, lvl, mrg]\n", + "Index: []" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Reading the content variable \"INVEST\"\n", "scen.var(\"INVEST\")" @@ -178,7 +252,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ @@ -196,9 +270,98 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 9, + "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", + "
nodeyearlvlmrg
0World7000.0000007.721735
1World7100.0000004.740475
2World7200.0000002.910241
3Westeros7002380.5806830.000000
4Westeros7103432.0700150.000000
5Westeros7202195.6006460.000000
\n", + "
" + ], + "text/plain": [ + " node year lvl mrg\n", + "0 World 700 0.000000 7.721735\n", + "1 World 710 0.000000 4.740475\n", + "2 World 720 0.000000 2.910241\n", + "3 Westeros 700 2380.580683 0.000000\n", + "4 Westeros 710 3432.070015 0.000000\n", + "5 Westeros 720 2195.600646 0.000000" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "scen.var(\"INVEST\")" ]