After fixing the empty line problem I still can’t correctly parse the snx file. I am using the strategy of the SLR tutorial mentioned before, where orekit’s SinexParser is used (actually it uses SinexLoader). It then goes through the station_map and retrieves the data of each active SLR station, and builds the Groundstation objects with that data. The problem I am experiencing is that the parser does not seem to get the correct position/velocity data for each station, resulting in coordinates kilometers within the earh. Here is the code that does this (slightly modified from the tutorial):
def parseStationData_Orekit(stationFile, stationEccFile, epoch, _ITRF_VERSION: Optional[str] = "ITRF_2014", simpleEOP: Optional[bool] = True):
itrf = FramesFactory.getITRF(ITRFVersion.valueOf(_ITRF_VERSION), IERSConventions.IERS_2010, simpleEOP)
ecef = itrf
wgs84Ellipsoid = ReferenceEllipsoid.getWgs84(ecef)
year = int(_ITRF_VERSION.split('_')[1])
# Use Orekit parser
sinex_stations_parser = SinexParser(TimeScalesFactory.getTimeScales())
ds_stations = DataSource(stationFile)
sinex_stations = sinex_stations_parser.parse(ds_stations)
stations_map = sinex_stations.getStations()
sinex_ecc_parser = SinexParser(TimeScalesFactory.getTimeScales())
ds_ecc = DataSource(stationEccFile)
sinex_ecc = sinex_ecc_parser.parse(ds_ecc)
ecc_map = sinex_ecc.getStations()
station_keys = stations_map.keySet()
n_errors = 0
station_df = pd.DataFrame(columns=['lat_deg', 'lon_deg', 'alt_m', 'GroundStation'])
for key in station_keys:
station_data = stations_map.get(key)
ecc_data = ecc_map.get(key)
if ecc_data.getEccRefSystem() != Station.ReferenceSystem.XYZ:
print('Error, eccentricity coordinate system not XYZ')
epoch_velocity = station_data.getEpoch()
durationSinceEpoch = datetime_to_absolutedate(epoch).durationFrom(epoch_velocity) # seconds
# Computing current station position using velocity data
station_pos_at_epoch = station_data.getPosition()
vel = station_data.getVelocity() # m/s
station_pos_current = station_pos_at_epoch.add(vel.scalarMultiply(durationSinceEpoch))
# Adding eccentricity
try:
ecc_data = ecc_data.getEccentricities(datetime_to_absolutedate(epoch))
station_pos_current = station_pos_current.add(ecc_data)
# Converting to ground station object
geodeticPoint = wgs84Ellipsoid.transform(station_pos_current, itrf, datetime_to_absolutedate(epoch))
lon_deg = np.rad2deg(geodeticPoint.getLongitude())
lat_deg = np.rad2deg(geodeticPoint.getLatitude())
alt_m = geodeticPoint.getAltitude()
topocentricFrame = TopocentricFrame(wgs84Ellipsoid, geodeticPoint, key)
groundStation = GroundStation(topocentricFrame)
station_df.loc[key] = [lat_deg, lon_deg, alt_m, groundStation]
except:
# And exception is thrown when the odDate is not in the date range of the eccentricity entry for this station
# This is simply for stations which do not exist anymore at odDate
n_errors += 1
return station_df, n_errors
An example of the for loop for each station key:
key
'7840'
station_pos_at_epoch
<Vector3D: {4,033,463.47630212; 1,162,694.35703709; 4,647,246.84303809}>
alt_m
-103938.4978470715
The same station information from the .snx file:
1183 STAX 7840 A 1 15:001:00000 m 2 0.403346347630212E+07 0.61390E-03
1184 STAY 7840 A 1 15:001:00000 m 2 0.236627872673329E+05 0.65693E-03
1185 STAZ 7840 A 1 15:001:00000 m 2 0.492430535075408E+07 0.65568E-03
1186 VELX 7840 A 1 15:001:00000 m/y 2 -.131572303249976E-01 0.49144E-04
1187 VELY 7840 A 1 15:001:00000 m/y 2 0.170848681043556E-01 0.48038E-04
1188 VELZ 7840 A 1 15:001:00000 m/y 2 0.981395859644500E-02 0.55278E-04
Notice the STAX posittion data is correct, but the rest are not. In fact the Y and Z position are from the previous station in the file:
1177 STAX 7839 A 1 15:001:00000 m 2 0.419442621299162E+07 0.67699E-03
1178 STAY 7839 A 1 15:001:00000 m 2 0.116269435703709E+07 0.70288E-03
1179 STAZ 7839 A 1 15:001:00000 m 2 0.464724684303809E+07 0.68829E-03
1180 VELX 7839 A 1 15:001:00000 m/y 2 -.169475196163750E-01 0.52863E-04
1181 VELY 7839 A 1 15:001:00000 m/y 2 0.178948924955752E-01 0.50710E-04
1182 VELZ 7839 A 1 15:001:00000 m/y 2 0.104131812643129E-01 0.58086E-04
I hope this is a problem of how I am using the SinexParser and not a bug 