|
19 | 19 | e.lon[:] = (e.lon + 180) % 360 - 180
|
20 | 20 | e.contour_lon_e[:] = ((e.contour_lon_e.T - e.lon + 180) % 360 - 180 + e.lon).T
|
21 | 21 | e.contour_lon_s[:] = ((e.contour_lon_s.T - e.lon + 180) % 360 - 180 + e.lon).T
|
22 |
| -############## |
| 22 | +# %% |
| 23 | +# Do segmentation |
| 24 | +# --------------- |
| 25 | +# Segmentation based on maximum overlap, temporal window for candidates = 5 days |
23 | 26 | n = NetworkObservations.from_split_network(e, e.split_network(intern=False, window=5))
|
24 | 27 |
|
25 | 28 | # %%
|
26 | 29 | # Timeline
|
27 | 30 | # --------
|
28 | 31 |
|
29 | 32 | # %%
|
30 |
| -# Display timeline |
| 33 | +# Display timeline with events |
| 34 | +# A segment generated by a splitting is marked with a star |
| 35 | +# A segment merging in another is marked with an exagon |
31 | 36 | fig = plt.figure(figsize=(15, 5))
|
32 | 37 | ax = fig.add_axes([0.04, 0.04, 0.92, 0.92])
|
33 | 38 | _ = n.display_timeline(ax)
|
|
39 | 44 | _ = n.display_timeline(ax, event=False)
|
40 | 45 |
|
41 | 46 | # %%
|
42 |
| -# Timeline by latitude mean |
| 47 | +# Timeline by mean latitude |
43 | 48 | # -------------------------
|
| 49 | +# Display timeline with the mean latitude of the segments in yaxis |
44 | 50 | fig = plt.figure(figsize=(15, 5))
|
45 | 51 | ax = fig.add_axes([0.04, 0.04, 0.92, 0.92])
|
| 52 | +ax.set_ylabel("Latitude") |
46 | 53 | _ = n.display_timeline(ax, field="latitude")
|
47 | 54 |
|
48 | 55 | # %%
|
49 |
| -# Timeline by radius mean |
| 56 | +# Timeline by mean Effective Radius |
50 | 57 | # -----------------------
|
| 58 | +# The factor argument is applied on the chosen field |
51 | 59 | fig = plt.figure(figsize=(15, 5))
|
52 | 60 | ax = fig.add_axes([0.04, 0.04, 0.92, 0.92])
|
53 |
| -_ = n.display_timeline(ax, field="radius_e") |
| 61 | +ax.set_ylabel("Effective Radius (km)") |
| 62 | +_ = n.display_timeline(ax, field="radius_e", factor=1e-3) |
54 | 63 |
|
55 | 64 | # %%
|
56 | 65 | # Timeline by latitude
|
57 | 66 | # --------------------
|
| 67 | +# Use `method="all"` to display the consecutive values of the field |
58 | 68 | fig = plt.figure(figsize=(15, 5))
|
59 | 69 | ax = fig.add_axes([0.04, 0.05, 0.92, 0.92])
|
| 70 | +ax.set_ylabel("Latitude") |
60 | 71 | _ = n.display_timeline(ax, field="lat", method="all")
|
61 | 72 |
|
62 | 73 | # %%
|
| 74 | +# You can filter the data, here with a time window of 15 days |
63 | 75 | fig = plt.figure(figsize=(15, 5))
|
64 | 76 | ax = fig.add_axes([0.04, 0.05, 0.92, 0.92])
|
65 | 77 | n_copy = n.copy()
|
|
69 | 81 | # %%
|
70 | 82 | # Parameters timeline
|
71 | 83 | # -------------------
|
| 84 | +# Scatter is usefull to display the parameters' temporal evolution |
| 85 | +# Effective Radius and Amplitude |
72 | 86 | kw = dict(s=25, cmap="Spectral_r", zorder=10)
|
73 | 87 | fig = plt.figure(figsize=(15, 8))
|
74 | 88 | ax = fig.add_axes([0.04, 0.54, 0.90, 0.44])
|
|
86 | 100 | cb.set_label("Amplitude (cm)")
|
87 | 101 |
|
88 | 102 | # %%
|
| 103 | +# Speed |
89 | 104 | fig = plt.figure(figsize=(15, 5))
|
90 | 105 | ax = fig.add_axes([0.04, 0.06, 0.90, 0.88])
|
91 | 106 | m = n.scatter_timeline(ax, "speed_average", factor=100, vmin=0, vmax=40, **kw)
|
|
95 | 110 | cb.set_label("Maximum speed (cm/s)")
|
96 | 111 |
|
97 | 112 | # %%
|
| 113 | +# Speed Radius |
98 | 114 | fig = plt.figure(figsize=(15, 5))
|
99 | 115 | ax = fig.add_axes([0.04, 0.06, 0.90, 0.88])
|
100 | 116 | m = n.scatter_timeline(ax, "radius_s", factor=1e-3, vmin=20, vmax=100, **kw)
|
|
106 | 122 | # %%
|
107 | 123 | # Remove dead branch
|
108 | 124 | # ------------------
|
109 |
| -# Remove all tiny segment with less than N obs which didn't join two segments |
| 125 | +# Remove all tiny segments with less than N obs which didn't join two segments |
| 126 | +# |
| 127 | +# .. warning:: |
| 128 | +# Must be explore, no solution to solve all the case |
110 | 129 |
|
111 | 130 | n_clean = n.remove_dead_end(nobs=10)
|
112 | 131 | fig = plt.figure(figsize=(15, 8))
|
|
120 | 139 | # %%
|
121 | 140 | # Keep close relative
|
122 | 141 | # -------------------
|
| 142 | +# When you want to investigate one particular observation and select only the closest segments |
123 | 143 | # First choose an observation in the network
|
124 | 144 | fig = plt.figure(figsize=(15, 5))
|
125 | 145 | ax = fig.add_axes([0.04, 0.06, 0.90, 0.88])
|
|
130 | 150 | _ = ax.plot(*obs_args, **obs_kw)
|
131 | 151 |
|
132 | 152 | # %%
|
| 153 | +# Colors show the relative order of the segment with regards to the chosen one |
133 | 154 | fig = plt.figure(figsize=(15, 5))
|
134 | 155 | ax = fig.add_axes([0.04, 0.06, 0.90, 0.88])
|
135 | 156 | m = n.scatter_timeline(
|
|
141 | 162 | )
|
142 | 163 | cb.set_label("Relative order")
|
143 | 164 | # %%
|
| 165 | +# You want to keep only the segments at the order 1 |
144 | 166 | fig = plt.figure(figsize=(15, 5))
|
145 | 167 | ax = fig.add_axes([0.04, 0.06, 0.90, 0.88])
|
146 | 168 | close_to_i1 = n.relative(i, order=1)
|
147 | 169 | ax.set_title(f"Close segments ({close_to_i1.infos()})")
|
148 | 170 | _ = close_to_i1.display_timeline(ax)
|
149 | 171 | # %%
|
| 172 | +# You want to keep the segments until order 2 |
150 | 173 | fig = plt.figure(figsize=(15, 5))
|
151 | 174 | ax = fig.add_axes([0.04, 0.06, 0.90, 0.88])
|
152 | 175 | close_to_i2 = n.relative(i, order=2)
|
153 | 176 | ax.set_title(f"Close segments ({close_to_i2.infos()})")
|
154 | 177 | _ = close_to_i2.display_timeline(ax)
|
155 | 178 | # %%
|
| 179 | +# You want to keep the segments until order 3 |
156 | 180 | fig = plt.figure(figsize=(15, 5))
|
157 | 181 | ax = fig.add_axes([0.04, 0.06, 0.90, 0.88])
|
158 | 182 | close_to_i3 = n.relative(i, order=3)
|
|
162 | 186 | # %%
|
163 | 187 | # Display track on map
|
164 | 188 | # --------------------
|
| 189 | +# Only a map can be tricky to understand, with a timeline it's easier! |
165 | 190 | fig = plt.figure(figsize=(15, 8))
|
166 | 191 | ax = fig.add_axes([0.04, 0.06, 0.94, 0.88], projection="full_axes")
|
167 | 192 | close_to_i2.plot(ax, color_cycle=close_to_i2.COLORS)
|
|
173 | 198 | # %%
|
174 | 199 | # Get merging event
|
175 | 200 | # -----------------
|
| 201 | +# Display the position of the eddies after a merging |
176 | 202 | fig = plt.figure(figsize=(15, 8))
|
177 | 203 | ax = fig.add_axes([0.04, 0.06, 0.90, 0.88], projection="full_axes")
|
178 | 204 | merging = close_to_i2.merging_event()
|
|
183 | 209 | # %%
|
184 | 210 | # Get spliting event
|
185 | 211 | # ------------------
|
| 212 | +# Display the position of the eddies before a splitting |
186 | 213 | fig = plt.figure(figsize=(15, 8))
|
187 | 214 | ax = fig.add_axes([0.04, 0.06, 0.90, 0.88], projection="full_axes")
|
188 | 215 | spliting = close_to_i2.spliting_event()
|
|
193 | 220 | # %%
|
194 | 221 | # Get birth event
|
195 | 222 | # ------------------
|
| 223 | +# Display the starting position of non-splitted eddies |
196 | 224 | fig = plt.figure(figsize=(15, 8))
|
197 | 225 | ax = fig.add_axes([0.04, 0.06, 0.90, 0.88], projection="full_axes")
|
198 | 226 | birth = close_to_i2.birth_event()
|
|
203 | 231 | # %%
|
204 | 232 | # Get death event
|
205 | 233 | # ------------------
|
| 234 | +# Display the last position of non-merged eddies |
206 | 235 | fig = plt.figure(figsize=(15, 8))
|
207 | 236 | ax = fig.add_axes([0.04, 0.06, 0.90, 0.88], projection="full_axes")
|
208 | 237 | death = close_to_i2.death_event()
|
|
0 commit comments