Closed meenavas closed 2 years ago
It’s easier for contributors to write a free sample code for you if you provide a working script that shows what you've accomplished so far. Could you provide a small sample script that builds an Earth position and two satellite positions like you describe? That way, contributors have a starting point: they can cut and paste your script, and add lines to the bottom to try exploring possible answers to your question. Thanks!
It’s easier for contributors to write a free sample code for you if you provide a working script that shows what you've accomplished so far. Could you provide a small sample script that builds an Earth position and two satellite positions like you describe? That way, contributors have a starting point: they can cut and paste your script, and add lines to the bottom to try exploring possible answers to your question. Thanks!
import skyfield as sf
from skyfield.api import EarthSatellite
from skyfield.api import load, wgs84,N,S,E,E
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from math import sqrt
import numpy as np
from numpy import array2string
GS = wgs84.latlon(+10.3, 76.52 ,elevation_m=5)
satellite = EarthSatellite(TLE1, TLE2, 'GPS BIIR-2', ts)
acqstarttime = ts.utc(2021, 9, 25, 8, 27, 0.0)
year = acqstarttime.utc.year
month = acqstarttime.utc.month
day = acqstarttime.utc.day
hr = acqstarttime.utc.hour
min = acqstarttime.utc.minute
startsec = acqstarttime.utc.second
sec = startsec
for i in range(3):
sec +=1;
tnext = ts.utc(year,month,day,hr,min,sec)
geocentric = satellite.at(tnext)
geopos=geocentric.position;
gspos=GS.at(tnext)
gspos_pos=gspos.position
My requirement is to get ECI coordinates of geopos and gspos_pos corresponding to each of the time instants indicated by tnext.
Have you taken a look at the vectors geocentric.position
and gspos.position
? I think they might be ECI coordinates already. Maybe you could outline what x,y,z you were expecting and we could figure out why they are different.
Have you taken a look at the vectors
geocentric.position
andgspos.position
? I think they might be ECI coordinates already. Maybe you could outline what x,y,z you were expecting and we could figure out why they are different. The ECEF coordinates of gspos.position is1485604.888019792 6103454.432952108 1101333.154407643
and gspos.position as given by the code above (in metres) is
6145661.90274869 -1311006.72175428 1088403.36259978
I was expecting only a small change from ECEF to ECI.
While the ECEF and ECI vectors should have the same length, they usually point in completely different directions. The difference between them would only be small during the few moments every day when the Earth's prime meridian happens to be pointing in the exact direction of 0h right ascension on the celestial sphere.
Thank you. What I gather now is that the vector given by gspos.position has the ECI coordinates. Is that right?
Yes. Let me know if there's a way that I can improve this section:
https://rhodesmill.org/skyfield/coordinates.html#eci-versus-ecef-coordinates
— to make that clearer and save folks the trouble of having to ask in the future. Thanks!
I have a location (lat,long,alt) on earth and corresponding satellite position at a given time. Want to get the relative position vector from the location on earth to the corresponding position of the satellite at another time t. I have the ecef coordintaes of both. How do I get the eci coordinate ? Please give an example with skyfield API for the above purpose