Skip to content

Commit e2dbf5c

Browse files
committed
Ruff format all files
1 parent 8e7bee1 commit e2dbf5c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2513
-2398
lines changed

conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
def add_np(doctest_namespace):
1010
doctest_namespace["np"] = numpy
1111

12+
1213
@pytest.fixture(autouse=True)
1314
def add_pd(doctest_namespace):
1415
doctest_namespace["pd"] = pandas
1516

1617

1718
@pytest.fixture(autouse=True)
1819
def add_mikeio(doctest_namespace):
19-
doctest_namespace["mikeio"] = mikeio
20+
doctest_namespace["mikeio"] = mikeio

notebooks/DataArray - Arithmetic.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
}
132132
],
133133
"source": [
134-
"da_diff = da1-da2\n",
134+
"da_diff = da1 - da2\n",
135135
"da_diff.plot(title=\"Difference\");"
136136
]
137137
},
@@ -154,7 +154,7 @@
154154
}
155155
],
156156
"source": [
157-
"da_diff = da1/da2\n",
157+
"da_diff = da1 / da2\n",
158158
"da_diff.plot(title=\"da1/da2\");"
159159
]
160160
}

notebooks/DataArray - Dfs123 plotting.ipynb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
],
4949
"source": [
5050
"ds = mikeio.read(\"../tests/testdata/vu_tide_hourly.dfs1\")\n",
51-
"ds = ds.rename({\"Tidal current component (geographic East)\":\"Tidal current u-comp\"})\n",
51+
"ds = ds.rename({\"Tidal current component (geographic East)\": \"Tidal current u-comp\"})\n",
5252
"da = ds[\"Tidal current u-comp\"]\n",
5353
"da"
5454
]
@@ -153,7 +153,7 @@
153153
}
154154
],
155155
"source": [
156-
"# first 48 hours... \n",
156+
"# first 48 hours...\n",
157157
"da[:49].plot.pcolormesh();"
158158
]
159159
},
@@ -175,7 +175,7 @@
175175
],
176176
"source": [
177177
"# single point on line as timeseries\n",
178-
"da.sel(x=0.5).sel(time=slice(\"2021-08-01\",\"2021-08-03\")).plot();"
178+
"da.sel(x=0.5).sel(time=slice(\"2021-08-01\", \"2021-08-03\")).plot();"
179179
]
180180
},
181181
{
@@ -271,7 +271,7 @@
271271
}
272272
],
273273
"source": [
274-
"da.plot(figsize=(10,6));"
274+
"da.plot(figsize=(10, 6));"
275275
]
276276
},
277277
{
@@ -308,7 +308,7 @@
308308
}
309309
],
310310
"source": [
311-
"da.plot.contourf(figsize=(10,6), levels=4, label=\"Højde (m)\")\n",
311+
"da.plot.contourf(figsize=(10, 6), levels=4, label=\"Højde (m)\")\n",
312312
"plt.xlabel(\"Længdekreds (°)\")\n",
313313
"plt.ylabel(\"Breddekreds (°)\")"
314314
]
@@ -330,7 +330,7 @@
330330
}
331331
],
332332
"source": [
333-
"ax = da.plot.contour(figsize=(8,8), cmap=\"plasma\")\n",
333+
"ax = da.plot.contour(figsize=(8, 8), cmap=\"plasma\")\n",
334334
"ax.set_xlim([12.5, 12.9])\n",
335335
"ax.set_ylim([55.8, 56]);"
336336
]
@@ -436,7 +436,7 @@
436436
}
437437
],
438438
"source": [
439-
"ds=dfs.read()\n",
439+
"ds = dfs.read()\n",
440440
"ds"
441441
]
442442
},
@@ -477,7 +477,7 @@
477477
}
478478
],
479479
"source": [
480-
"ax = ds.Temperature[:,0,:,:].plot.contourf()\n",
480+
"ax = ds.Temperature[:, 0, :, :].plot.contourf()\n",
481481
"ax.grid()"
482482
]
483483
},
@@ -498,7 +498,7 @@
498498
}
499499
],
500500
"source": [
501-
"ds.Temperature[:,0,:,0].plot();"
501+
"ds.Temperature[:, 0, :, 0].plot();"
502502
]
503503
},
504504
{
@@ -523,7 +523,7 @@
523523
}
524524
],
525525
"source": [
526-
"ds=dfs.read(layers=0)\n",
526+
"ds = dfs.read(layers=0)\n",
527527
"ds"
528528
]
529529
},

notebooks/DataArray - Dfsu plotting.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
}
106106
],
107107
"source": [
108-
"# default plot is a map, for multiple timestep data, the first timestep will be shown \n",
108+
"# default plot is a map, for multiple timestep data, the first timestep will be shown\n",
109109
"da.plot();"
110110
]
111111
},
@@ -127,7 +127,7 @@
127127
],
128128
"source": [
129129
"# plot last time step as contour map\n",
130-
"da[-1].plot.contour(figsize=(5,8));"
130+
"da[-1].plot.contour(figsize=(5, 8));"
131131
]
132132
},
133133
{
@@ -147,7 +147,7 @@
147147
}
148148
],
149149
"source": [
150-
"_, ax = plt.subplots(1,2)\n",
150+
"_, ax = plt.subplots(1, 2)\n",
151151
"da.plot.mesh(ax=ax[0])\n",
152152
"da.plot.outline(ax=ax[1]);"
153153
]
@@ -381,7 +381,7 @@
381381
}
382382
],
383383
"source": [
384-
"ds[1].plot(); "
384+
"ds[1].plot();"
385385
]
386386
},
387387
{
@@ -414,7 +414,7 @@
414414
}
415415
],
416416
"source": [
417-
"ds = dfs.read() \n",
417+
"ds = dfs.read()\n",
418418
"ds"
419419
]
420420
},

notebooks/DataArray - Masking.ipynb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
],
5252
"source": [
5353
"fn = \"../tests/testdata/oresundHD_run1.dfsu\"\n",
54-
"da = mikeio.read(fn, items=\"Surface elevation\", time=[0,2,4])[0]\n",
54+
"da = mikeio.read(fn, items=\"Surface elevation\", time=[0, 2, 4])[0]\n",
5555
"da"
5656
]
5757
},
@@ -74,7 +74,7 @@
7474
}
7575
],
7676
"source": [
77-
"_, ax = plt.subplots(1, da.n_timesteps, figsize=(11,5), sharey=True)\n",
77+
"_, ax = plt.subplots(1, da.n_timesteps, figsize=(11, 5), sharey=True)\n",
7878
"for step in range(da.n_timesteps):\n",
7979
" da[step].plot(ax=ax[step], vmin=0.08, vmax=0.35)"
8080
]
@@ -110,7 +110,7 @@
110110
],
111111
"source": [
112112
"threshold = 0.2\n",
113-
"mask = da<threshold\n",
113+
"mask = da < threshold\n",
114114
"mask"
115115
]
116116
},
@@ -173,10 +173,10 @@
173173
}
174174
],
175175
"source": [
176-
"_, ax = plt.subplots(2, da.n_timesteps, figsize=(11,10), sharey=True)\n",
176+
"_, ax = plt.subplots(2, da.n_timesteps, figsize=(11, 10), sharey=True)\n",
177177
"for step in range(da.n_timesteps):\n",
178-
" mask[step].plot(ax=ax[0,step], cmap=\"Reds\", add_colorbar=False)\n",
179-
" wl_capped[step].plot(ax=ax[1,step], vmin=0.08, vmax=0.35)"
178+
" mask[step].plot(ax=ax[0, step], cmap=\"Reds\", add_colorbar=False)\n",
179+
" wl_capped[step].plot(ax=ax[1, step], vmin=0.08, vmax=0.35)"
180180
]
181181
},
182182
{
@@ -207,7 +207,7 @@
207207
}
208208
],
209209
"source": [
210-
"ze = da.geometry.element_coordinates[:,2]\n",
210+
"ze = da.geometry.element_coordinates[:, 2]\n",
211211
"ze.shape"
212212
]
213213
},
@@ -229,7 +229,7 @@
229229
],
230230
"source": [
231231
"wl_shallow = da.copy()\n",
232-
"wl_shallow[ze<-10] = np.nan # select all elements with depth lower than -10m\n",
232+
"wl_shallow[ze < -10] = np.nan # select all elements with depth lower than -10m\n",
233233
"wl_shallow.shape"
234234
]
235235
},

notebooks/Dataset - Add item.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"outputs": [],
1919
"source": [
2020
"import numpy as np\n",
21-
"import mikeio\n"
21+
"import mikeio"
2222
]
2323
},
2424
{
@@ -104,7 +104,7 @@
104104
}
105105
],
106106
"source": [
107-
"ws2.values = np.clip(ws2.values, 1,18)\n",
107+
"ws2.values = np.clip(ws2.values, 1, 18)\n",
108108
"ws2.plot.hist();"
109109
]
110110
},
@@ -182,7 +182,7 @@
182182
}
183183
],
184184
"source": [
185-
"ds2 = ds[[\"Wind speed 2\",\"Surface elevation\", \"Wind speed\"]]\n",
185+
"ds2 = ds[[\"Wind speed 2\", \"Surface elevation\", \"Wind speed\"]]\n",
186186
"ds2"
187187
]
188188
},

notebooks/Dataset - Concat, merge.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
],
7676
"source": [
7777
"ds2 = mikeio.read(\"../tests/testdata/tide2.dfs1\") + 0.5 # add offset\n",
78-
"ds2\n"
78+
"ds2"
7979
]
8080
},
8181
{
@@ -130,9 +130,9 @@
130130
}
131131
],
132132
"source": [
133-
"plt.plot(ds1.time, ds1[0].to_numpy()[:,1], 'ro', label=\"Dataset 1\")\n",
134-
"plt.plot(ds2.time, ds2[0].to_numpy()[:,1], 'k+', label=\"Dataset 2\")\n",
135-
"plt.plot(ds3.time, ds3[0].to_numpy()[:,1], 'g-', label=\"Dataset 3\")\n",
133+
"plt.plot(ds1.time, ds1[0].to_numpy()[:, 1], \"ro\", label=\"Dataset 1\")\n",
134+
"plt.plot(ds2.time, ds2[0].to_numpy()[:, 1], \"k+\", label=\"Dataset 2\")\n",
135+
"plt.plot(ds3.time, ds3[0].to_numpy()[:, 1], \"g-\", label=\"Dataset 3\")\n",
136136
"plt.title(\"Notice the offset...\")\n",
137137
"plt.legend();"
138138
]
@@ -193,7 +193,7 @@
193193
],
194194
"source": [
195195
"dsB = dsA.copy()\n",
196-
"dsB = dsB.rename({\"Level\":\"Other_level\"})\n",
196+
"dsB = dsB.rename({\"Level\": \"Other_level\"})\n",
197197
"dsB = dsB + 2\n",
198198
"dsB"
199199
]

notebooks/Dfs0 - Relative time.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@
192192
}
193193
],
194194
"source": [
195-
"df['Item 5'].plot();"
195+
"df[\"Item 5\"].plot();"
196196
]
197197
},
198198
{

0 commit comments

Comments
 (0)