Skip to content

Commit 0f189be

Browse files
committed
Use updated method in example
Update docstring
1 parent fcd83fd commit 0f189be

28 files changed

+62
-48
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ instance/
7171
# Sphinx documentation
7272
docs/_build/
7373
doc/gen_modules/
74+
doc/_autosummary/
7475

7576
# PyBuilder
7677
target/

examples/02_eddy_identification/pet_eddy_detection.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,10 @@ def update_axes(ax, mappable=None):
141141
update_axes(ax, m)
142142

143143
# %%
144-
# Display speed radius of eddies detected
144+
# Display speed radius of eddies detected with filled eddy contours
145145
ax = start_axes("Eddies speed radius (km)")
146-
a.filled(
147-
ax, "radius_e", vmin=10, vmax=80, cmap="magma_r", factor=0.001, lut=14, ref=-10
148-
)
146+
kwargs = dict(vmin=10, vmax=80, cmap="magma_r", factor=0.001, lut=14, ref=-10)
147+
a.filled(ax, "radius_e", **kwargs)
149148
m = c.filled(
150149
ax, "radius_e", vmin=10, vmax=80, cmap="magma_r", factor=0.001, lut=14, ref=-10
151150
)

examples/02_eddy_identification/pet_interp_grid_on_dataset.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ def update_axes(ax, mappable=None):
5454
# %%
5555
# Get mean of eke in each effective contour
5656

57-
ax = start_axes("EKE (cm²/s²)")
57+
ax = start_axes("EKE mean (cm²/s²)")
5858
a.display(ax, color="r", linewidth=0.5, label="Anticyclonic", ref=-10)
5959
c.display(ax, color="b", linewidth=0.5, label="Cyclonic", ref=-10)
6060
eke = a.interp_grid(aviso_map, "eke", method="mean", intern=False)
61-
ax.scatter((a.longitude + 10) % 360 - 10, a.latitude, c=eke, **eke_kwargs)
61+
a.filled(ax, eke, ref=-10, **eke_kwargs)
6262
eke = c.interp_grid(aviso_map, "eke", method="mean", intern=False)
63-
m = ax.scatter((c.longitude + 10) % 360 - 10, c.latitude, c=eke, **eke_kwargs)
63+
m = c.filled(ax, eke, ref=-10, **eke_kwargs)
6464
update_axes(ax, m)

examples/02_eddy_identification/pet_sla_and_adt.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,9 @@ def update_axes(ax, mappable=None):
133133
ax.set_xlabel("Absolute Dynamic Topography")
134134
ax.set_ylabel("Sea Level Anomaly")
135135

136-
ax.plot(a_adt[field][i_a_adt] * factor, a_sla[field][i_a_sla] * factor, "r.")
137-
ax.plot(c_adt[field][i_c_adt] * factor, c_sla[field][i_c_sla] * factor, "b.")
136+
ax.plot(a_adt[field][i_a_adt] * factor, a_sla[field][i_a_sla] * factor, "r.", label='Anticyclonic')
137+
ax.plot(c_adt[field][i_c_adt] * factor, c_sla[field][i_c_sla] * factor, "b.", label='Cyclonic')
138138
ax.set_aspect("equal"), ax.grid()
139139
ax.plot((0, 1000), (0, 1000), "g")
140140
ax.set_xlim(0, stop), ax.set_ylim(0, stop)
141+
ax.legend()

notebooks/python_module/02_eddy_identification/pet_contour_circle.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"cell_type": "markdown",
1616
"metadata": {},
1717
"source": [
18-
"\nDisplay contour & circle\n========================\n"
18+
"\n# Display contour & circle\n"
1919
]
2020
},
2121
{

notebooks/python_module/02_eddy_identification/pet_eddy_detection.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@
260260
"cell_type": "markdown",
261261
"metadata": {},
262262
"source": [
263-
"Display speed radius of eddies detected\n\n"
263+
"Display speed radius of eddies detected with filled eddy contours\n\n"
264264
]
265265
},
266266
{
@@ -271,7 +271,7 @@
271271
},
272272
"outputs": [],
273273
"source": [
274-
"ax = start_axes(\"Eddies speed radius (km)\")\na.filled(\n ax, \"radius_e\", vmin=10, vmax=80, cmap=\"magma_r\", factor=0.001, lut=14, ref=-10\n)\nm = c.filled(\n ax, \"radius_e\", vmin=10, vmax=80, cmap=\"magma_r\", factor=0.001, lut=14, ref=-10\n)\nupdate_axes(ax, m)"
274+
"ax = start_axes(\"Eddies speed radius (km)\")\nkwargs = dict(vmin=10, vmax=80, cmap=\"magma_r\", factor=0.001, lut=14, ref=-10)\na.filled(ax, \"radius_e\", **kwargs)\nm = c.filled(\n ax, \"radius_e\", vmin=10, vmax=80, cmap=\"magma_r\", factor=0.001, lut=14, ref=-10\n)\nupdate_axes(ax, m)"
275275
]
276276
}
277277
],

notebooks/python_module/02_eddy_identification/pet_filter_and_detection.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@
176176
"name": "python",
177177
"nbconvert_exporter": "python",
178178
"pygments_lexer": "ipython3",
179-
"version": "3.7.0"
179+
"version": "3.7.7"
180180
}
181181
},
182182
"nbformat": 4,

notebooks/python_module/02_eddy_identification/pet_interp_grid_on_dataset.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
},
3838
"outputs": [],
3939
"source": [
40-
"def start_axes(title):\n fig = plt.figure(figsize=(13, 5))\n ax = fig.add_axes([0.03, 0.03, 0.90, 0.94])\n ax.set_xlim(-6, 36.5), ax.set_ylim(30, 46)\n ax.set_aspect(\"equal\")\n ax.set_title(title)\n return ax\n\n\ndef update_axes(ax, mappable=None):\n ax.grid()\n ax.legend()\n if mappable:\n plt.colorbar(m, cax=ax.figure.add_axes([0.95, 0.05, 0.01, 0.9]))"
40+
"def start_axes(title):\n fig = plt.figure(figsize=(13, 5))\n ax = fig.add_axes([0.03, 0.03, 0.90, 0.94])\n ax.set_xlim(-6, 36.5), ax.set_ylim(30, 46)\n ax.set_aspect(\"equal\")\n ax.set_title(title)\n return ax\n\n\ndef update_axes(ax, mappable=None):\n ax.grid()\n ax.legend()\n if mappable:\n plt.colorbar(mappable, cax=ax.figure.add_axes([0.95, 0.05, 0.01, 0.9]))"
4141
]
4242
},
4343
{
@@ -55,7 +55,7 @@
5555
},
5656
"outputs": [],
5757
"source": [
58-
"a = EddiesObservations.load_file(data.get_path(\"Anticyclonic_20160515.nc\"))\nc = EddiesObservations.load_file(data.get_path(\"Cyclonic_20160515.nc\"))\n\naviso_map = RegularGridDataset(\n data.get_path(\"dt_med_allsat_phy_l4_20160515_20190101.nc\"), \"longitude\", \"latitude\"\n)\n# aviso_map.add_uv(\"adt\")\naviso_map.add_uv(\"sla\")"
58+
"a = EddiesObservations.load_file(data.get_path(\"Anticyclonic_20160515.nc\"))\nc = EddiesObservations.load_file(data.get_path(\"Cyclonic_20160515.nc\"))\n\naviso_map = RegularGridDataset(\n data.get_path(\"dt_med_allsat_phy_l4_20160515_20190101.nc\"), \"longitude\", \"latitude\"\n)\naviso_map.add_uv(\"adt\")"
5959
]
6060
},
6161
{
@@ -91,7 +91,7 @@
9191
},
9292
"outputs": [],
9393
"source": [
94-
"ax = start_axes(\"EKE (cm\u00b2/s\u00b2)\")\na.display(ax, color=\"r\", linewidth=0.5, label=\"Anticyclonic\", ref=-10)\nc.display(ax, color=\"b\", linewidth=0.5, label=\"Cyclonic\", ref=-10)\neke = a.interp_grid(aviso_map, \"eke\", method=\"mean\", intern=False)\nm = ax.scatter((a.longitude + 10) % 360 - 10, a.latitude, c=eke, **eke_kwargs)\neke = c.interp_grid(aviso_map, \"eke\", method=\"mean\", intern=False)\nm = ax.scatter((c.longitude + 10) % 360 - 10, c.latitude, c=eke, **eke_kwargs)\nupdate_axes(ax, m)"
94+
"ax = start_axes(\"EKE mean (cm\u00b2/s\u00b2)\")\na.display(ax, color=\"r\", linewidth=0.5, label=\"Anticyclonic\", ref=-10)\nc.display(ax, color=\"b\", linewidth=0.5, label=\"Cyclonic\", ref=-10)\neke = a.interp_grid(aviso_map, \"eke\", method=\"mean\", intern=False)\na.filled(ax, eke, ref=-10, **eke_kwargs)\neke = c.interp_grid(aviso_map, \"eke\", method=\"mean\", intern=False)\nm = c.filled(ax, eke, ref=-10, **eke_kwargs)\nupdate_axes(ax, m)"
9595
]
9696
}
9797
],
@@ -111,7 +111,7 @@
111111
"name": "python",
112112
"nbconvert_exporter": "python",
113113
"pygments_lexer": "ipython3",
114-
"version": "3.7.0"
114+
"version": "3.7.7"
115115
}
116116
},
117117
"nbformat": 4,

notebooks/python_module/02_eddy_identification/pet_radius_vs_area.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
"name": "python",
108108
"nbconvert_exporter": "python",
109109
"pygments_lexer": "ipython3",
110-
"version": "3.7.0"
110+
"version": "3.7.7"
111111
}
112112
},
113113
"nbformat": 4,

notebooks/python_module/02_eddy_identification/pet_shape_gallery.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"cell_type": "markdown",
1616
"metadata": {},
1717
"source": [
18-
"\nShape error gallery\n===================\n\nGallery of contours with shape error\n"
18+
"\n# Shape error gallery\n\nGallery of contours with shape error\n"
1919
]
2020
},
2121
{
@@ -33,7 +33,7 @@
3333
"cell_type": "markdown",
3434
"metadata": {},
3535
"source": [
36-
"Method to compute circle path\n\n"
36+
"Method to built circle from center coordinates\n\n"
3737
]
3838
},
3939
{
@@ -69,7 +69,7 @@
6969
"cell_type": "markdown",
7070
"metadata": {},
7171
"source": [
72-
"Shape error gallery\n-------------------\nFor each contour display, we display circle fitted, we work at different latitude circle could have distorsion\n\n"
72+
"## Shape error gallery\nFor each contour display, we display circle fitted, we work at different latitude circle could have distorsion\n\n"
7373
]
7474
},
7575
{

0 commit comments

Comments
 (0)