Commit 521b076f authored by Joseph Siddons's avatar Joseph Siddons
Browse files

Merge branch 'missing_distance' into 'main'

Missing distance

See merge request !12
parents fa9fc2fa 05912281
......@@ -80,6 +80,15 @@ class SpaceTimeRecord:
and (not (self.uid or other.uid) or self.uid == other.uid)
)
def distance(self, other: object) -> float:
"""
Compute the Haversine distance to another SpaceTimeRecord.
Only computes spatial distance.
"""
if not isinstance(other, SpaceTimeRecord):
raise TypeError("Argument other must be an instance of Record")
return haversine(self.lon, self.lat, other.lon, other.lat)
class SpaceTimeRecords(List[SpaceTimeRecord]):
"""List of SpaceTimeRecords"""
......
......@@ -101,4 +101,4 @@ scipy = "sp"
xarray = "xr"
[project.urls]
Repository = "https://git.noc.ac.uk/josidd/geospatialtools"
Repository = "https://git.noc.ac.uk/nocsurfaceprocesses/geospatialtools"
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment