For fun and an introduction to Astropy I wrote a program to parse the OEM data from ISS Trajectory Data | NASA and then try and work out when the ISS would be visible from my location and plot on a map. Everything works to a point except the longitude returned does not match what is expected. The code below reads in the OEM txt file
Converts it to AltAz the for each row work out the Long and latitude.
iss_positions = SkyCoord(df['X'].values*u.km, df['Y'].values*u.km, df['Z'].values*u.km, location=observer_location,
obstime=df['Epoch'], representation_type="cartesian", frame='teme')
altaz_coords = iss_positions.transform_to(AltAz(obstime=iss_positions.obstime, location=observer_location))
print(altaz_coords)
df['AltAz'] = altaz_coords
df['Alt'] = altaz_coords.alt
df['Az'] = altaz_coords.az
df['obstime'] = altaz_coords.obstime
for _, row in filtered_df.iterrows():
# Create a SkyCoord object from AltAz coordinates with explicit time
altaz_coord = SkyCoord(alt=row['Alt'], az=row['Az'], frame='altaz', obstime=row['obstime'],
unit=(u.deg, u.deg, u.km),location=observer_location)
# Transform AltAz coordinates to ICRS
icrs_coord = altaz_coord.transform_to('icrs')
# Calculate the latitude and longitude relative to the observer's location
lat = icrs_coord.dec.deg
lon = icrs_coord.ra.deg
The Alt AZ returned are correct however the Long is incorrect. In the returned example below the RA should be 4.4958 and not 64
2024-03-27T19:40:14.800000000 Alt:33.22975653595637 Azimuth:241.70441436382998 RA:64.74518668449372 Dec:11.4141009174209
Iām not quite sure where Iām going wrong is it to do with LST, Iām located in Ireland so UTC+0.
Any help would be greatly appreciated.