66from numpy import ma
77
88import py_eddy_tracker .gui
9- from py_eddy_tracker .data import get_path
9+ from py_eddy_tracker .data import get_remote_sample
1010from py_eddy_tracker .observations .network import NetworkObservations
1111
12- n = NetworkObservations .load_file (get_path ("Anticyclonic_seg.nc" ))
12+ n = NetworkObservations .load_file (
13+ get_remote_sample (
14+ "eddies_med_adt_allsat_dt2018_err70_filt500_order1/Anticyclonic_network.nc"
15+ )
16+ )
1317# %%
1418# Parameters
1519step = 1 / 10.0
1620bins = ((- 10 , 37 , step ), (30 , 46 , step ))
1721kw_time = dict (cmap = "terrain_r" , factor = 100.0 / n .nb_days , name = "count" )
18- kw_ratio = dict (cmap = plt .get_cmap ("viridis " , 10 ))
22+ kw_ratio = dict (cmap = plt .get_cmap ("YlGnBu_r " , 10 ))
1923
2024
2125# %%
@@ -57,19 +61,17 @@ def update_axes(ax, mappable=None):
5761update_axes (ax , m ).set_label ("Pixel used in % of time" )
5862
5963# %%
60- # Display the ratio between the short and total presence.
61- #
62- # Light = mostly short networks
63- ax = start_axes ("" )
64- m = g_10 .display (
65- ax ,
66- ** kw_ratio ,
67- vmin = 50 ,
68- vmax = 100 ,
69- name = g_10 .vars ["count" ] * 100.0 / g_all .vars ["count" ]
70- )
64+ # Ratio
65+ # ^^^^^
66+ # Ratio between the longer and total presence
67+ ax = start_axes ("" )
68+ g_ = g_10 .vars ["count" ] * 100.0 / g_all .vars ["count" ]
69+ m = g_10 .display (ax , ** kw_ratio , vmin = 50 , vmax = 100 , name = g_ )
7170update_axes (ax , m ).set_label ("Pixel used in % all atlas" )
71+
7272# %%
73+ # Blue = mostly short networks
74+ #
7375# Network longer than 20 days
7476# ---------------------------
7577# Display the % of time each pixel (1/10°) is within an anticyclonic network
@@ -81,57 +83,34 @@ def update_axes(ax, mappable=None):
8183update_axes (ax , m ).set_label ("Pixel used in % of time" )
8284
8385# %%
84- # Display the ratio between the short and total presence.
85- #
86- # Light = mostly short networks
87- ax = start_axes ("" )
88- m = g_20 .display (
89- ax ,
90- ** kw_ratio ,
91- vmin = 50 ,
92- vmax = 100 ,
93- name = g_20 .vars ["count" ] * 100.0 / g_all .vars ["count" ]
94- )
86+ # Ratio
87+ # ^^^^^
88+ # Ratio between the longer and total presence
89+ ax = start_axes ("" )
90+ g_ = g_20 .vars ["count" ] * 100.0 / g_all .vars ["count" ]
91+ m = g_20 .display (ax , ** kw_ratio , vmin = 50 , vmax = 100 , name = g_ )
9592update_axes (ax , m ).set_label ("Pixel used in % all atlas" )
9693
9794# %%
98- # Display the ratio between the short and total presence.
99- #
100- # Light = mostly short networks
101- #
102- # Networks shorter than 365 days are masked
103- ax = start_axes ("" )
104- m = g_20 .display (
105- ax ,
106- ** kw_ratio ,
107- vmin = 50 ,
108- vmax = 100 ,
109- name = ma .array (
110- g_20 .vars ["count" ] * 100.0 / g_all .vars ["count" ], mask = g_all .vars ["count" ] < 365
111- )
95+ # Now we will hide pixel which are used less than 365 times
96+ g_ = ma .array (
97+ g_20 .vars ["count" ] * 100.0 / g_all .vars ["count" ], mask = g_all .vars ["count" ] < 365
11298)
99+ ax = start_axes ("" )
100+ m = g_20 .display (ax , ** kw_ratio , vmin = 50 , vmax = 100 , name = g_ )
113101update_axes (ax , m ).set_label ("Pixel used in % all atlas" )
114102# %%
115- # Display the ratio between the short and total presence.
116- #
117- # Networks longer than 365 days are masked
118- #
119- # # -> Coastal areas are mostly populated by short networks
120- ax = start_axes ("" )
121- m = g_20 .display (
122- ax ,
123- ** kw_ratio ,
124- vmin = 50 ,
125- vmax = 100 ,
126- name = ma .array (
127- g_20 .vars ["count" ] * 100.0 / g_all .vars ["count" ],
128- mask = g_all .vars ["count" ] >= 365 ,
129- )
103+ # Now we will hide pixel which are used more than 365 times
104+ ax = start_axes ("" )
105+ g_ = ma .array (
106+ g_20 .vars ["count" ] * 100.0 / g_all .vars ["count" ], mask = g_all .vars ["count" ] >= 365
130107)
108+ m = g_20 .display (ax , ** kw_ratio , vmin = 50 , vmax = 100 , name = g_ )
131109update_axes (ax , m ).set_label ("Pixel used in % all atlas" )
132110
133-
134111# %%
112+ # Coastal areas are mostly populated by short networks
113+ #
135114# All merging
136115# -----------
137116# Display the occurence of merging events
@@ -143,18 +122,13 @@ def update_axes(ax, mappable=None):
143122# %%
144123# Ratio merging events / eddy presence
145124ax = start_axes ("" )
146- m = g_all_merging .display (
147- ax ,
148- ** kw_ratio ,
149- vmin = 0 ,
150- vmax = 5 ,
151- name = g_all_merging .vars ["count" ] * 100.0 / g_all .vars ["count" ]
152- )
125+ g_ = g_all_merging .vars ["count" ] * 100.0 / g_all .vars ["count" ]
126+ m = g_all_merging .display (ax , ** kw_ratio , vmin = 0 , vmax = 5 , name = g_ )
153127update_axes (ax , m ).set_label ("Pixel used in % all atlas" )
154128
155129# %%
156- # Merging in networks longer than 10 days, with dead end remove (shorter than 5 days )
157- # -----------------------------------------------------------------------------------
130+ # Merging in networks longer than 10 days, with dead end remove (shorter than 10 observations )
131+ # --------------------------------------------------------------------------------------------
158132ax = start_axes ("" )
159133merger = n10 .remove_dead_end (nobs = 10 ).merging_event ()
160134g_10_merging = merger .grid_count (bins )
@@ -170,17 +144,13 @@ def update_axes(ax, mappable=None):
170144m = g_10_merging .display (ax , ** kw_time , vmin = 0 , vmax = 1 )
171145update_axes (ax , m ).set_label ("Pixel used in % of time" )
172146# %%
147+ # Ratio merging events / eddy presence
173148ax = start_axes ("" )
174- m = g_10_merging .display (
175- ax ,
176- ** kw_ratio ,
177- vmin = 0 ,
178- vmax = 5 ,
179- name = ma .array (
180- g_10_merging .vars ["count" ] * 100.0 / g_10 .vars ["count" ],
181- mask = g_10 .vars ["count" ] < 365 ,
182- )
149+ g_ = ma .array (
150+ g_10_merging .vars ["count" ] * 100.0 / g_10 .vars ["count" ],
151+ mask = g_10 .vars ["count" ] < 365 ,
183152)
153+ m = g_10_merging .display (ax , ** kw_ratio , vmin = 0 , vmax = 5 , name = g_ )
184154update_axes (ax , m ).set_label ("Pixel used in % all atlas" )
185155
186156# %%
@@ -193,15 +163,10 @@ def update_axes(ax, mappable=None):
193163update_axes (ax , m ).set_label ("Pixel used in % of time" )
194164
195165# %%
196- # Ratio merging events / eddy presence
166+ # Ratio spliting events / eddy presence
197167ax = start_axes ("" )
198- m = g_all_spliting .display (
199- ax ,
200- ** kw_ratio ,
201- vmin = 0 ,
202- vmax = 5 ,
203- name = g_all_spliting .vars ["count" ] * 100.0 / g_all .vars ["count" ]
204- )
168+ g_ = g_all_spliting .vars ["count" ] * 100.0 / g_all .vars ["count" ]
169+ m = g_all_spliting .display (ax , ** kw_ratio , vmin = 0 , vmax = 5 , name = g_ )
205170update_axes (ax , m ).set_label ("Pixel used in % all atlas" )
206171
207172# %%
@@ -213,14 +178,9 @@ def update_axes(ax, mappable=None):
213178update_axes (ax , m ).set_label ("Pixel used in % of time" )
214179# %%
215180ax = start_axes ("" )
216- m = g_10_spliting .display (
217- ax ,
218- ** kw_ratio ,
219- vmin = 0 ,
220- vmax = 5 ,
221- name = ma .array (
222- g_10_spliting .vars ["count" ] * 100.0 / g_10 .vars ["count" ],
223- mask = g_10 .vars ["count" ] < 365 ,
224- )
181+ g_ = ma .array (
182+ g_10_spliting .vars ["count" ] * 100.0 / g_10 .vars ["count" ],
183+ mask = g_10 .vars ["count" ] < 365 ,
225184)
185+ m = g_10_spliting .display (ax , ** kw_ratio , vmin = 0 , vmax = 5 , name = g_ )
226186update_axes (ax , m ).set_label ("Pixel used in % all atlas" )
0 commit comments