Skip to content

Commit cd58812

Browse files
committed
update reference of lavd example
1 parent b575db7 commit cd58812

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

examples/06_grid_manipulation/pet_advect.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ def anim_ax(generator, **kw):
7979
ax = fig.add_axes([0, 0, 1, 1], projection="full_axes")
8080
ax.set_xlim(19, 30), ax.set_ylim(31, 36.5), ax.grid()
8181
a.filled(ax, facecolors="r", alpha=0.1), c.filled(ax, facecolors="b", alpha=0.1)
82-
return fig, ax.text(21, 32.1, ""), ax.plot([], [], "k", **kw)[0], t
82+
line = ax.plot([], [], "k", **kw)[0]
83+
return fig, ax.text(21, 32.1, ""), line, t
8384

8485

8586
def update(i_frame, t_step):

examples/06_grid_manipulation/pet_lavd.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
88
Method are described here:
99
10-
- `Transport by Lagrangian Vortices in the Eastern Pacific <https://doi.org/10.1175/JPO-D-17-0102.1>`_
11-
- `Transport by Coherent Lagrangian Vortices`_
10+
- Abernathey, Ryan, and George Haller. " Transport by Lagrangian Vortices in the Eastern Pacific", Journal of Physical Oceanography 48, 3 (2018): 667-685, accessed Feb 16, 2021, https://doi.org/10.1175/JPO-D-17-0102.1
11+
- `Transport by Coherent Lagrangian Vortices`_, R. Abernathey, Sinha A., Tarshish N., Liu T., Zhang C., Haller G., 2019, Talk a t the Sources and Sinks of Ocean Mesoscale Eddy Energy CLIVAR Workshop
1212
1313
.. _Transport by Coherent Lagrangian Vortices:
1414
https://usclivar.org/sites/default/files/meetings/2019/presentations/Aberernathey_CLIVAR.pdf
@@ -74,7 +74,7 @@ def save(self, *args, **kwargs):
7474
# %%
7575
# Data
7676
# ----
77-
# To compute vorticity(:math:`\omega`) we compute u/v field with a stencil and apply the following equation with stencil
77+
# To compute vorticity (:math:`\omega`) we compute u/v field with a stencil and apply the following equation with stencil
7878
# method :
7979
#
8080
# .. math::
@@ -166,11 +166,11 @@ def update(i_frame):
166166

167167
# %%
168168
# Display final LAVD with py eddy tracker detection.
169-
# Period used for LAVD integration(8 days) is too short for a real use, but choose for example efficiency.
169+
# Period used for LAVD integration (8 days) is too short for a real use, but choose for example efficiency.
170170
fig, ax, _ = start_ax()
171171
mappable = lavd.display(ax, "lavd", **kw_vorticity)
172172
NetworkObservations.load_file(get_path("Anticyclonic_20160515.nc")).display(
173173
ax, color="k"
174174
)
175175
NetworkObservations.load_file(get_path("Cyclonic_20160515.nc")).display(ax, color="k")
176-
update_axes(ax, mappable)
176+
_ = update_axes(ax, mappable)

notebooks/python_module/06_grid_manipulation/pet_advect.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
},
110110
"outputs": [],
111111
"source": [
112-
"x, y = np.meshgrid(np.arange(13, 36, 0.125), np.arange(28, 40, 0.125))\nx, y = x.reshape(-1), y.reshape(-1)\n# Remove all original position that we can't advect at first place\nm = ~np.isnan(g.interp(\"u\", x, y))\nx, y = x[m], y[m]\n\n# Movie properties\nkwargs = dict(frames=np.arange(51), interval=90)\nkw_p = dict(nb_step=2, time_step=21600)\nframe_t = kw_p[\"nb_step\"] * kw_p[\"time_step\"] / 86400.0\n\n\ndef anim_ax(generator, **kw):\n t = 0\n for _ in range(4):\n generator.__next__()\n t += frame_t\n\n fig = plt.figure(figsize=(10, 5), dpi=64)\n ax = fig.add_axes([0, 0, 1, 1], projection=\"full_axes\")\n ax.set_xlim(19, 30), ax.set_ylim(31, 36.5), ax.grid()\n a.filled(ax, facecolors=\"r\", alpha=0.1), c.filled(ax, facecolors=\"b\", alpha=0.1)\n return fig, ax.text(21, 32.1, \"\"), ax.plot([], [], \"k\", **kw)[0], t\n\n\ndef update(i_frame, t_step):\n global t\n x, y = p.__next__()\n t += t_step\n l.set_data(x, y)\n txt.set_text(f\"T0 + {t:.1f} days\")"
112+
"x, y = np.meshgrid(np.arange(13, 36, 0.125), np.arange(28, 40, 0.125))\nx, y = x.reshape(-1), y.reshape(-1)\n# Remove all original position that we can't advect at first place\nm = ~np.isnan(g.interp(\"u\", x, y))\nx, y = x[m], y[m]\n\n# Movie properties\nkwargs = dict(frames=np.arange(51), interval=90)\nkw_p = dict(nb_step=2, time_step=21600)\nframe_t = kw_p[\"nb_step\"] * kw_p[\"time_step\"] / 86400.0\n\n\ndef anim_ax(generator, **kw):\n t = 0\n for _ in range(4):\n generator.__next__()\n t += frame_t\n\n fig = plt.figure(figsize=(10, 5), dpi=64)\n ax = fig.add_axes([0, 0, 1, 1], projection=\"full_axes\")\n ax.set_xlim(19, 30), ax.set_ylim(31, 36.5), ax.grid()\n a.filled(ax, facecolors=\"r\", alpha=0.1), c.filled(ax, facecolors=\"b\", alpha=0.1)\n line = ax.plot([], [], \"k\", **kw)[0]\n return fig, ax.text(21, 32.1, \"\"), line, t\n\n\ndef update(i_frame, t_step):\n global t\n x, y = p.__next__()\n t += t_step\n l.set_data(x, y)\n txt.set_text(f\"T0 + {t:.1f} days\")"
113113
]
114114
},
115115
{

notebooks/python_module/06_grid_manipulation/pet_lavd.ipynb

Lines changed: 4 additions & 4 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 - `Transport by Lagrangian Vortices in the Eastern Pacific <https://doi.org/10.1175/JPO-D-17-0102.1>`_\n - `Transport by Coherent Lagrangian Vortices`_\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\", Journal of Physical Oceanography 48, 3 (2018): 667-685, accessed Feb 16, 2021, https://doi.org/10.1175/JPO-D-17-0102.1\n - `Transport by Coherent Lagrangian Vortices`_, R. Abernathey, Sinha A., Tarshish N., Liu T., Zhang C., Haller G., 2019, 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
{
@@ -55,7 +55,7 @@
5555
"cell_type": "markdown",
5656
"metadata": {},
5757
"source": [
58-
"## Data\nTo compute vorticity($\\omega$) we compute u/v field with a stencil and apply the following equation with stencil\nmethod :\n\n\\begin{align}\\omega = \\frac{\\partial v}{\\partial x} - \\frac{\\partial u}{\\partial y}\\end{align}\n\n"
58+
"## Data\nTo compute vorticity ($\\omega$) we compute u/v field with a stencil and apply the following equation with stencil\nmethod :\n\n\\begin{align}\\omega = \\frac{\\partial v}{\\partial x} - \\frac{\\partial u}{\\partial y}\\end{align}\n\n"
5959
]
6060
},
6161
{
@@ -170,7 +170,7 @@
170170
"cell_type": "markdown",
171171
"metadata": {},
172172
"source": [
173-
"Display final LAVD with py eddy tracker detection.\nPeriod used for LAVD integration(8 days) is too short for a real use, but choose for example efficiency.\n\n"
173+
"Display final LAVD with py eddy tracker detection.\nPeriod used for LAVD integration (8 days) is too short for a real use, but choose for example efficiency.\n\n"
174174
]
175175
},
176176
{
@@ -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\")\nupdate_axes(ax, mappable)"
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)"
185185
]
186186
}
187187
],

0 commit comments

Comments
 (0)