Skip to content

Commit 1b2207a

Browse files
committed
add time sub sampling on atlas
1 parent fe3b0bf commit 1b2207a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/py_eddy_tracker/observations/observation.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,6 +1653,16 @@ def extract_with_area(self, area, **kwargs):
16531653
mask *= (lon > lon0) * (lon < area["urcrnrlon"])
16541654
return self.extract_with_mask(mask, **kwargs)
16551655

1656+
def time_sub_sample(self, t0, time_step):
1657+
"""
1658+
Time sub sampling
1659+
1660+
:param int,float t0: reference time which will be keep
1661+
:param int,float time_step: keep every observation spaced by time_step
1662+
"""
1663+
mask = (self.time - t0) % time_step == 0
1664+
return self.extract_with_mask(mask)
1665+
16561666
def extract_with_mask(self, mask):
16571667
"""
16581668
Extract a subset of observations.

0 commit comments

Comments
 (0)