Class Sp3Loader

Class Documentation

class Sp3Loader

Loader / interpolator for IGS SP3 precise-ephemeris files.

Satellites are identified by their SP3 identifiers, e.g. "G01" (GPS PRN 1), "E11" (Galileo PRN 11), "C06" (BeiDou PRN 6), "J03" (QZSS PRN 3).

Public Functions

Sp3Loader() = default
explicit Sp3Loader(const std::filesystem::path &filepath)

Construct and load a single SP3 file.

explicit Sp3Loader(const std::vector<std::filesystem::path> &filepaths)

Construct and load multiple SP3 files (e.g. consecutive days); samples are concatenated and sorted by epoch per satellite.

void LoadFile(const std::filesystem::path &filepath)

Parse an additional SP3 file and merge its samples in.

inline const std::vector<std::string> &GetSatellites() const

SP3 identifiers of all satellites with data loaded so far, e.g. {"G01", "G02", ..., "E11", ...}.

bool HasSatellite(const std::string &sat_id) const
void GetPosVelClock(const std::string &sat_id, Real t_tai, Vec6 &rv_ecef, Real &clock_bias_s) const

Interpolated ECEF position [m] / velocity [m/s] (rv_ecef, columns 0-2 / 3-5) and clock bias [s] (clock_bias_s, including the relativistic correction -2/c^2 * dot(r, v), mirroring SP3Loader.get_posvelclock) of satellite sat_id at epoch t_tai (TAI seconds). Throws if sat_id is unknown or t_tai is outside the loaded ephemeris span (no orbital-propagation fallback, unlike the Python reference &#8212; the precise-ephemeris window is expected to cover the requested epochs).

Vec6 GetPosVel(const std::string &sat_id, Real t_tai) const

Interpolated ECEF position [m] / velocity [m/s] only.

std::pair<double, double> GetTimeSpan(const std::string &sat_id) const

Time span [TAI seconds] covered by the loaded ephemeris for satellite sat_id ({t_min, t_max}).

Public Static Functions

static std::string FilenameForEpoch(Real epoch, Time time_scale = Time::UTC)

Build the modern CDDIS/COD MGEX final SP3 filename for epoch.

Parameters:
  • epoch – Epoch value in time_scale seconds.

  • time_scaleTime scale of epoch (UTC by default).

Returns:

Filename such as COD0MGXFIN_20250010000_01D_05M_ORB.SP3.

static std::string UrlForEpoch(Real epoch, Time time_scale = Time::UTC)

Build the CDDIS download URL for the SP3 product covering epoch.

This follows the same modern COD/MGEX final-product convention as the Python SP3Loader. Pre-2017 legacy .Z products are intentionally not supported by the C++ helper.

static std::filesystem::path DownloadFileForEpoch(Real epoch, Time time_scale = Time::UTC, const std::filesystem::path &cache_dir = std::filesystem::path())

Download/cache the SP3 file covering epoch, then return the uncompressed .SP3 path.

The default cache directory is GetOutputDir("gnss_files") / "sp3", matching the Python loader. Downloads use curl -L --netrc-optional, so credentials can be supplied with ~/.netrc; if EARTHDATA_USERNAME and EARTHDATA_PASSWORD are set, they are also passed to curl. Throws if CDDIS returns an Earthdata Login HTML page.