diff --git a/tutorial/westeros/_static/historical_new_capacity_and_total_installed_capacity.png b/tutorial/westeros/_static/historical_new_capacity_and_total_installed_capacity.png index 19c0f0911..07f9561bb 100644 Binary files a/tutorial/westeros/_static/historical_new_capacity_and_total_installed_capacity.png and b/tutorial/westeros/_static/historical_new_capacity_and_total_installed_capacity.png differ diff --git a/tutorial/westeros/_static/historical_new_capacity_and_total_installed_capacity.pptx b/tutorial/westeros/_static/historical_new_capacity_and_total_installed_capacity.pptx index b9a81d8ec..a7dc69b1a 100644 Binary files a/tutorial/westeros/_static/historical_new_capacity_and_total_installed_capacity.pptx and b/tutorial/westeros/_static/historical_new_capacity_and_total_installed_capacity.pptx differ diff --git a/tutorial/westeros/westeros_firm_capacity.ipynb b/tutorial/westeros/westeros_firm_capacity.ipynb index b35f974dd..0ba839599 100644 --- a/tutorial/westeros/westeros_firm_capacity.ipynb +++ b/tutorial/westeros/westeros_firm_capacity.ipynb @@ -70,8 +70,6 @@ "metadata": {}, "outputs": [], "source": [ - "year_df = scen.vintage_and_active_years()\n", - "vintage_years, act_years = year_df[\"year_vtg\"], year_df[\"year_act\"]\n", "model_horizon = scen.set(\"year\")\n", "country = \"Westeros\"" ] @@ -387,7 +385,7 @@ ], "metadata": { "kernelspec": { - "display_name": "message_ix", + "display_name": "mix312", "language": "python", "name": "python3" }, @@ -402,11 +400,6 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.3" - }, - "vscode": { - "interpreter": { - "hash": "29605b568787f5559ca1ba05da75d155c3dcfa15a1a63b1885b057c5465ade2e" - } } }, "nbformat": 4, diff --git a/tutorial/westeros/westeros_fossil_resource.ipynb b/tutorial/westeros/westeros_fossil_resource.ipynb index a4d1a1997..f24484693 100644 --- a/tutorial/westeros/westeros_fossil_resource.ipynb +++ b/tutorial/westeros/westeros_fossil_resource.ipynb @@ -128,11 +128,12 @@ "metadata": {}, "outputs": [], "source": [ + "country = \"Westeros\"\n", + "\n", "# Retrieving model period information\n", - "year_df = scen.vintage_and_active_years()\n", + "year_df = scen.vintage_and_active_years((country, \"coal_ppl\"), in_horizon=False)\n", "vintage_years, act_years = year_df[\"year_vtg\"], year_df[\"year_act\"]\n", - "model_horizon = scen.set(\"year\")\n", - "country = \"Westeros\"" + "model_horizon = scen.set(\"year\")" ] }, { @@ -491,7 +492,7 @@ ], "metadata": { "kernelspec": { - "display_name": "message_ix", + "display_name": "mix312", "language": "python", "name": "python3" }, @@ -506,11 +507,6 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.3" - }, - "vscode": { - "interpreter": { - "hash": "29605b568787f5559ca1ba05da75d155c3dcfa15a1a63b1885b057c5465ade2e" - } } }, "nbformat": 4, diff --git a/tutorial/westeros/westeros_historical_new_capacity.ipynb b/tutorial/westeros/westeros_historical_new_capacity.ipynb index 7903b08f3..665cd8b5c 100644 --- a/tutorial/westeros/westeros_historical_new_capacity.ipynb +++ b/tutorial/westeros/westeros_historical_new_capacity.ipynb @@ -225,7 +225,7 @@ "outputs": [], "source": [ "df = scenario.par(\"demand\")\n", - "df[\"value\"] = float(df[df[\"year\"] == 700][\"value\"])\n", + "df[\"value\"] = float(df.loc[df[\"year\"] == 700, \"value\"].iloc[0])\n", "scenario.add_par(\"demand\", df)\n", "df" ] @@ -279,7 +279,7 @@ "# We will hence start by retrieving the demand in the `firstmodelyear`,\n", "# and assume this also applies for historic time-periods.\n", "demand_of_firstmodelyear = float(\n", - " scenario.par(\"demand\", filters={\"year\": scenario.firstmodelyear})[\"value\"]\n", + " scenario.par(\"demand\", filters={\"year\": scenario.firstmodelyear})[\"value\"].iloc[0]\n", ")\n", "print(f\"The demand of the `firstmodelyear` is {demand_of_firstmodelyear} GWa.\")" ] @@ -292,15 +292,15 @@ "source": [ "# We know that there are losses that occur when electricity is transmitted via the\n", "# `grid`.\n", - "grid_eff = float(\n", + "grid_eff = 1 / float(\n", " scenario.par(\n", - " \"output\",\n", + " \"input\",\n", " filters={\n", " \"year_vtg\": scenario.firstmodelyear,\n", " \"year_act\": scenario.firstmodelyear,\n", " \"technology\": \"grid\",\n", " },\n", - " )[\"value\"]\n", + " )[\"value\"].iloc[0]\n", ")\n", "print(f\"Grid efficiency is {grid_eff}.\")\n", "demand_of_firstmodelyear /= grid_eff" @@ -313,7 +313,7 @@ "outputs": [], "source": [ "duration_period = float(\n", - " scenario.par(\"duration_period\", filters={\"year\": history})[\"value\"]\n", + " scenario.par(\"duration_period\", filters={\"year\": history})[\"value\"].iloc[0]\n", ")\n", "print(f\"The duration of the period is {duration_period} years.\")\n", "historical_new_capacity = demand_of_firstmodelyear / duration_period" @@ -323,7 +323,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Each year within the historical 10 year period, a 11.11 GW `\"coal_ppl\"` must be added to meet the demand of the `firstmodelyear`. Therefore, the value of `\"historical_new_capacity\"` is calculated to `\"historical_new_capacity\" = demand_of_firstmodelyear / \"duration_period\"`." + "Each year within the historical 10 year period, a 6.11 GW `\"coal_ppl\"` must be added to meet the demand of the `firstmodelyear`. Therefore, the value of `\"historical_new_capacity\"` is calculated to `\"historical_new_capacity\" = demand_of_firstmodelyear / \"duration_period\"`." ] }, { @@ -344,7 +344,7 @@ ")\n", "print(\n", " \"The `'historical_new_capacity'` for `coal_ppl` is set to \"\n", - " f\"{round(historical_new_capacity, 2)}\"\n", + " f\"{round(historical_new_capacity, 2)} {df[\"unit\"].values}.\"\n", ")\n", "scenario.add_par(\"historical_new_capacity\", df)" ] @@ -844,12 +844,16 @@ "\n", "# Retrieve `\"historical_new_capacity\"`\n", "value = float(\n", - " scenario2.par(\"historical_new_capacity\", filters={\"technology\": \"coal_ppl\"}).value\n", + " scenario2.par(\n", + " \"historical_new_capacity\", filters={\"technology\": \"coal_ppl\"}\n", + " ).value.iloc[0]\n", ")\n", "\n", "# Retrieve `\"duration_period\"` for the year 700\n", "duration_period = float(\n", - " scenario.par(\"duration_period\", filters={\"year\": scenario.firstmodelyear})[\"value\"]\n", + " scenario.par(\"duration_period\", filters={\"year\": scenario.firstmodelyear})[\n", + " \"value\"\n", + " ].iloc[0]\n", ")\n", "\n", "value *= duration_period\n", @@ -976,12 +980,16 @@ "source": [ "# Retrieve `historical_new_capacity`\n", "value = float(\n", - " scenario2.par(\"historical_new_capacity\", filters={\"technology\": \"coal_ppl\"}).value\n", + " scenario2.par(\n", + " \"historical_new_capacity\", filters={\"technology\": \"coal_ppl\"}\n", + " ).value.iloc[0]\n", ")\n", "\n", "# Retrieve `duration_period` for the year 700\n", "duration_period = float(\n", - " scenario.par(\"duration_period\", filters={\"year\": scenario.firstmodelyear})[\"value\"]\n", + " scenario.par(\"duration_period\", filters={\"year\": scenario.firstmodelyear})[\n", + " \"value\"\n", + " ].iloc[0]\n", ")\n", "\n", "value *= duration_period\n", @@ -1106,7 +1114,7 @@ "metadata": { "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "mix312", "language": "python", "name": "python3" }, diff --git a/tutorial/westeros/westeros_renewable_resource.ipynb b/tutorial/westeros/westeros_renewable_resource.ipynb index 2fecc7d07..dcd7007bb 100644 --- a/tutorial/westeros/westeros_renewable_resource.ipynb +++ b/tutorial/westeros/westeros_renewable_resource.ipynb @@ -76,10 +76,10 @@ "metadata": {}, "outputs": [], "source": [ - "year_df = scen.vintage_and_active_years()\n", + "country = \"Westeros\"\n", + "year_df = scen.vintage_and_active_years((country, \"wind_ppl\"), in_horizon=False)\n", "vintage_years, act_years = year_df[\"year_vtg\"], year_df[\"year_act\"]\n", - "model_horizon = scen.set(\"year\")\n", - "country = \"Westeros\"" + "model_horizon = scen.set(\"year\")" ] }, { @@ -517,7 +517,7 @@ ], "metadata": { "kernelspec": { - "display_name": "message_ix", + "display_name": "mix312", "language": "python", "name": "python3" }, @@ -532,11 +532,6 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.3" - }, - "vscode": { - "interpreter": { - "hash": "29605b568787f5559ca1ba05da75d155c3dcfa15a1a63b1885b057c5465ade2e" - } } }, "nbformat": 4, diff --git a/tutorial/westeros/westeros_share_constraint.ipynb b/tutorial/westeros/westeros_share_constraint.ipynb index 9c3a4b3ab..85af975e6 100644 --- a/tutorial/westeros/westeros_share_constraint.ipynb +++ b/tutorial/westeros/westeros_share_constraint.ipynb @@ -81,9 +81,6 @@ "metadata": {}, "outputs": [], "source": [ - "year_df = scen.vintage_and_active_years()\n", - "vintage_years, act_years = year_df[\"year_vtg\"], year_df[\"year_act\"]\n", - "model_horizon = scen.set(\"year\")\n", "country = \"Westeros\"" ] }, @@ -472,7 +469,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "mix312", "language": "python", "name": "python3" },