#!/usr/bin/env python # Modified from PLAN-13 Satellite Position Calculation Program # PLAN-13 by James Miller G3RUH, AMSAT UK import json from math import radians, degrees, cos, sin, sqrt, abs from math import acos, asin, atan, atan2 from math import pi as PI from datetime import datetime, timedelta from file_utils import readConfig TLE = readConfig('TLE.json') print TLE['epochTime'] print TLE['decayRate'] Observer = readConfig('Observer.json') print Observer['obsLatitude'] (X, Y, Z) = (0, 1, 2) # ordinal type for axes X, Y, Z # Calculate position of observer obsLat = radians(Observer['obsLatitude']) obsLong = radians(Observer['obsLongitude']) obsHeight = Observer['ObsHeight']/1000.0 # WGS-84 Earth ellipsoid rE = 6378.137 # radius of Earth fE = 1/298.257224 # polar flattening of Earth
import json import cgi import cgitb from datetime import datetime from pretty_date import pretty_date from file_utils import readConfig from string import Template # Enable CGI traceback cgitb.enable() # Read config file Config = readConfig('config.json') # Will modify config coding to handle list of dicts # Can set to iterate through various sources, or pick at random? endpoint = Config['url'] name = Config['name'] # Print Content-Type: header + blank line print "Content-Type: text/html" print # Read response, and parse to Python data structure via JSON # Need some exception handling here for endpoint unavailable response = urllib.urlopen(endpoint)