Skip to content

Commit 482b7fd

Browse files
committed
Update examples
1 parent e597792 commit 482b7fd

File tree

11 files changed

+18
-15
lines changed

11 files changed

+18
-15
lines changed

examples/16_network/pet_atlas.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
kw_time = dict(cmap="terrain_r", factor=100.0 / n.nb_days, name="count")
2020
kw_ratio = dict(cmap=plt.get_cmap("coolwarm_r", 10))
2121

22+
2223
# %%
2324
# Function
2425
def start_axes(title):

examples/16_network/pet_ioannou_2017_case.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def save(self, *args, **kwargs):
2626
if args[0].endswith("gif"):
2727
# In this case gif is use to create thumbnail which are not use but consume same time than video
2828
# So we create an empty file, to save time
29-
with open(args[0], "w") as h:
29+
with open(args[0], "w") as _:
3030
pass
3131
return
3232
return super().save(*args, **kwargs)
@@ -132,7 +132,7 @@ def update_axes(ax, mappable=None):
132132
ax = start_axes("")
133133
n_copy = close_to_i3.copy()
134134
n_copy.position_filter(2, 4)
135-
n_copy.plot(ax)
135+
n_copy.plot(ax, color_cycle=n_copy.COLORS)
136136
update_axes(ax)
137137

138138
# %%
@@ -151,12 +151,14 @@ def update_axes(ax, mappable=None):
151151
for b0, b1 in [
152152
(datetime(i, 1, 1), datetime(i, 12, 31)) for i in (2004, 2005, 2006, 2007)
153153
]:
154-
b0_, b1_ = (b0 - datetime(1950, 1, 1)).days - 10, (
155-
b1 - datetime(1950, 1, 1)
156-
).days + 10
154+
ref, delta = datetime(1950, 1, 1), 20
155+
b0_, b1_ = (b0 - ref).days, (b1 - ref).days
157156
ax = timeline_axes()
158-
ax.set_xlim(b0_, b1_)
157+
ax.set_xlim(b0_ - delta, b1_ + delta)
159158
ax.set_ylim(10, 115)
159+
ax.axvline(b0_, color="k", lw=1.5, ls="--"), ax.axvline(
160+
b1_, color="k", lw=1.5, ls="--"
161+
)
160162
n_copy.display_timeline(
161163
ax, field="radius_e", method="all", lw=4, markersize=8, factor=1e-3
162164
)

examples/16_network/pet_relative.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
# --------------------
167167
fig = plt.figure(figsize=(15, 8))
168168
ax = fig.add_axes([0.04, 0.06, 0.94, 0.88], projection="full_axes")
169-
close_to_i2.plot(ax)
169+
close_to_i2.plot(ax, color_cycle=close_to_i2.COLORS)
170170
ax.set_xlim(-13, 20), ax.set_ylim(-36.5, -20), ax.grid()
171171
ax = fig.add_axes([0.08, 0.67, 0.55, 0.3])
172172
_ = close_to_i2.display_timeline(ax, field="latitude")

notebooks/python_module/02_eddy_identification/pet_eddy_detection.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170
"cell_type": "markdown",
171171
"metadata": {},
172172
"source": [
173-
"Creteria for rejecting a contour\n0. - Accepted (green)\n1. - Rejection for shape error (red)\n2. - Masked value within contour (blue)\n3. - Under or over the pixel limit bounds (black)\n4. - Amplitude criterion (yellow)\n\n"
173+
"Criteria for rejecting a contour:\n 0. - Accepted (green)\n 1. - Rejection for shape error (red)\n 2. - Masked value within contour (blue)\n 3. - Under or over the pixel limit bounds (black)\n 4. - Amplitude criterion (yellow)\n\n"
174174
]
175175
},
176176
{

notebooks/python_module/02_eddy_identification/pet_eddy_detection_gulf_stream.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@
235235
},
236236
"outputs": [],
237237
"source": [
238-
"ax = start_axes(\"Eddies detected\")\na.display(ax, color=\"r\", linewidth=0.75, label=\"Anticyclonic ({nb_obs} eddies)\", ref=-10)\nc.display(ax, color=\"b\", linewidth=0.75, label=\"Cyclonic ({nb_obs} eddies)\", ref=-10)\nax.legend()\ngreat_current.display(ax, color=\"k\")\nupdate_axes(ax)"
238+
"ax = start_axes(\"Eddies detected\")\na.display(\n ax, color=\"r\", linewidth=0.75, label=\"Anticyclonic ({nb_obs} eddies)\", ref=-10\n)\nc.display(ax, color=\"b\", linewidth=0.75, label=\"Cyclonic ({nb_obs} eddies)\", ref=-10)\nax.legend()\ngreat_current.display(ax, color=\"k\")\nupdate_axes(ax)"
239239
]
240240
},
241241
{

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
@@ -91,7 +91,7 @@
9191
},
9292
"outputs": [],
9393
"source": [
94-
"ax = start_axes(\"Eddies detected over ADT\")\nm = g.display(ax, \"adt\", vmin=-0.15, vmax=0.15)\nmerge_f.display(ax, lw=0.75, label=\"Eddies in the filtered grid ({nb_obs} eddies)\", ref=-10, color=\"k\")\nmerge_t.display(ax, lw=0.75, label=\"Eddies without filter ({nb_obs} eddies)\", ref=-10, color=\"r\")\nax.legend()\nupdate_axes(ax, m)"
94+
"ax = start_axes(\"Eddies detected over ADT\")\nm = g.display(ax, \"adt\", vmin=-0.15, vmax=0.15)\nmerge_f.display(\n ax,\n lw=0.75,\n label=\"Eddies in the filtered grid ({nb_obs} eddies)\",\n ref=-10,\n color=\"k\",\n)\nmerge_t.display(\n ax, lw=0.75, label=\"Eddies without filter ({nb_obs} eddies)\", ref=-10, color=\"r\"\n)\nax.legend()\nupdate_axes(ax, m)"
9595
]
9696
},
9797
{

notebooks/python_module/02_eddy_identification/pet_sla_and_adt.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
},
6767
"outputs": [],
6868
"source": [
69-
"kwargs_a_adt = dict(lw=0.5, label=\"Anticyclonic ADT ({nb_obs} eddies)\", ref=-10, color=\"k\")\nkwargs_c_adt = dict(lw=0.5, label=\"Cyclonic ADT ({nb_obs} eddies)\", ref=-10, color=\"r\")\nkwargs_a_sla = dict(lw=0.5, label=\"Anticyclonic SLA ({nb_obs} eddies)\", ref=-10, color=\"g\")\nkwargs_c_sla = dict(lw=0.5, label=\"Cyclonic SLA ({nb_obs} eddies)\", ref=-10, color=\"b\")"
69+
"kwargs_a_adt = dict(\n lw=0.5, label=\"Anticyclonic ADT ({nb_obs} eddies)\", ref=-10, color=\"k\"\n)\nkwargs_c_adt = dict(lw=0.5, label=\"Cyclonic ADT ({nb_obs} eddies)\", ref=-10, color=\"r\")\nkwargs_a_sla = dict(\n lw=0.5, label=\"Anticyclonic SLA ({nb_obs} eddies)\", ref=-10, color=\"g\"\n)\nkwargs_c_sla = dict(lw=0.5, label=\"Cyclonic SLA ({nb_obs} eddies)\", ref=-10, color=\"b\")"
7070
]
7171
},
7272
{

notebooks/python_module/08_tracking_manipulation/pet_select_track_across_area.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
},
8181
"outputs": [],
8282
"source": [
83-
"fig = plt.figure(figsize=(12, 5))\nax = fig.add_axes((0.05, 0.05, 0.9, 0.9))\nax.set_xlim(-1, 9)\nax.set_ylim(36, 40)\nax.set_aspect(\"equal\")\nax.grid()\nc.plot(ax, color=\"gray\", lw=0.1, ref=-10, label=\"All tracks ({nb_tracks} tracks)\")\nc_subset.plot(ax, color=\"red\", lw=0.2, ref=-10, label=\"selected tracks ({nb_tracks} tracks)\")\nax.plot(\n (x0, x0, x1, x1, x0),\n (y0, y1, y1, y0, y0),\n color=\"green\",\n lw=1.5,\n label=\"Box of selection\",\n)\nax.legend()"
83+
"fig = plt.figure(figsize=(12, 5))\nax = fig.add_axes((0.05, 0.05, 0.9, 0.9))\nax.set_xlim(-1, 9)\nax.set_ylim(36, 40)\nax.set_aspect(\"equal\")\nax.grid()\nc.plot(ax, color=\"gray\", lw=0.1, ref=-10, label=\"All tracks ({nb_tracks} tracks)\")\nc_subset.plot(\n ax, color=\"red\", lw=0.2, ref=-10, label=\"selected tracks ({nb_tracks} tracks)\"\n)\nax.plot(\n (x0, x0, x1, x1, x0),\n (y0, y1, y1, y0, y0),\n color=\"green\",\n lw=1.5,\n label=\"Box of selection\",\n)\nax.legend()"
8484
]
8585
}
8686
],

notebooks/python_module/10_tracking_diagnostics/pet_center_count.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-
"\n# Count center\n\nDo Geo stat with center and compare with frequency method show: `sphx_glr_python_module_10_tracking_diagnostics_pet_pixel_used.py`\n"
18+
"\n# Count center\n\nDo Geo stat with center and compare with frequency method\nshow: `sphx_glr_python_module_10_tracking_diagnostics_pet_pixel_used.py`\n"
1919
]
2020
},
2121
{

notebooks/python_module/10_tracking_diagnostics/pet_pixel_used.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-
"\n# Count pixel used\n\nDo Geo stat with frequency and compare with center count method: `sphx_glr_python_module_10_tracking_diagnostics_pet_center_count.py`\n"
18+
"\n# Count pixel used\n\nDo Geo stat with frequency and compare with center count\nmethod: `sphx_glr_python_module_10_tracking_diagnostics_pet_center_count.py`\n"
1919
]
2020
},
2121
{

0 commit comments

Comments
 (0)