7

I have position (x,y,z) and velocity (Vx,Vy,Vz) vectors in Earth Centered Inertial Coordinates (ECI) for a satellite orbit, and ultimately want to end up with geodetic coordinates (Latitude, Longitude, & Altitude).

According to this other Stack Overflow question it seems that I need to convert to Earth Centered Earth Fixed (ECEF) coordinates as an intermediate step (so ECI --> ECEF --> Lat/Lon/Alt).

I know ECI and ECEF share the same origin point (the center of mass of Earth) and the same z-axis that points to the North Pole. However, I am not sure what actual equations or adjustments I need to do to convert ECI to ECEF.

Otherwise, if anyone knows of any canned conversions on Astropy or something similar that would be even better. (I haven't seen ECI as an option on Astro Py or Space Py).

Here is the code I am using to generate my orbit and get the position and velocity vectors.

from scipy.constants import kilo
import orbital
from orbital import earth, KeplerianElements, Maneuver, plot, utilities
from orbital.utilities import Position, Velocity  
import matplotlib.pyplot as plt
import numpy as np

orbitPineapple = KeplerianElements.with_period(5760, body=earth, 
e=0.05, i=(np.deg2rad(0)), arg_pe=(np.deg2rad(30)))
plot(orbitPineapple)
plt.show()
print(orbitPineapple.r)
print(orbitPineapple.v)

Out: Position(x=5713846.540659178, y=3298890.8383577876, z=0.0) Velocity(x=-3982.305479346745, y=6897.555421488496, z=0.0)

Rose
  • 279
  • 1
  • 7
  • 20
  • Could you include some exemplaric inputs and expected outputs? That would make it much easier to find a solution that actually works for you. – MSeifert Sep 27 '17 at 12:47
  • I will edit my question to include the code I am using to generate my orbit and get the position and velocity vectors. – Rose Sep 27 '17 at 14:52
  • So right now I have position and velocity in ECI for a sample satellite orbit. Position(x=5713846.540659178, y=3298890.8383577876, z=0.0) Velocity(x=-3982.305479346745, y=6897.555421488496, z=0.0) and I want to get the latitude, longitude, and altitude for the satellite when it is in the same position. I read that I first need to convert from ECI to ECEF in order to convert to lat and lon. The issue is ECI is a fixed coordinate system that doesn't rotate with the Earth like ECEF and lat/lon/alt. I am not sure how to convert ECI to ECEF. – Rose Sep 27 '17 at 14:58
  • 1
    ECI and ECEF do not share the same Z-axis: ECEF typically has a Z-axis given by the minor axis of the best ellipsoid fit to the Earth (WGS84), and this axis both precesses and wobbles a bit relative to the fixed Z-axis in an ECI. An ECI and an ECEF may share the Z-axis at a specific point in time (e.g. at noon Jan 1st 2000 terrestrial time for J2000). – M Kloster May 03 '21 at 08:28

1 Answers1

6

There are a number of different Earth Centered Inertial frames, and the answer depends on which one you have your coordinates in.

The most common is so-called J2000; which is defined w.r.t to the orientation of the Earth on Jan 1st 2000. Another common one is GCRF, which is almost the same (to within 80 milli arcseconds).

If it’s either of those two, you should be able to create an astropy EarthLocation object and access the lat, lon and height attributes like so

from astropy import coordinates as coord
from astropy import units as u
from astropy.time import Time
now = Time('2017-09-27 12:22:00')
# position of satellite in GCRS or J20000 ECI:
cartrep = coord.CartesianRepresentation(x=5713846.540659178, 
                                        y=3298890.8383577876,
                                        z=0., unit=u.m)
gcrs = coord.GCRS(cartrep, obstime=now)
itrs = gcrs.transform_to(coord.ITRS(obstime=now))
loc = coord.EarthLocation(*itrs.cartesian.cartrep )
print(loc.lat, loc.lon, loc.height)
Peter Bernier
  • 8,038
  • 6
  • 38
  • 53
  • How would time factor in? Say I want to get the lat/lon/alt for an ISS orbit with position (x= -2686197.06, y= -6402017.61, z= 10956.56) and UTC Time (today) 2017/09/28 16:53:40.293 or 559889620.2930000 in J2000. – Rose Sep 28 '17 at 20:46
  • Using the correct time for the given position is important to get the transformation from GCRS to ITRS right. So if you have the time corresponding to the position in `xyz` stored in an `astropy.time.Time` object called `now`, you should use `itrs = coord.GCRS(cartrep, obstime=now).transform_to(coord.ITRS(obstime=now))`. I've edited my answer to reflect this – Stuart P Littlefair Sep 29 '17 at 08:45
  • I tried out the new version and got a type error: `TypeError: transform_to() got an unexpected keyword argument 'obstime'` for the line `itrs = gcrs.transform_to(coord.ITRS, obstime=now)` – Rose Sep 29 '17 at 15:39
  • Fixed Version: from astropy import coordinates as coord from astropy import units as u from astropy import time from astropy.time import Time xyz = [-2686197.0596728502, -6402017.6107924329, 10956.564679617248] now = time.Time('2017-09-28 16:53:40') #Time in UTC for xyz cartrep = coord.CartesianRepresentation(*xyz, unit=u.m) #adding units of [m] to xyz gcrs = coord.GCRS(cartrep, obstime=now) itrs = gcrs.transform_to(coord.ITRS(obstime=now)) loc = coord.EarthLocation(*itrs.cartesian.xyz) print('') print(loc.lat, loc.lon, loc.height) – Rose Oct 03 '17 at 18:56
  • 3
    i get an error running your code `'CartesianRepresentation' object has no attribute 'cartrep'` – Raksha Aug 28 '19 at 16:53
  • 1
    @Raksha yup, same here. According to the docs, the correct way (at least at the time of writing), is to use the `xyz`attirbute: https://docs.astropy.org/en/stable/api/astropy.coordinates.CartesianRepresentation.html#astropy.coordinates.CartesianRepresentation – Aleksander Lidtke Jul 29 '21 at 08:04