How to use the skyfield.api.load function in skyfield

To help you get started, we’ve selected a few skyfield examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github consensys-space / trusat-orbit / iod_db_gooding_analyze.py View on Github external
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

        if (len(iod_obs)==1):
            query_tmp = """SELECT obs_id, object_number, station_number, user_string, obs_time, ra, declination FROM ParsedIOD 
                WHERE obs_id >= {OBS_ID}
                ORDER BY obs_id ASC
                LIMIT 10;""".format(OBS_ID=iod_obs[0])
            db.c.execute(query_tmp)
github consensys-space / trusat-orbit / iod_analyze.py View on Github external
#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)

	for line in sys.stdin:
		IOD_line = iod_parse_line(line)
		if (IOD_line):
			try:
				satellite = satellites[IOD_line.ObjectNumber]
github avpeery / Moon-Phase-Tracker / seed.py View on Github external
from sqlalchemy import func
from model import User, MoonPhaseType, MoonPhaseOccurence, Solstice, FullMoonNickname, Alert, connect_to_db, db
from server import app

from datetime import datetime
from skyfield import api, almanac
import itertools
from seed_data.moon_phase_descriptions import moon_phases_dict

MOON_PHASE_TYPES = ['New Moon', 'First Quarter', 'Full Moon', 'Last Quarter']
FULL_MOON_NICKNAMES = ['Wolf Moon', 'Snow Moon', 'Worm Moon', 'Pink Moon', 'Flower Moon', 'Strawberry Moon', 'Buck Moon', 'Sturgeon Moon', 'Corn Moon', "Hunter's Moon", 'Beaver Moon', 'Cold Moon']
MOON_EMOJIS = ['🌚','🌛', '🌝','🌜']
TS = api.load.timescale(builtin=True)
E = api.load('seed_data/de421.bsp')


def load_moon_phase_types():
    """Adds moon phase types to moon phase types table"""

    for moon_phase, moon_emoji in zip(MOON_PHASE_TYPES, MOON_EMOJIS):
        moon_phase_type = MoonPhaseType(title=moon_phase, description=moon_phases_dict[moon_phase], emoji=moon_emoji)
        db.session.add(moon_phase_type)

    db.session.commit

def load_full_moon_nicknames():
    """Adds full moon nicknames to moon phase nicknames table"""

    for (nickname, month) in zip(FULL_MOON_NICKNAMES, range(1, 13)):
        full_moon_nickname = FullMoonNickname(title=nickname, nickname_month=month, description=moon_phases_dict[nickname])
github skyfielders / python-skyfield / design / subpoint_accuracy.py View on Github external
def main():
    ts = load.timescale()
    t = ts.tt(2018, 1, 22, 9, 9, 20)
    trial_angles = 10, 20, 30, 40  # the error peaks around 20 degrees
    trial_elevations = 0, 6000, AU_M
    print(__doc__)
    for n in range(1, 5):
        print('=== {} iterations ==='.format(n))
        print('')
        for elevation_m in trial_elevations:
            for degrees in trial_angles:
                top = Topos(latitude_degrees=degrees, longitude_degrees=123,
                            elevation_m=elevation_m)
                xyz_au = top.at(t).position.au
                xyz_au = einsum('ij...,j...->i...', t.M, xyz_au)
                lat, lon, elev = reverse_terra(xyz_au, t.gast, n)
                lat = lat / DEG2RAD
                error_mas = 60.0 * 60.0 * 1000.0 * abs(degrees - lat)