{"library":"sgp4","title":"SGP4 Satellite Orbit Propagator","description":"The `sgp4` Python library provides a highly accurate implementation of the SGP4 and SDP4 orbital propagation algorithms, as described in the 2020 revision of the Spacetrack Report #3. It allows users to track Earth satellites given their Two-Line Element (TLE) data, predicting their position and velocity at specific times. The library is actively maintained, with version 2.25 being the latest, and typically sees several releases per year addressing minor bugs and precision improvements.","language":"python","status":"active","last_verified":"Fri May 15","install":{"commands":["pip install sgp4"],"cli":null},"imports":["from sgp4.api import Satrec","from sgp4.api import WGS72","from sgp4.api import jday_from_datetime"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from datetime import datetime, timezone\nfrom sgp4.api import Satrec\n\n# Example TLE for NOAA 15 (valid for a specific epoch)\n# Use actual current TLE data for real-world applications\ntle_line1 = '1 25338U 98030A   23098.50000000  .00000000  00000-0  57606-2 0  9994'\ntle_line2 = '2 25338  98.7402  65.3400 0001000  90.0000  270.0000 14.28000000000000'\n\n# Parse the TLE data into a Satrec object\nsatellite = Satrec.twoline2_parse(tle_line1, tle_line2)\n\n# Define the time for propagation (example: April 8, 2023, 12:00:00 UTC)\n# SGP4 expects naive UTC datetimes or Julian dates.\nprop_time = datetime(2023, 4, 8, 12, 0, 0, tzinfo=timezone.utc).replace(tzinfo=None)\n\n# Propagate the satellite to the specified time\n# The sgp4 method returns (error_code, position_km, velocity_km_s)\ne, r, v = satellite.sgp4(\n    prop_time.year, prop_time.month, prop_time.day,\n    prop_time.hour, prop_time.minute, prop_time.second + prop_time.microsecond / 1_000_000\n)\n\nif e == 0:\n    print(f\"Satellite ID: {satellite.satnum}\")\n    print(f\"Propagation time: {prop_time} UTC\")\n    print(f\"Position (km, ECI): {r}\")\n    print(f\"Velocity (km/s, ECI): {v}\")\nelse:\n    print(f\"SGP4 error code: {e}. Check TLE validity or propagation time range.\")","lang":"python","description":"This quickstart demonstrates how to parse Two-Line Element (TLE) data for a satellite, define a specific propagation time in UTC, and then use the `sgp4` method of the `Satrec` object to calculate the satellite's Earth-Centered Inertial (ECI) position and velocity. The output units are kilometers and kilometers per second.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-15","installed_version":"2.25","pypi_latest":"2.25","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":1.6,"avg_import_s":0.01,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"sgp4","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.01,"mem_mb":0.7,"disk_size":"18.4M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"sgp4","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.6,"import_time_s":0,"mem_mb":0.1,"disk_size":"19M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"sgp4","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.01,"mem_mb":0.8,"disk_size":"20.2M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"sgp4","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.7,"import_time_s":0,"mem_mb":0.1,"disk_size":"21M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"sgp4","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.01,"mem_mb":0.3,"disk_size":"12.1M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"sgp4","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.5,"import_time_s":0,"mem_mb":0.1,"disk_size":"13M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"sgp4","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.01,"mem_mb":0.5,"disk_size":"11.9M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"sgp4","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.5,"import_time_s":0,"mem_mb":0.1,"disk_size":"13M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"sgp4","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.01,"mem_mb":0.7,"disk_size":"17.9M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"sgp4","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.8,"import_time_s":0,"mem_mb":0.1,"disk_size":"19M"}]}}