Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (dbtype == "sqlserver"):
if dbusername == None:
try:
dbusername = input("Username: ")
except Exception as error:
log.warning('ERROR: password must be specified {}'.format(error))
if dbpassword == None:
try:
dbpassword = getpass()
except Exception as error:
log.warning('ERROR: password must be specified {}'.format(error))
# Set up database connection
db = database.Database(dbname,dbtype,dbhostname,dbusername,dbpassword)
ts = load.timescale()
# 408821 "2019-08-24 13:38:39" "leobarhorst@gmail.com" 37162 "2010-046A " 4172 "E" "20190824031442326" "2019-08-24 03:14:42.3260" 0.1 NULL "2" "5" 2000 105.828 59.80349999999999 0 0 0.30000000000000004 "S" NULL NULL NULL NULL NULL NULL "IOD" "37162 10 046A 4172 E 20190824031442326 17 25 0703312+594821 37 S" 1 NULL "370139ccab6591ba36c6fc2c33081a76" "2019-08-25 17:44:27"
# 408820 "2019-08-24 13:38:39" "leobarhorst@gmail.com" 37162 "2010-046A " 4172 "E" "20190824031438341" "2019-08-24 03:14:38.3410" 0.1 NULL "2" "5" 2000 106.752 58.856833333333334 0 0 0.30000000000000004 "S" NULL NULL NULL NULL NULL NULL "IOD" "37162 10 046A 4172 E 20190824031438341 17 25 0707008+585141 37 S" 1 NULL "c24602b9fd0d66538baa8256813ec371" "2019-08-25 17:44:26"
# 408819 "2019-08-24 13:38:39" "leobarhorst@gmail.com" 37162 "2010-046A " 4172 "E" "20190824031434357" "2019-08-24 03:14:34.3570" 0.1 NULL "2" "5" 2000 107.57825 57.9475 0 0 0.30000000000000004 "S" NULL NULL NULL NULL NULL NULL "IOD" "37162 10 046A 4172 E 20190824031434357 17 25 0710313+575685 37 S" 1 NULL "9a097ee7bb889d01b0eb43452018e510" "2019-08-25 17:44:26"
# For Alt/Az conversions
planets = load('de421.bsp')
earth = planets['earth']
# iod_obs_id = input("IOD db ID: ")
while(True):
try:
iod_obs_id = input("\nEnter 3 IOD Obs IDs: ")
iod_obs_id = iod_obs_id.strip()
iod_obs = iod_obs_id.split(' ')
except:
break
from skyfield import api
from skyfield.api import load
from skyfield.constants import tau
from skyfield.data.mpc import COMET_URL, load_comets_dataframe
with load.open(COMET_URL) as f:
df = load_comets_dataframe(f)
from skyfield.keplerlib import KeplerOrbit
ts = load.timescale(builtin=True)
from numpy import sqrt
df['semimajor_axis_au'] = (
df['perihelion_distance_au'] / (1.0 - df['eccentricity'])
)
from skyfield.data.gravitational_parameters import GM_dict
from skyfield.constants import AU_KM, DAY_S
mu_km3_s2 = GM_dict[10]
mu_au3_d2 = mu_km3_s2 / (AU_KM**3.0) * (DAY_S**2.0)
row = df.ix[0]
t_perihelion = ts.tt(
def main():
#planets = load('de421.bsp')
#earth = planets['earth']
Site = CosparSite("data/sites.txt")
duvall = Topos('47.77166666666667 N', '121.90416666666667 W')
ts = load.timescale()
#t = ts.now()
#stations_url = 'http://celestrak.com/NORAD/elements/stations.txt'
satellites_file = '../tle/bulk.tle'
satellites = load.tle(satellites_file)
#satellite = satellites['ARKYD 6A']
satellite = satellites['TDRS 11']
#astrometric = observer_location.at(t).observe(mars)
#alt, az, d = astrometric.apparent().altaz()
#print(" AZ: ",az)
#print("ALT: ",alt)
def compute(target, kernel=de421, name=None, topo=None, t=None, planet=0,
precision_radec=15, precision_azalt=120, klass=None, json=None):
ts = sf.load.timescale()
if isinstance(target, str):
name = target
target = kernel[target]
if topo is None:
topo = ['33.7490 N', '84.3880 W'] # Atlanta.
topo = sf.Topos(*topo)
if t is None:
t = [2019, 9, 6, 17, 0, 0]
t = ts.utc(*t)
if name is None:
name = target.target_name
if not planet and isinstance(target.target, int):
planet = target.target