Coder Social home page Coder Social logo

pypredict's Introduction

PyPredict

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.

NOTE: pypredict and predict uses north latitude, west longitude for groundstation site coordinates.

If you think you've found an error, please include predict's differing output in 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()
# => {
  'decayed': 0,
  'elevation': -41.35311129599831,
  'name': '0 LEMUR 1',
  'norad_id': 40044,
  'altitude': 640.7111771881182,
  'orbit': 3048,
  'longitude': 317.1566472306673,
  'sunlit': 0,
  'geostationary': 0,
  'footprint': 5492.870800739669,
  'epoch': 1421197860.582528,
  'doppler': -777.9630509272195,
  'visibility': 'N',
  'azimuth': 104.54206601988983,
  'latitude': -10.614365448199932,
  'orbital_model': 'SGP4',
  'orbital_phase': 208.99510848736426,
  'eclipse_depth': 23.38122135548474,
  'slant_range': 9338.612365004446,
  'has_aos': 1,
  'orbital_velocity': 27165.627315567013
}

Show upcoming transits of satellite over groundstation

p = predict.transits(tle, qth)
for i in range(1,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:  
        norad_id : NORAD id of satellite.  
        name : name of satellite from first line of TLE.  
        epoch : time of observation in seconds (unix epoch)  
        azimuth : azimuth of satellite in degrees relative to groundstation.  
        elevation : elevation of satellite in degrees relative to groundstation.  
        slant_range : distance to satellite from groundstation in meters.  
        sunlit : 1 if satellite is in sunlight, 0 otherwise.  
        decayed: 1 if satellite has decayed out of orbit, 0 otherwise.  
        geostationary : 1 if satellite is determined to be geostationary, 0 otherwise.  
        latitude : sub-satellite latitude.  
        longitude : sub-satellite longitude.  
        altitude : altitude of satellite relative to sub-satellite latitude, longitude.  
        has_aos : 1 if the satellite will eventually be visible from the groundstation  
        doppler : doppler shift between groundstation and satellite.  
        orbit : refer to predict documentation  
        footprint : refer to predict documentation  
        visibility : refer to predict documentation  
        orbital_model : refer to predict documentation  
        orbital_phase : refer to predict documentation  
        eclipse_depth : refer to predict documentation  
        orbital_velocity : refer to predict documentation  
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.

pypredict's People

Contributors

jtrutna avatar bordicon avatar

Stargazers

Gerad Munsch avatar Alexander avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.