uxarray icon indicating copy to clipboard operation
uxarray copied to clipboard

great circle distance function

Open rajeeja opened this issue 1 year ago • 2 comments
trafficstars

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 avatar Jun 11 '24 20:06 rajeeja

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

rajeeja avatar Jun 11 '24 21:06 rajeeja

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):

hongyuchen1030 avatar Jun 11 '24 21:06 hongyuchen1030

@rajeeja @aaronzedwick

Can you check if we can close this?

philipc2 avatar Mar 18 '25 20:03 philipc2

@rajeeja @aaronzedwick

Can you check if we can close this?

utils has this function Calculate the angle between two 3D vectors u and v in radians. Can be used to calculate the span of a GCR.

rajeeja avatar Mar 19 '25 17:03 rajeeja