Skip to content

Commit 79d1293

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 33621d7 commit 79d1293

File tree

1 file changed

+17
-24
lines changed

1 file changed

+17
-24
lines changed

data-science-for-esm/14-workshop-linopy.ipynb

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@
559559
"metadata": {},
560560
"outputs": [],
561561
"source": [
562-
"obj = (x + 2 * y).sum()\n"
562+
"obj = (x + 2 * y).sum()"
563563
]
564564
},
565565
{
@@ -701,9 +701,7 @@
701701
"metadata": {},
702702
"outputs": [],
703703
"source": [
704-
"marginal_costs = pd.Series(\n",
705-
" [0, 30, 60, 80], index=[\"Wind\", \"Coal\", \"Gas\", \"Oil\"]\n",
706-
")\n",
704+
"marginal_costs = pd.Series([0, 30, 60, 80], index=[\"Wind\", \"Coal\", \"Gas\", \"Oil\"])\n",
707705
"marginal_costs"
708706
]
709707
},
@@ -722,9 +720,7 @@
722720
"metadata": {},
723721
"outputs": [],
724722
"source": [
725-
"capacities = pd.Series(\n",
726-
" [3000, 35000, 8000, 2000], index=[\"Wind\", \"Coal\", \"Gas\", \"Oil\"]\n",
727-
")\n",
723+
"capacities = pd.Series([3000, 35000, 8000, 2000], index=[\"Wind\", \"Coal\", \"Gas\", \"Oil\"])\n",
728724
"capacities"
729725
]
730726
},
@@ -781,9 +777,7 @@
781777
"metadata": {},
782778
"outputs": [],
783779
"source": [
784-
"g = m.add_variables(\n",
785-
" lower=0, upper=capacities, coords=[capacities.index], name=\"g\"\n",
786-
")\n",
780+
"g = m.add_variables(lower=0, upper=capacities, coords=[capacities.index], name=\"g\")\n",
787781
"g"
788782
]
789783
},
@@ -1247,7 +1241,7 @@
12471241
"metadata": {},
12481242
"outputs": [],
12491243
"source": [
1250-
"time_index = pd.Index([0,1,2,3], name=\"time\")\n",
1244+
"time_index = pd.Index([0, 1, 2, 3], name=\"time\")\n",
12511245
"time_index"
12521246
]
12531247
},
@@ -1260,11 +1254,11 @@
12601254
"source": [
12611255
"capacity_factors = pd.DataFrame(\n",
12621256
" {\n",
1263-
" \"Coal\": 4*[1],\n",
1257+
" \"Coal\": 4 * [1],\n",
12641258
" \"Wind\": [0.3, 0.6, 0.4, 0.5],\n",
1265-
" \"Gas\": 4*[1],\n",
1266-
" \"Oil\": 4*[1],\n",
1267-
" \"Hydro\": 4*[1],\n",
1259+
" \"Gas\": 4 * [1],\n",
1260+
" \"Oil\": 4 * [1],\n",
1261+
" \"Hydro\": 4 * [1],\n",
12681262
" },\n",
12691263
" index=time_index,\n",
12701264
" columns=generators,\n",
@@ -1281,9 +1275,7 @@
12811275
"metadata": {},
12821276
"outputs": [],
12831277
"source": [
1284-
"load = pd.Series(\n",
1285-
" [42000, 43000, 45000, 46000], index=time_index\n",
1286-
")\n",
1278+
"load = pd.Series([42000, 43000, 45000, 46000], index=time_index)\n",
12871279
"load.index.name = \"time\""
12881280
]
12891281
},
@@ -1324,9 +1316,7 @@
13241316
"metadata": {},
13251317
"outputs": [],
13261318
"source": [
1327-
"g = m.add_variables(\n",
1328-
" lower=0, upper=capacities * capacity_factors, name=\"g\"\n",
1329-
")\n",
1319+
"g = m.add_variables(lower=0, upper=capacities * capacity_factors, name=\"g\")\n",
13301320
"g"
13311321
]
13321322
},
@@ -1536,7 +1526,10 @@
15361526
"outputs": [],
15371527
"source": [
15381528
"m.add_constraints(\n",
1539-
" battery_soc.loc[1:] == (1 - standing_loss) * battery_soc.shift(time=1).loc[1:] + efficiency * battery_charge.loc[1:] - 1 / efficiency * battery_discharge.loc[1:],\n",
1529+
" battery_soc.loc[1:]\n",
1530+
" == (1 - standing_loss) * battery_soc.shift(time=1).loc[1:]\n",
1531+
" + efficiency * battery_charge.loc[1:]\n",
1532+
" - 1 / efficiency * battery_discharge.loc[1:],\n",
15401533
" name=\"soc_consistency\",\n",
15411534
")"
15421535
]
@@ -1685,9 +1678,9 @@
16851678
],
16861679
"metadata": {
16871680
"kernelspec": {
1688-
"display_name": "esm-2024",
1681+
"display_name": "",
16891682
"language": "python",
1690-
"name": "python3"
1683+
"name": ""
16911684
},
16921685
"language_info": {
16931686
"codemirror_mode": {

0 commit comments

Comments
 (0)