Skip to content

Commit fa09c06

Browse files
committed
typos
1 parent 1bfd5c0 commit fa09c06

File tree

4 files changed

+15
-17
lines changed

4 files changed

+15
-17
lines changed

examples/06_grid_manipulation/pet_advect.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,21 +104,21 @@ def update(i_frame, t_step):
104104
# it could be run backward with `backward=True` option in filament method
105105
p = g.filament(x, y, "u", "v", **kw_p, filament_size=3)
106106
fig, txt, l, t = anim_ax(lw=0.5)
107-
ani = VideoAnimation(fig, update, **kwargs, fargs=(frame_t,))
107+
_ = VideoAnimation(fig, update, **kwargs, fargs=(frame_t,))
108108

109109
# %%
110110
# Particle forward
111111
# ^^^^^^^^^^^^^^^^^
112112
# Forward advection of particles
113113
p = g.advect(x, y, "u", "v", **kw_p)
114114
fig, txt, l, t = anim_ax(ls="", marker=".", markersize=1)
115-
ani = VideoAnimation(fig, update, **kwargs, fargs=(frame_t,))
115+
_ = VideoAnimation(fig, update, **kwargs, fargs=(frame_t,))
116116

117117
# %%
118118
# We get last position and run backward until original position
119119
p = g.advect(x, y, "u", "v", **kw_p, backward=True)
120120
fig, txt, l, _ = anim_ax(ls="", marker=".", markersize=1)
121-
ani = VideoAnimation(fig, update, **kwargs, fargs=(-frame_t,))
121+
_ = VideoAnimation(fig, update, **kwargs, fargs=(-frame_t,))
122122

123123
# %%
124124
# Particles stat

examples/06_grid_manipulation/pet_lavd.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import py_eddy_tracker.gui
2828
from py_eddy_tracker.data import get_path
2929
from py_eddy_tracker.dataset.grid import RegularGridDataset
30-
from py_eddy_tracker.observations.network import NetworkObservations
30+
from py_eddy_tracker.observations.observation import EddiesObservations
3131

3232

3333
# %%
@@ -63,8 +63,6 @@ def _repr_html_(self, *args, **kwargs):
6363
r'width="[0-9]*"\sheight="[0-9]*"', 'width="100%" height="100%"', content
6464
)
6565

66-
return
67-
6866
def save(self, *args, **kwargs):
6967
if args[0].endswith("gif"):
7068
# In this case gif is use to create thumbnail which are not use but consume same time than video
@@ -150,7 +148,7 @@ def update(i_frame):
150148
# pcolorfast will be faster than pcolormesh, we could use pcolorfast due to x and y are regular
151149
pcolormesh = ax.pcolorfast(x_g_, y_g_, lavd, **kw_vorticity)
152150
update_axes(ax, pcolormesh)
153-
ani = VideoAnimation(ax.figure, update, **kw_video)
151+
_ = VideoAnimation(ax.figure, update, **kw_video)
154152

155153
# %%
156154
# Final LAVD
@@ -173,8 +171,8 @@ def update(i_frame):
173171
# Period used for LAVD integration (8 days) is too short for a real use, but choose for example efficiency.
174172
fig, ax, _ = start_ax()
175173
mappable = lavd.display(ax, "lavd", **kw_vorticity)
176-
NetworkObservations.load_file(get_path("Anticyclonic_20160515.nc")).display(
174+
EddiesObservations.load_file(get_path("Anticyclonic_20160515.nc")).display(
177175
ax, color="k"
178176
)
179-
NetworkObservations.load_file(get_path("Cyclonic_20160515.nc")).display(ax, color="k")
177+
EddiesObservations.load_file(get_path("Cyclonic_20160515.nc")).display(ax, color="k")
180178
_ = update_axes(ax, mappable)

notebooks/python_module/06_grid_manipulation/pet_advect.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@
163163
},
164164
"outputs": [],
165165
"source": [
166-
"p = g.filament(x, y, \"u\", \"v\", **kw_p, filament_size=3)\nfig, txt, l, t = anim_ax(lw=0.5)\nani = VideoAnimation(fig, update, **kwargs, fargs=(frame_t,))"
166+
"p = g.filament(x, y, \"u\", \"v\", **kw_p, filament_size=3)\nfig, txt, l, t = anim_ax(lw=0.5)\n_ = VideoAnimation(fig, update, **kwargs, fargs=(frame_t,))"
167167
]
168168
},
169169
{
@@ -181,7 +181,7 @@
181181
},
182182
"outputs": [],
183183
"source": [
184-
"p = g.advect(x, y, \"u\", \"v\", **kw_p)\nfig, txt, l, t = anim_ax(ls=\"\", marker=\".\", markersize=1)\nani = VideoAnimation(fig, update, **kwargs, fargs=(frame_t,))"
184+
"p = g.advect(x, y, \"u\", \"v\", **kw_p)\nfig, txt, l, t = anim_ax(ls=\"\", marker=\".\", markersize=1)\n_ = VideoAnimation(fig, update, **kwargs, fargs=(frame_t,))"
185185
]
186186
},
187187
{
@@ -199,7 +199,7 @@
199199
},
200200
"outputs": [],
201201
"source": [
202-
"p = g.advect(x, y, \"u\", \"v\", **kw_p, backward=True)\nfig, txt, l, _ = anim_ax(ls=\"\", marker=\".\", markersize=1)\nani = VideoAnimation(fig, update, **kwargs, fargs=(-frame_t,))"
202+
"p = g.advect(x, y, \"u\", \"v\", **kw_p, backward=True)\nfig, txt, l, _ = anim_ax(ls=\"\", marker=\".\", markersize=1)\n_ = VideoAnimation(fig, update, **kwargs, fargs=(-frame_t,))"
203203
]
204204
},
205205
{

notebooks/python_module/06_grid_manipulation/pet_lavd.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"cell_type": "markdown",
1616
"metadata": {},
1717
"source": [
18-
"\n# LAVD experiment\n\nNaive method to reproduce LAVD(Lagrangian-Averaged Vorticity deviation) method with a static velocity field.\nIn the current example we didn't remove a mean vorticity.\n\nMethod are described here:\n\n - Abernathey, Ryan, and George Haller. \"Transport by Lagrangian Vortices in the Eastern Pacific\",\n Journal of Physical Oceanography 48, 3 (2018): 667-685, accessed Feb 16, 2021,\n https://doi.org/10.1175/JPO-D-17-0102.1\n - `Transport by Coherent Lagrangian Vortices`_,\n R. Abernathey, Sinha A., Tarshish N., Liu T., Zhang C., Haller G., 2019,\n Talk a t the Sources and Sinks of Ocean Mesoscale Eddy Energy CLIVAR Workshop\n\n https://usclivar.org/sites/default/files/meetings/2019/presentations/Aberernathey_CLIVAR.pdf\n"
18+
"\n# LAVD experiment\n\nNaive method to reproduce LAVD(Lagrangian-Averaged Vorticity deviation) method with a static velocity field.\nIn the current example we didn't remove a mean vorticity.\n\nMethod are described here:\n\n - Abernathey, Ryan, and George Haller. \"Transport by Lagrangian Vortices in the Eastern Pacific\",\n Journal of Physical Oceanography 48, 3 (2018): 667-685, accessed Feb 16, 2021,\n https://doi.org/10.1175/JPO-D-17-0102.1\n - `Transport by Coherent Lagrangian Vortices`_,\n R. Abernathey, Sinha A., Tarshish N., Liu T., Zhang C., Haller G., 2019,\n Talk a t the Sources and Sinks of Ocean Mesoscale Eddy Energy CLIVAR Workshop\n\n https://usclivar.org/sites/default/files/meetings/2019/presentations/Aberernathey_CLIVAR.pdf\n"
1919
]
2020
},
2121
{
@@ -26,7 +26,7 @@
2626
},
2727
"outputs": [],
2828
"source": [
29-
"import re\n\nfrom matplotlib import pyplot as plt\nfrom matplotlib.animation import FuncAnimation\nfrom numpy import arange, meshgrid, zeros\n\nimport py_eddy_tracker.gui\nfrom py_eddy_tracker.data import get_path\nfrom py_eddy_tracker.dataset.grid import RegularGridDataset\nfrom py_eddy_tracker.observations.network import NetworkObservations"
29+
"import re\n\nfrom matplotlib import pyplot as plt\nfrom matplotlib.animation import FuncAnimation\nfrom numpy import arange, meshgrid, zeros\n\nimport py_eddy_tracker.gui\nfrom py_eddy_tracker.data import get_path\nfrom py_eddy_tracker.dataset.grid import RegularGridDataset\nfrom py_eddy_tracker.observations.observation import EddiesObservations"
3030
]
3131
},
3232
{
@@ -48,7 +48,7 @@
4848
},
4949
"outputs": [],
5050
"source": [
51-
"class VideoAnimation(FuncAnimation):\n def _repr_html_(self, *args, **kwargs):\n \"\"\"To get video in html and have a player\"\"\"\n content = self.to_html5_video()\n return re.sub(\n r'width=\"[0-9]*\"\\sheight=\"[0-9]*\"', 'width=\"100%\" height=\"100%\"', content\n )\n\n return\n\n def save(self, *args, **kwargs):\n if args[0].endswith(\"gif\"):\n # In this case gif is use to create thumbnail which are not use but consume same time than video\n # So we create an empty file, to save time\n with open(args[0], \"w\") as _:\n pass\n return\n return super().save(*args, **kwargs)"
51+
"class VideoAnimation(FuncAnimation):\n def _repr_html_(self, *args, **kwargs):\n \"\"\"To get video in html and have a player\"\"\"\n content = self.to_html5_video()\n return re.sub(\n r'width=\"[0-9]*\"\\sheight=\"[0-9]*\"', 'width=\"100%\" height=\"100%\"', content\n )\n\n def save(self, *args, **kwargs):\n if args[0].endswith(\"gif\"):\n # In this case gif is use to create thumbnail which are not use but consume same time than video\n # So we create an empty file, to save time\n with open(args[0], \"w\") as _:\n pass\n return\n return super().save(*args, **kwargs)"
5252
]
5353
},
5454
{
@@ -138,7 +138,7 @@
138138
},
139139
"outputs": [],
140140
"source": [
141-
"def update(i_frame):\n global lavd, i\n i += 1\n x, y = particule.__next__()\n # Interp vorticity on new_position\n lavd += abs(g.interp(\"vort\", x, y).reshape(original_shape) * 1 / nb_time)\n txt.set_text(f\"T0 + {i / step_by_day:.2f} days of advection\")\n pcolormesh.set_array(lavd / i * nb_time)\n return pcolormesh, txt\n\n\nkw_video = dict(frames=arange(nb_time), interval=1000.0 / step_by_day / 2, blit=True)\nfig, ax, txt = start_ax(dpi=60)\nx_g_, y_g_ = arange(0 - step / 2, 36 + step / 2, step), arange(\n 28 - step / 2, 46 + step / 2, step\n)\n# pcolorfast will be faster than pcolormesh, we could use pcolorfast due to x and y are regular\npcolormesh = ax.pcolorfast(x_g_, y_g_, lavd, **kw_vorticity)\nupdate_axes(ax, pcolormesh)\nani = VideoAnimation(ax.figure, update, **kw_video)"
141+
"def update(i_frame):\n global lavd, i\n i += 1\n x, y = particule.__next__()\n # Interp vorticity on new_position\n lavd += abs(g.interp(\"vort\", x, y).reshape(original_shape) * 1 / nb_time)\n txt.set_text(f\"T0 + {i / step_by_day:.2f} days of advection\")\n pcolormesh.set_array(lavd / i * nb_time)\n return pcolormesh, txt\n\n\nkw_video = dict(frames=arange(nb_time), interval=1000.0 / step_by_day / 2, blit=True)\nfig, ax, txt = start_ax(dpi=60)\nx_g_, y_g_ = arange(0 - step / 2, 36 + step / 2, step), arange(\n 28 - step / 2, 46 + step / 2, step\n)\n# pcolorfast will be faster than pcolormesh, we could use pcolorfast due to x and y are regular\npcolormesh = ax.pcolorfast(x_g_, y_g_, lavd, **kw_vorticity)\nupdate_axes(ax, pcolormesh)\n_ = VideoAnimation(ax.figure, update, **kw_video)"
142142
]
143143
},
144144
{
@@ -181,7 +181,7 @@
181181
},
182182
"outputs": [],
183183
"source": [
184-
"fig, ax, _ = start_ax()\nmappable = lavd.display(ax, \"lavd\", **kw_vorticity)\nNetworkObservations.load_file(get_path(\"Anticyclonic_20160515.nc\")).display(\n ax, color=\"k\"\n)\nNetworkObservations.load_file(get_path(\"Cyclonic_20160515.nc\")).display(ax, color=\"k\")\n_ = update_axes(ax, mappable)"
184+
"fig, ax, _ = start_ax()\nmappable = lavd.display(ax, \"lavd\", **kw_vorticity)\nEddiesObservations.load_file(get_path(\"Anticyclonic_20160515.nc\")).display(\n ax, color=\"k\"\n)\nEddiesObservations.load_file(get_path(\"Cyclonic_20160515.nc\")).display(ax, color=\"k\")\n_ = update_axes(ax, mappable)"
185185
]
186186
}
187187
],

0 commit comments

Comments
 (0)