Skip to content

Commit ea64ae7

Browse files
committed
Change label format
1 parent d7eefe0 commit ea64ae7

35 files changed

+102
-61
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616
- Add method to inspect contour rejection (which are not in eddies)
1717
- Grid interp could be "nearest" or "bilinear"
1818
### Changed
19-
19+
- Now to have object informations in plot label used python ```fomat``` style, several key are available :
20+
- "t0"
21+
- "t1"
22+
- "nb_obs"
23+
- "nb_tracks" (only for tracked eddies)
2024
### Removed
2125

2226

examples/02_eddy_identification/pet_display_id.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
ax.set_aspect("equal")
3636
ax.set_xlim(0, 360)
3737
ax.set_ylim(-80, 80)
38-
a.display(ax, label="Anticyclonic", color="r", lw=1)
39-
c.display(ax, label="Cyclonic", color="b", lw=1)
38+
a.display(ax, label="Anticyclonic ({nb_obs} eddies)", color="r", lw=1)
39+
c.display(ax, label="Cyclonic ({nb_obs} eddies)", color="b", lw=1)
4040
ax.legend(loc="upper right")
4141

4242
# %%

examples/02_eddy_identification/pet_eddy_detection.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,10 @@ def update_axes(ax, mappable=None):
133133
# the maximum mean speed. See figure 1 of https://doi.org/10.1175/JTECH-D-14-00019.1
134134

135135
ax = start_axes("Detected Eddies")
136-
a.display(ax, color="r", linewidth=0.75, label="Anticyclonic", ref=-10)
137-
c.display(ax, color="b", linewidth=0.75, label="Cyclonic", ref=-10)
136+
a.display(
137+
ax, color="r", linewidth=0.75, label="Anticyclonic ({nb_obs} eddies)", ref=-10
138+
)
139+
c.display(ax, color="b", linewidth=0.75, label="Cyclonic ({nb_obs} eddies)", ref=-10)
138140
ax.legend()
139141
update_axes(ax)
140142

examples/02_eddy_identification/pet_eddy_detection_gulf_stream.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,10 @@ def update_axes(ax, mappable=None):
143143
# maximum mean speed. See figure 1 of https://doi.org/10.1175/JTECH-D-14-00019.1
144144

145145
ax = start_axes("Eddies detected")
146-
a.display(ax, color="r", linewidth=0.75, label="Anticyclonic", ref=-10)
147-
c.display(ax, color="b", linewidth=0.75, label="Cyclonic", ref=-10)
146+
a.display(
147+
ax, color="r", linewidth=0.75, label="Anticyclonic ({nb_obs} eddies)", ref=-10
148+
)
149+
c.display(ax, color="b", linewidth=0.75, label="Cyclonic ({nb_obs} eddies)", ref=-10)
148150
ax.legend()
149151
great_current.display(ax, color="k")
150152
update_axes(ax)

examples/02_eddy_identification/pet_filter_and_detection.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,16 @@ def update_axes(ax, mappable=None):
5252
# Display the two detections
5353
ax = start_axes("Eddies detected over ADT")
5454
m = g.display(ax, "adt", vmin=-0.15, vmax=0.15)
55-
merge_f.display(ax, lw=0.75, label="Eddies in the filtered grid", ref=-10, color="k")
56-
merge_t.display(ax, lw=0.75, label="Eddies without filter", ref=-10, color="r")
55+
merge_f.display(
56+
ax,
57+
lw=0.75,
58+
label="Eddies in the filtered grid ({nb_obs} eddies)",
59+
ref=-10,
60+
color="k",
61+
)
62+
merge_t.display(
63+
ax, lw=0.75, label="Eddies without filter ({nb_obs} eddies)", ref=-10, color="r"
64+
)
5765
ax.legend()
5866
update_axes(ax, m)
5967

examples/02_eddy_identification/pet_interp_grid_on_dataset.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ def update_axes(ax, mappable=None):
5656
# Get mean of eke in each effective contour
5757

5858
ax = start_axes("EKE mean (cm²/s²)")
59-
a.display(ax, color="r", linewidth=0.5, label="Anticyclonic", ref=-10)
60-
c.display(ax, color="b", linewidth=0.5, label="Cyclonic", ref=-10)
59+
a.display(ax, color="r", linewidth=0.5, label="Anticyclonic ({nb_obs} eddies)", ref=-10)
60+
c.display(ax, color="b", linewidth=0.5, label="Cyclonic ({nb_obs} eddies)", ref=-10)
6161
eke = a.interp_grid(aviso_map, "eke", method="mean", intern=False)
6262
a.filled(ax, eke, ref=-10, **eke_kwargs)
6363
eke = c.interp_grid(aviso_map, "eke", method="mean", intern=False)

examples/02_eddy_identification/pet_sla_and_adt.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,14 @@ def update_axes(ax, mappable=None):
4343
date = datetime(2016, 5, 15)
4444

4545
# %%
46-
kwargs_a_adt = dict(lw=0.5, label="Anticyclonic ADT", ref=-10, color="k")
47-
kwargs_c_adt = dict(lw=0.5, label="Cyclonic ADT", ref=-10, color="r")
48-
kwargs_a_sla = dict(lw=0.5, label="Anticyclonic SLA", ref=-10, color="g")
49-
kwargs_c_sla = dict(lw=0.5, label="Cyclonic SLA", ref=-10, color="b")
46+
kwargs_a_adt = dict(
47+
lw=0.5, label="Anticyclonic ADT ({nb_obs} eddies)", ref=-10, color="k"
48+
)
49+
kwargs_c_adt = dict(lw=0.5, label="Cyclonic ADT ({nb_obs} eddies)", ref=-10, color="r")
50+
kwargs_a_sla = dict(
51+
lw=0.5, label="Anticyclonic SLA ({nb_obs} eddies)", ref=-10, color="g"
52+
)
53+
kwargs_c_sla = dict(lw=0.5, label="Cyclonic SLA ({nb_obs} eddies)", ref=-10, color="b")
5054

5155
# %%
5256
# Run algorithm of detection

examples/08_tracking_manipulation/pet_display_track.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
ax = fig.add_axes((0.05, 0.1, 0.9, 0.9))
3737
ax.set_aspect("equal")
3838
ax.set_xlim(-6, 36.5), ax.set_ylim(30, 46)
39-
a.plot(ax, ref=-10, label="Anticyclonic", color="r", lw=0.1)
40-
c.plot(ax, ref=-10, label="Cyclonic", color="b", lw=0.1)
39+
a.plot(ax, ref=-10, label="Anticyclonic ({nb_tracks} tracks)", color="r", lw=0.1)
40+
c.plot(ax, ref=-10, label="Cyclonic ({nb_tracks} tracks)", color="b", lw=0.1)
4141
ax.legend()
4242
ax.grid()

examples/08_tracking_manipulation/pet_one_track.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@
3636
ax.grid()
3737
eddy.plot(ax, color="r", lw=0.5, label="track")
3838
eddy.index(range(0, len(eddy), 40)).display(
39-
ax, intern_only=True, label="observations every 40"
39+
ax, intern_only=True, label="observations every 40 days"
4040
)
4141
ax.legend()

examples/08_tracking_manipulation/pet_select_track_across_area.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@
2929
ax.set_ylim(36, 40)
3030
ax.set_aspect("equal")
3131
ax.grid()
32-
c.plot(ax, color="gray", lw=0.1, ref=-10, label="all tracks")
33-
c_subset.plot(ax, color="red", lw=0.2, ref=-10, label="selected tracks")
32+
c.plot(ax, color="gray", lw=0.1, ref=-10, label="All tracks ({nb_tracks} tracks)")
33+
c_subset.plot(
34+
ax, color="red", lw=0.2, ref=-10, label="selected tracks ({nb_tracks} tracks)"
35+
)
3436
ax.plot(
3537
(x0, x0, x1, x1, x0),
3638
(y0, y1, y1, y0, y0),

0 commit comments

Comments
 (0)