Skip to main content

ci

PyPredict

NOTE: To preserve compatibility with predict, pypredict uses north latitude and west longitude for terrestrial coordinates.

Do you want accurate and time-tested satellite tracking and pass prediction in a convenient python wrapper? You're in the right place.

PyPredict is a C Python extension directly adapted from the ubiquitous predict satellite tracking command line application. Originally written for the commodore 64, predict has a proven pedigree; We just aim to provide a convenient API. PyPredict is a port of the predict codebase and should yield identical results.

If you think you've found an error in pypredict, please include output from predict on same inputs to the bug report.
If you think you've found a bug in predict, please report and we'll coordinate with upstream.

Installation

sudo apt-get install python-dev
sudo python setup.py install

Usage

Observe a satellite (relative to a position on earth)

import predict
tle = """0 LEMUR 1
1 40044U 14033AL  15013.74135905  .00002013  00000-0  31503-3 0  6119
2 40044 097.9584 269.2923 0059425 258.2447 101.2095 14.72707190 30443"""
qth = (37.771034, 122.413815, 7)  # lat (N), long (W), alt (meters)
predict.observe(tle, qth) # optional time argument defaults to time.time()
# => {'altitude': 676.8782276657903,
#     'azimuth': 96.04762045174824,
#     'beta_angle': -27.92735429908726,
#     'decayed': 0,
#     'doppler': 1259.6041017128405,
#     'eci_obs_x': -2438.227652191655,
#     'eci_obs_y': -4420.154476060397,
#     'eci_obs_z': 3885.390601342013,
#     'eci_sun_x': 148633398.020844,
#     'eci_sun_y': -7451536.44122029,
#     'eci_sun_z': -3229999.50056359,
#     'eci_vx': 0.20076213530665032,
#     'eci_vy': -1.3282146055077213,
#     'eci_vz': 7.377067234096598,
#     'eci_x': 6045.827328897242,
#     'eci_y': -3540.5885778261277,
#     'eci_z': -825.4065096776636,
#     'eclipse_depth': -87.61858291647795,
#     'elevation': -43.711904591801726,
#     'epoch': 1521290038.347793,
#     'footprint': 5633.548906707907,
#     'geostationary': 0,
#     'has_aos': 1,
#     'latitude': -6.759563817939698,
#     'longitude': 326.1137007912563,
#     'name': '0 LEMUR 1',
#     'norad_id': 40044,
#     'orbit': 20532,
#     'orbital_model': 'SGP4',
#     'orbital_phase': 145.3256815318047,
#     'orbital_velocity': 26994.138671706416,
#     'slant_range': 9743.943478523843,
#     'sunlit': 1,
#     'visibility': 'D'
#    }

Show upcoming transits of satellite over ground station

# start and stop transit times as UNIX timestamp
transit_start = 1680775200
transit_stop = 1681034400

p = predict.transits(tle, qth, transit_start, transit_stop)

print("Start of Transit\tTransit Duration (s)\tPeak Elevation")
for transit in p:
    print(f"{transit.start}\t{transit.duration()}\t{transit.peak()['elevation']}")

Modeling an entire constellation

Generating transits for a lot of satellites over a lot of ground stations can be slow. Luckily, generating transits for each satellite-groundstation pair can be parallelized for a big speed-up.

import itertools
from multiprocessing.pool import Pool
import time

import predict
import requests

# Define a function that returns arguments for all the transits() calls you want to make
def _transits_call_arguments():
    now = time.time()
    tle = requests.get('http://tle.spire.com/25544').text.rstrip()
    for latitude in range(-90, 91, 15):
        for longitude in range(-180, 181, 15):
            qth = (latitude, longitude, 0)
            yield {'tle': tle, 'qth': qth, 'ending_before': now+60*60*24*7}

# Define a function that calls the transit function on a set of arguments and does per-transit processing
def _transits_call_fx(kwargs):
    try:
        transits = list(predict.transits(**kwargs))
        return [t.above(10) for t in transits]
    except predict.PredictException:
        pass

# Map the transit() caller across all the arguments you want, then flatten results into a single list
pool = Pool(processes=10)
array_of_results = pool.map(_transits_call_fx, _transits_call_arguments())
flattened_results = list(itertools.chain.from_iterable(filter(None, array_of_results)))
transits = flattened_results

NOTE: If precise accuracy isn't necessary (for modeling purposes, for example) setting the tolerance argument to the above call to a larger value, say 1 degree, can provide a significant performance boost.

Call predict analogs directly

predict.quick_find(tle.split('\n'), time.time(), (37.7727, 122.407, 25))
predict.quick_predict(tle.split('\n'), time.time(), (37.7727, 122.407, 25))

OMM support

Since version 2.0.0, support for the OMM format has been added, allowing the satellite orbital elements to be provided a JSON-style format that handles NORAD ID's greater than 5 characters, and with less limits to precision. Anywhere that a TLE is provided in the examples above, instead a python dictionary containing the OMM data as described in the CCSDS blue book 502.0-B-3 can be provided. For example:

omm = {
  "OBJECT_NAME": "ISS (ZARYA)",
  "OBJECT_ID": "1998-067A",
  "EPOCH": "2026-08-19T03:31:32.932416",
  "MEAN_MOTION": 15.49503867,
  "ECCENTRICITY": 0.00076624,
  "INCLINATION": 51.6332,
  "RA_OF_ASC_NODE": 348.4866,
  "ARG_OF_PERICENTER": 61.8697,
  "MEAN_ANOMALY": 298.3065,
  "EPHEMERIS_TYPE": 0,
  "CLASSIFICATION_TYPE": "U",
  "NORAD_CAT_ID": 25544,
  "ELEMENT_SET_NO": 999,
  "REV_AT_EPOCH": 58151,
  "BSTAR": 0.00019587255,
  "MEAN_MOTION_DOT": 0.00010553,
  "MEAN_MOTION_DDOT": 0
}

predict.quick_predict(omm, time.time(), (37.7727, 122.407, 25))

API

observe(tle, qth[, at=None])  
    Return an observation of a satellite relative to a groundstation.
    qth groundstation coordinates as (lat(N),long(W),alt(m))
    If at is not defined, defaults to current time (time.time())
    Returns an "observation" or dictionary containing:  
        altitude _ altitude of satellite in kilometers
        azimuth - azimuth of satellite in degrees from perspective of groundstation.
        beta_angle
        decayed - 1 if satellite has decayed out of orbit, 0 otherwise.
        doppler - doppler shift between groundstation and satellite.
        eci_obs_x
        eci_obs_y
        eci_obs_z
        eci_sun_x
        eci_sun_y
        eci_sun_z
        eci_vx
        eci_vy
        eci_vz
        eci_x
        eci_y
        eci_z
        eclipse_depth
        elevation - elevation of satellite in degrees from perspective of groundstation.
        epoch - time of observation in seconds (unix epoch)
        footprint
        geostationary - 1 if satellite is determined to be geostationary, 0 otherwise.
        has_aos - 1 if the satellite will eventually be visible from the groundstation
        latitude - north latitude of point on earth directly under satellite.
        longitude - west longitude of point on earth directly under satellite.
        name - name of satellite from first line of TLE.
        norad_id - NORAD id of satellite.
        orbit
        orbital_phase
        orbital_model
        orbital_velocity
        slant_range - distance to satellite from groundstation in meters.
        sunlit - 1 if satellite is in sunlight, 0 otherwise.
        visibility
transits(tle, qth[, ending_after=None][, ending_before=None])  
    Returns iterator of Transit objects representing passes of tle over qth.  
    If ending_after is not defined, defaults to current time  
    If ending_before is not defined, the iterator will yield until calculation failure.

NOTE: We yield passes based on their end time. This means we'll yield currently active passes in the two-argument invocation form, but their start times will be in the past.

Transit(tle, qth, start, end)  
    Utility class representing a pass of a satellite over a groundstation.
    Instantiation parameters are parsed and made available as fields.
    duration()  
        Returns length of transit in seconds
    peak(epsilon=0.1)  
        Returns epoch time where transit reaches maximum elevation (within ~epsilon)
    at(timestamp)  
        Returns observation during transit via quick_find(tle, timestamp, qth)
    aboveb(elevation, tolerance)
        Returns portion of transit above elevation. If the entire transit is below the target elevation, both
        endpoints will be set to the peak and the duration will be zero. If a portion of the transit is above
        the elevation target, the endpoints will be between elevation and elevation + tolerance (unless
        endpoint is already above elevation, in which case it will be unchanged)
quick_find(tle[, time[, (lat, long, alt)]])  
    time defaults to current time   
    (lat, long, alt) defaults to values in ~/.predict/predict.qth  
    Returns observation dictionary equivalent to observe(tle, time, (lat, long, alt))
quick_predict(tle[, time[, (lat, long, alt)]])  
        Returns an array of observations for the next pass as calculated by predict.
        Each observation is identical to that returned by quick_find.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pypredict-2.0.0.tar.gz (47.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pypredict-2.0.0-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (119.2 kB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

pypredict-2.0.0-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (117.5 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

pypredict-2.0.0-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (117.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

pypredict-2.0.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (117.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

pypredict-2.0.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (116.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

pypredict-2.0.0-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (116.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

pypredict-2.0.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (121.0 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.12+ x86-64manylinux: glibc 2.5+ x86-64

pypredict-2.0.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (121.5 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.12+ x86-64manylinux: glibc 2.5+ x86-64

pypredict-2.0.0-cp27-cp27mu-manylinux_2_5_x86_64.manylinux1_x86_64.whl (102.0 kB view details)

Uploaded CPython 2.7mumanylinux: glibc 2.5+ x86-64

pypredict-2.0.0-cp27-cp27m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (102.0 kB view details)

Uploaded CPython 2.7mmanylinux: glibc 2.5+ x86-64

File details

Details for the file pypredict-2.0.0.tar.gz.

File metadata

  • Download URL: pypredict-2.0.0.tar.gz
  • Upload date:
  • Size: 47.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for pypredict-2.0.0.tar.gz
Algorithm Hash digest
SHA256 0102f7ab14ab280ed9090b48c69c2a275a0383b381cb149a4bc78319438aa68a
MD5 751bccfc1f4672fdb8322fc0b8c54f35
BLAKE2b-256 57ea47e81ebe9a3a327215168a2caaa819becf13ed696607aa2bc9101bd55cd8

See more details on using hashes here.

File details

Details for the file pypredict-2.0.0-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for pypredict-2.0.0-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 9e8d9d9819c6f83beb49d267f650dc9624a2a47e4a2acce7d344171ff5434ccf
MD5 03c70a43fb9eb315aaf24165360c8d45
BLAKE2b-256 3a2666fc78ee89feb8b837660a609a21b5082664b281eea543e8260562ff1152

See more details on using hashes here.

File details

Details for the file pypredict-2.0.0-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for pypredict-2.0.0-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 e06f6535ce3de2b45d91883d4fb6e97f9d086399b5531b95f5860efdba201ab0
MD5 26015f86a908761060bd556c87c20808
BLAKE2b-256 20dceff3d14e114e4d61cfec1e502eb7f0a7406965fd73be2c473dbf39470e45

See more details on using hashes here.

File details

Details for the file pypredict-2.0.0-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for pypredict-2.0.0-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 57620356fd3b1a4a66876e4eac68f9bda082407ab5fabbe9304c20f95dc6795a
MD5 270e5bab0a220baa985e003e1e22e005
BLAKE2b-256 c0a7dfeae2cc816c75fda5f9f553b6ff7f4bfdd387d96c91f81ecf3912ccd53e

See more details on using hashes here.

File details

Details for the file pypredict-2.0.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for pypredict-2.0.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 97c1a8ac76dded5e24d2e40f111431a7b561e627f4eb704673fceafd0e4fdbb4
MD5 ded9b59eaf6cd631c0c1fc9b5ed41772
BLAKE2b-256 d270f702a535381983e6db40c84a6ddcd33cfa6d09c01477903feb3a82dc36a8

See more details on using hashes here.

File details

Details for the file pypredict-2.0.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for pypredict-2.0.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 85a1a227472c7f5f5923a1174c43e05d90a046d35cc1db58837f97bfaa958c6a
MD5 add16508ab32dae1bc4ce82e08fde577
BLAKE2b-256 e0b29ce47c6c486fc5ca5cc4749224c3a186471e5cf58ff732922e6901f058b9

See more details on using hashes here.

File details

Details for the file pypredict-2.0.0-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for pypredict-2.0.0-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 d1472ca40ed69c99ecb171580a12be80e9f51e5a258e9945364d0b42515e68c0
MD5 c3c72613168c870e1127337a00d96c6f
BLAKE2b-256 003d4954a0eda8e3048d624d4d93f6af3c3ed05e875b78db8c1487c737cdd97a

See more details on using hashes here.

File details

Details for the file pypredict-2.0.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for pypredict-2.0.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 8feb236ee8a4df9e3b324014cae21eb0186ada4d29b036decbff2f9c886f6386
MD5 b96fd1a1c6b19f2fe308c8fa3307f8dd
BLAKE2b-256 97a83de7cd57ec98f7f1448a5c7897121ff52cbacdc799aab67ffe73b62b3302

See more details on using hashes here.

File details

Details for the file pypredict-2.0.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for pypredict-2.0.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 dd057033fd7229ff3c0228be7cd604be072c4d8935272076fd1d48d998a1558b
MD5 63d03d6c53e781d1647822a47876fd47
BLAKE2b-256 2e368fa68c8662fad024b3b3cae718ee54dd693502743b2461b6dfab79db4abc

See more details on using hashes here.

File details

Details for the file pypredict-2.0.0-cp27-cp27mu-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pypredict-2.0.0-cp27-cp27mu-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c6d58636cb9c1d38461c619bb97f863ca86e89a4b1352b909cc7708f63f555ad
MD5 420613a4dfaf8e1b5edb836825bd70cc
BLAKE2b-256 cc650fed3ee58087a8259b9c099abaa3a892da933fe8eef3c4f01f9c279a9289

See more details on using hashes here.

File details

Details for the file pypredict-2.0.0-cp27-cp27m-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pypredict-2.0.0-cp27-cp27m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 10d540f46ec3ee784146aa4473f1c3fb63163a4ca62bc9b32b2d986d01d1f81f
MD5 22531326fd4718c1917e6584483f471a
BLAKE2b-256 91e38eb160cb8098c5be658fd87392ee3d168d57a5745821a107038b5e119082

See more details on using hashes here.

Release history Release notifications | RSS feed

2.0.1

11 files

This release

2.0.0 This release

11 files

1.8.1

11 files

1.8.0

9 files

1.7.2

8 files

1.7.1

8 files

1.7.0

6 files

1.6.3

6 files

1.6.2

6 files

1.2

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page