Vroobel | 17 Sie 2022, 17:49
Zaciąganie - masz na myśli pobieranie danych?
Ja to robiłem tak (Python):
import ephem
import urllib.request as urllib2
import math
url = "https://www.celestrak.com/NORAD/elements/stations.txt"
urllib2.urlretrieve(url, "/home/pi/Python/satellites.txt")
file = open("/home/pi/Python/satellites.txt", "r")
content = file.readlines()
for line in content:
-> if ObjectName in line:
-> -> StationTLE = (content[content.index(line)].rstrip(), content[content.index(line)+1].rstrip(), content[content.index(line)+2].rstrip())
PyEphemObject = ephem.readtle(StationTLE[0], StationTLE[1], StationTLE[2])
Nadal działa, ISS jest pierwszym satelitą na liście.
A potem regularnie w kółko leciało to:
Now = datetime.now()
Year = int(Now.strftime("%Y"))
Month = int(Now.strftime("%m"))
Day = int(Now.strftime("%d"))
Hour = int(Now.strftime("%H"))
Minute = int(Now.strftime("%M"))
Second = float(Now.strftime("%S.%f"))
PyEphemObserver.lat = str(MojaSzerokośćGeograficzna)
PyEphemObserver.lon = str(MojaDługośćGeograficzna)
PyEphemObserver.elev = 30 # Tyle około mam nad poziomem morza.
PyEphemDateNow = (Year, Month, Day, Hour, Minute, Second)
PyEphemObserver.date = ephem.date(PyEphemDateNow)
PyEphemObject.compute(PyEphemObserver)
PyEphemObjectListAz = re.split('[:]+', str(PyEphemObject.az))
PyEphemObjectAz = abs(int(PyEphemObjectListAz[0])) + int(PyEphemObjectListAz[1])/60 + float(PyEphemObjectListAz[2])/3600
PyEphemObjectListAlt = re.split('[:]+', str(PyEphemObject.alt))
PyEphemObjectAlt = abs(int(PyEphemObjectListAlt[0])) + int(PyEphemObjectListAlt[1])/60 + float(PyEphemObjectListAlt[2])/3600
if int(PyEphemObjectListAlt[0]) < 0:
-> PyEphemObjectAlt *= -1
Az = PyEphemObjectAz
Alt0 = PyEphemObjectAlt
Żeby być precyzyjnym, dodaj refrakcję atmosferyczną (na podstawie "Astronomical Algorithms, wyd. II, Jean Meeus):
R = 1.02 / math.tan((Alt0 + 10.3 / (Alt0 + 5.11))*math.pi/180)
Alt = Alt0 + R/60
Daj znać, czy działa.