ISS Lat Lon position calculation help

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*, df['Y'].values*, df['Z'].values*, 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))
    df['AltAz'] = altaz_coords
    df['Alt'] = altaz_coords.alt
    df['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,,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.

1 Like

You write “longitude”, but it looks like you do in fact want right ascension. Two comments:

  • You transform to ICRS, but you probably want to transform to an Earth-centered equatorial frame. Chances are that either GCRS or PrecessedGeocentric would be a better choice.
  • You convert the RA to degrees, but RA is typically reported in hour angle, so that is a factor of 15, which is about the same as the discrepancy you state.

Thank you for responding and for your advice. I’m still struggling and if I’m honest probably bit off more than I could chew for a first attempt :joy:. I have tried covering to GCRS and using the precessgeodetic but I still end up with an answer that dosent seem right. Which is probably down to my lack of understanding.

So I’ve resorted to using trig to convert Cartesian to geocentric lat lon as I can’t seem to do it in astropy.