Skip to main content

Interface to the Predict satellite tracking and orbital prediction library

Project description

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 groundstation

p = predict.transits(tle, qth)
for _ in xrange(10):
	transit = p.next()
	print("%f\t%f\t%f" % (transit.start, transit.duration(), transit.peak()['elevation']))

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

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

Project details


Download files

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

Source Distribution

pypredict-1.6.3.tar.gz (39.2 kB view details)

Uploaded Source

Built Distributions

pypredict-1.6.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl (107.6 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.5+ x86-64

pypredict-1.6.3-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl (108.0 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.5+ x86-64

pypredict-1.6.3-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (107.4 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.5+ x86-64

pypredict-1.6.3-cp27-cp27mu-manylinux_2_5_x86_64.manylinux1_x86_64.whl (107.0 kB view details)

Uploaded CPython 2.7mu manylinux: glibc 2.5+ x86-64

pypredict-1.6.3-cp27-cp27m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (107.0 kB view details)

Uploaded CPython 2.7m manylinux: glibc 2.5+ x86-64

File details

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

File metadata

  • Download URL: pypredict-1.6.3.tar.gz
  • Upload date:
  • Size: 39.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.21.0 setuptools/60.5.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10

File hashes

Hashes for pypredict-1.6.3.tar.gz
Algorithm Hash digest
SHA256 17ee4fd6098d63aaaee165acd93cda6477dd7867aaea9506fb17256f1b011bb0
MD5 2f92d01a6e2cf83c7f7e2096a9b0ff5e
BLAKE2b-256 712019a766a4a3fd2c17ac57f72db3af15eef0320b592a08de55d6cd02455f80

See more details on using hashes here.

File details

Details for the file pypredict-1.6.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pypredict-1.6.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 dbde655df3076ab67cb1036cb447effa5f93305de82cd52c8878f499ca1be091
MD5 499c8bd9330f2582649f5ee3c1195908
BLAKE2b-256 d704d8fca8ba949629e05e92bddfd087173ea977f083ef5bc6ac0cd3f30498d1

See more details on using hashes here.

File details

Details for the file pypredict-1.6.3-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pypredict-1.6.3-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 39d1cceaa01374d544e75b395890593e39886cf211be9ceaaf5847335660e9b5
MD5 abda97a31f4f76785f75660d7a8b2275
BLAKE2b-256 89d35f5f08b73290880ce154b0bb3e393c946f158eeab19d91b30150a9cb0551

See more details on using hashes here.

File details

Details for the file pypredict-1.6.3-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pypredict-1.6.3-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 46e76c30fe27641e2b8663a09c4f6aea7e6270bdbdc41453268cc0d2b2a8f501
MD5 f8a6a7dc014bc48ddd69e3ead709aaea
BLAKE2b-256 27a914b162a51f42c37c0af2a33a9a298d9b710c079f181ff16940016b77d205

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pypredict-1.6.3-cp27-cp27mu-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 1be230e63223f4a01f94a768bc6fde9e214e5abf3a91ac950867667c96cad1e4
MD5 fee00f600696c3baafa2bb4d205a84d4
BLAKE2b-256 7281034f0f282bb5d2a1ed29c1703a4f8bc80dd51456613a0074694af5bcc257

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pypredict-1.6.3-cp27-cp27m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 25d29aff39668fcde5702e782aa000a757d5eafd26f45c2e1b5aed17ed62ad19
MD5 ccf27eabde7f51c3c2097e2ee9dbee51
BLAKE2b-256 ed34d271f37f4877728397fdb3dbf98b76572168071b192fcdfcf1096aac0a28

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page