{"id":24620,"library":"spherical-geometry","title":"spherical-geometry","description":"Python tools for spherical geometry, providing vectorized operations on the sphere using NumPy. Current version 1.4.0, released approximately monthly.","status":"active","version":"1.4.0","language":"python","source_language":"en","source_url":"https://github.com/spacetelescope/spherical_geometry","tags":["spherical geometry","astronomy","great circle","arc"],"install":[{"cmd":"pip install spherical-geometry","lang":"bash","label":"pip install"}],"dependencies":[{"reason":"Required for vectorized operations on arrays of points.","package":"numpy","optional":false}],"imports":[{"note":"Arc is available at package level since v1.4.0; previous location was deprecated.","wrong":"from spherical_geometry.polygon import Arc","symbol":"Arc","correct":"from spherical_geometry import Arc"},{"note":"GreatCircle is exported at the package level; direct module import may break.","wrong":"from spherical_geometry.great_circle import GreatCircle","symbol":"GreatCircle","correct":"from spherical_geometry import GreatCircle"}],"quickstart":{"code":"from spherical_geometry import Arc, GreatCircle\n\n# Define two points on the sphere (longitude, latitude in radians)\npoint_a = (0.0, 0.0)\npoint_b = (1.0, 0.5)\n\n# Create a great circle arc\narc = Arc(point_a, point_b)\nprint(f\"Arc length: {arc.length()}\")\n\n# Compute intersection of two great circles\ngc1 = GreatCircle(point_a, point_b)\ngc2 = GreatCircle((0.5, 0.2), (1.2, 0.8))\nintersections = gc1.intersections(gc2)\nprint(f\"Intersection points: {intersections}\")","lang":"python","description":"Basic usage of Arc and GreatCircle for spherical geometry calculations."},"warnings":[{"fix":"Use `from spherical_geometry import Arc, GreatCircle` instead of `from spherical_geometry.polygon import Arc` or `from spherical_geometry.great_circle import GreatCircle`.","message":"In version 1.4.0, the import paths for Arc and GreatCircle changed. Previously they were in submodules; now they are exported at the top-level package. Code using old imports will fail.","severity":"breaking","affected_versions":">=1.4.0"},{"fix":"Convert degrees to radians using `math.radians()` or `numpy.radians()` before passing to functions.","message":"All angular coordinates (longitude, latitude) must be in radians, not degrees. The library does not perform conversion, and passing degrees will give incorrect results.","severity":"gotcha","affected_versions":"all"},{"fix":"Use top-level imports as shown in the quickstart.","message":"The `spherical_geometry.polygon` module is deprecated as of 1.4.0. Its contents have been moved to the top-level package.","severity":"deprecated","affected_versions":"1.4.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Upgrade to version 1.4.0+ (`pip install --upgrade spherical-geometry`) and use `from spherical_geometry import Arc`.","cause":"Using an older version (<1.4.0) where Arc was not exported at package level, or importing incorrectly.","error":"AttributeError: module 'spherical_geometry' has no attribute 'Arc'"},{"fix":"Convert lon, lat to radians using `math.radians()` or `numpy.radians()` before passing to spherical_geometry functions.","cause":"Passing coordinates in degrees instead of radians.","error":"ValueError: All points must be in radians"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}