Commit 05912281 authored by Joseph Siddons's avatar Joseph Siddons
Browse files

feat: add missing spatial distance method to SpaceTimeRecord class

......@@ -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"""
......
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