UXARRAY / uxarray

Xarray-styled package for reading and directly operating on unstructured grid datasets following UGRID conventions
https://uxarray.readthedocs.io/
Apache License 2.0
139 stars 30 forks source link

great circle distance function #812

Open rajeeja opened 3 weeks ago

rajeeja commented 3 weeks ago

Proposed new feature or change:

Add a function to get the distance between two points on a shpere.

I was hoping this is already implemented, but couldn't find it. Is it there? @hongyuchen1030

rajeeja commented 3 weeks ago

@philipc2 this is closest: https://github.com/UXARRAY/uxarray/blob/main/uxarray/grid/neighbors.py#L870

hongyuchen1030 commented 3 weeks ago

since it's a great circle arc on a unit sphere, the "distance" is the angle between the two endpoints, which can be easily be calculated using def _angle_of_2_vectors(u, v):