I want to compare the position calculated with Pyephem and TLE files, with RINEX files and GPSTK library in a specific date and time, but I have not the certainly if the name of the satellite "PRN ##" are the same in both files (TLE and RINEX)?
e.g. in Celestrak (TLE file) for a GPS constellation, the ID or name of satellite is:
GPS BIIF-1 (PRN 25)
1 26690C 01004A 17096.69312500 -.00000000 00000-0 00000-0 0 966 2 26690 53.0252 160.8176 0181123 256.0966 20.3287 2.00554091 10
but in the RINEX files only have a letter joined to a number, like this:
17 01 12 00 00 0.0000000 0 21G05G16G20G21G25G26G27G29G31R01R02R09 R15R16R17R18R19E01E26S20S36
where the letter is the contellation G for GPS constellation, and R for GLONASS constallation, S is for SBAS, etc. Next to the letter is a number, e.g. G25, the number of that satellite is 25 for the RINEX file.
I'm worked with GPS constellation. I'm testing with some code in python, but i'm not sure if the PRN 25 is the same to G25?, because calculating the elevation of satellite with ID 25 in a hole day, is different in the time that RINEX file shows comparating with TLE files... or may be is something wrong in my code.
obsHeader, obsData = gpstk.readRinex3Obs(obsfile)
navHeader, navData = gpstk.readRinex3Nav(navfile)
# setup ephemeris store to look for satellite positions
bcestore = gpstk.GPSEphemerisStore()
for navDataObj in navData:
ephem = navDataObj.toGPSEphemeris()
bcestore.addEphemeris(ephem)
bcestore.SearchNear()
navData.close()
#look each satellite
for obsObject in obsData: #round the data
for satID, datumList in obsObject.obs.iteritems():
if satID.systemGPS == satID.system and satID.id == NumSatellite:
time=obsObject.time #satellite time from the observation
CivilTime = gpstk.CivilTime(obsObject.time)
#break
eph = bcestore.findEphemeris(satID, obsObject.time)
svXvt = eph.svXvt(obsObject.time)
elev = obsHeader.antennaPosition.elvAngle(svXvt.getPos())
azim = obsHeader.antennaPosition.azAngle(svXvt.getPos())
SecondsTime.append(obsObject.time.getSecondOfDay())
TimesSatRin.append(CivilTime)
AziSatRin.append(azim)
ElevSatRin.append(elev)
#for each observation day.
DateTimeRinex = CivilTime2datetime(TimesSatRin)
for t in DateTimeRinex:
#for each Time of the rinex (for the specific Satellite)
print 'next time: ', t
names,elevs,azs,types = GetPositionELAZ(t,Longitude_obs,Latitude_obs,1) #just GPS with TLE files
print names
for i in range (0,len(names)):
number = int(filter(str.isdigit, names[i]))
#print number,' number sat of the TLE'
if number == NumSatellite:
print 'GOT',number,' number sat of the TLE'
TimeTLE.append(t)
ElevTLE.append(elevs)
AzimTLE.append(azs)
The position (lon,Lat) is the same of the ground station of the RINEX file repository. Thanks.
UPDATE 1:
I'm testing with my code, one vehicle by one, and I can see the comparison of elevations of each satellite, across the day. For RINEX files I try with 4 days, day of year 101, 100, 80 and 10. and for these day always the TLS PRN 10 it results are similar to RINEX PRN 12; I said similar, because it's not the same results. I'm still checking.
20th April
19th April
21th March
10th January
Apparently exists a PRN ID for RINEX by each PRN ID for TLE, in this case RINEX PRN 12 = TLE PRN 10. But this is not the precise answer, so I'll let open the question
UPDATE 2:
The calculate of position with TLE it's very accurate. but I got an error, I got a position in Longitude/Latitude, but was a wrong position, for be sure, you must to take the position for compare, by the RINEX file (the observation file), in the Header; the file have the position in X,Y,Z, so is necessary convert to position longitude-latitude.
for get the Longitude-Latitude:
def Get_latitude(x, y, z):
#radius earth
r = 6371000.
return np.arcsin(z/r)*(180/np.pi)
def Get_longitude(x, y, z):
#radius earth
r = 6371000.
if (x > 0):
return np.arctan(y/x)*(180./np.pi)
elif y > 0:
return np.arctan(y/x)*(180./np.pi) + 180.
else:
return np.arctan(y/x)*(180./np.pi) - 180.