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