py-eddy-tracker
py-eddy-tracker copied to clipboard
an issue with extracting westward trajectories
Hello, I've been trying to extract westward eddy trajectories with a longitude span over 10 degrees, but it ends up extracting those with a span between -10.0 and 0.0(-10.0 ≤ delta_lon ≤ 0.0), so I took a look at the source code and noticed that there might be something causing the issue:
https://github.com/AntSimi/py-eddy-tracker/blob/3a54bbb6e50ebc38dcb334539dcb5b456a408127/src/py_eddy_tracker/observations/tracking.py#L366-L385
my settings:
c.extract_toward_direction(west=True, delta_lon= -10.0)
# let lon[i1] = -40.0, lon[i0] = -20.0
d_lon = lon[i1] - lon[i0]
# d_lon = -20.0
m = d_lon < 0 if west else d_lon > 0
# west = True, d_lon < 0 = True, m = True
if delta_lon is not None:
# True
m *= delta_lon < d_lon
# delta_lon < dlon = False, m= 0
m = m.repeat(nb)
# nb of points masked
return self.extract_with_mask(m)
an alternative approach might be:
if delta_lon is not None:
m *= abs(delta_lon) < abs(d_lon)
Best wishes, lolcat