tobac
tobac copied to clipboard
Consolidate distance calculation functions
We currently have two functions in the tobac v1.5.0 release candidate for calculating the distances between two sets of coordinates:
https://github.com/tobac-project/tobac/blob/ce390a36e40fe330e59a7c03ad6d02d77e54e812/tobac/utils/internal.py#L540-L564
Is used in feature_detection and segmentation, and only handles cartesian distances
https://github.com/tobac-project/tobac/blob/ce390a36e40fe330e59a7c03ad6d02d77e54e812/tobac/analysis.py#L467-L536
Is used in analysis and can either calculate cartesian or haversine distances
It would be good to consolidate these two functions so that we have a single core method for calculating distances that is consistent across tobac. The two functions do differ slightly in usage so I'll have to look into to make sure there aren't any major issues.
This is a fairly minor issue, but it would be nice to include as part of the fix for #230 . I'd also like to shift from using Haversine to Proj for calculating distances between lat/lon coordinates, both for accuracy and reliability