celestial.search - EranOfek/AstroPack GitHub Wiki

Description

The celestial.search package contains functions related to various search requests of points and forms on the sphere.

Functions

  • celestial.search.find_coo - Cone search in a table with spherical coordinates
  • celestial.search.match_coo - Match two lists by spherical coordinates
  • celestial.search.match_coo_nearest - Match two lists by spherical coordinates for nearest source only
  • celestial.search.rectOverlap - Test if spherical rectangles are overlapping/intersecting
  • celestial.search.isPointInsidePolygon - Tell if a point on a sphere falls inside a given spherical polygon

Selected examples:

celestial.search.isPointInsidePolygon

Note: the function will work even if the polygon includes one of the poles, but not both poles at a time. The polygon definition must not be closed, i.e. the first and the last point in the list should not be the same.

# take a polygon defined by its vertices (Lon, Lat) and a point in the same coordinates 
# and test whether the point falls inside the polygon:
Pol = [0, 0; 45, -30; 90, 0; 90, 40; 45, 20; 0, 40];
Pt  = [80, -1];
Result = isPointInsidePolygon(Pt(1), Pt(2), Pol);