I tried tracking a satellite - or rather confirming the data I got from the AMSAT pass prediction web page - using python, more precisly the sgp4 and navpy packages. Now I don't really now what I'm doing here, but I thought this would work:
from sgp4.api import Satrec from sgp4.api import jday import navpy import numpy as np #ISS s = '1 25544U 98067A 21336.70775771 .00004247 00000-0 85987-4 0 9994' t = '2 25544 51.6437 229.4568 0004362 271.6918 182.8759 15.48732282314711' satellite = Satrec.twoline2rv(s, t) jd, fr = jday(2021, 12, 8, 9, 4, 0) e, r, v = satellite.sgp4(jd, fr) # e = error, r = position vector, v = speed vector lat, lon, alt = 48.1, 16.3, 250 r0 = navpy.lla2ecef(lat, lon, alt, latlon_unit='deg', alt_unit='m', model='wgs84') x, y, z = r - r0 az = np.arctan2(x,y) el = np.arctan2(z,y) az_deg = 180*az/np.pi el_deg = 180*el/np.pi
What I expected from this code is, that it would give me a simillar output to what the AMSAT page those, i.e., give me elevation and azimuth of the satellite, relative to my position (r0) at a certain time. However, the results don't match at all and I suspect it has something to do with the used coordinate systems, but I can't point my finger at it. Anyone can help me with this?