File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed
src/py_eddy_tracker/observations Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -124,4 +124,29 @@ def insert_virtual(self):
124
124
new_TEO .filled_by_interpolation (mask )
125
125
new_TEO .virtual [:] = mask
126
126
new_TEO .fix_next_previous_obs ()
127
- return new_TEO
127
+ return new_TEO
128
+
129
+ def keep_tracks_by_date (self , date , nb_days ):
130
+ """
131
+ find tracks which exist at date `date` and lasted at least `nb_days` after.
132
+
133
+ if nb_days is negative, it search a tracks which exist at the date,
134
+ but existed at least `nb_days` before the date
135
+
136
+
137
+ :param int,float date : date where the tracks must exist
138
+ :param int,float nb_days: number of time where the tracks must exist. Can be negative
139
+
140
+ """
141
+
142
+ time = self .time
143
+
144
+ mask = zeros (time .shape , dtype = bool )
145
+
146
+ for i , b0 , b1 in self .iter_on (self .tracks ):
147
+ _time = time [i ]
148
+
149
+ if date in _time and (date + nb_days ) in _time :
150
+ mask [i ] = True
151
+
152
+ return self .extract_with_mask (mask )
You can’t perform that action at this time.
0 commit comments