SP3¶
Reader, writer, and in-memory builder for SP3 precise orbit files.
SP3¶
SP3 ¶
SP3(satellites: list[str | SP3SatelliteId], epoch_interval: float, header: SP3Header | None = None)
An SP3 precise orbit file held in memory.
Read SP3-a through SP3-d files, build files epoch by epoch, and write SP3-d text. All values are SI. The file stores satellites in header order and records on a fixed epoch grid. Properties and accessors return copies; to change the header or a record, modify the copy and assign it back with sp3.header = header or sp3.set_record(...).
The constructor creates an empty file with a fixed epoch grid. It keeps header with three fields set from the other arguments: epoch_interval, file_type (the common system when all satellites share one, M otherwise), and accuracies, which is filled with one unknown accuracy per satellite when it is empty. Header labels and the time system are checked when the file is written.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
satellites | list[str | SP3SatelliteId] | Satellites in header order, at most 999, no duplicates. | required |
epoch_interval | float | Spacing of the epoch grid, seconds. | required |
header | SP3Header | None | Header of the file; defaults to | None |
Raises:
| Type | Description |
|---|---|
BraheError | If a satellite is invalid or duplicated, there are more than 999 satellites, or the interval is not positive and finite. |
Example
Initialize instance.
end_epoch property ¶
end_epoch: Epoch | None
Last epoch of the file.
Returns:
| Type | Description |
|---|---|
Epoch | None | Epoch | None: Last epoch, or None if the file has no epochs. |
epochs property ¶
fractional_day property ¶
fractional_day: float | None
Fractional day of the first epoch, in the time system of the file.
Returns:
| Type | Description |
|---|---|
float | None | float | None: The value, or None if the file has no epochs or its time system has no Brahe equivalent. |
gps_week property ¶
gps_week: int | None
GPS week of the first epoch, in the time system of the file.
Returns:
| Type | Description |
|---|---|
int | None | int | None: The value, or None if the file has no epochs or its time system has no Brahe equivalent. |
header property ¶
header: SP3Header
File header.
Returns:
| Name | Type | Description |
|---|---|---|
SP3Header | SP3Header | A copy of the header. Assign a modified copy back to replace the header. |
interpolation_degree property ¶
interpolation_degree: int
Degree of the Lagrange polynomials that the satellites taken from the file fit through their samples. It is not part of the file format and is 9 for a new or parsed file; a degree of 9 fits 10 samples.
Returns:
| Name | Type | Description |
|---|---|---|
int | int | The degree. |
mjd property ¶
mjd: int | None
Modified Julian day number of the first epoch, in the time system of the file.
Returns:
| Type | Description |
|---|---|
int | None | int | None: The value, or None if the file has no epochs or its time system has no Brahe equivalent. |
satellite_ids property ¶
satellite_ids: list[SP3SatelliteId]
Satellites in header order.
Returns:
| Type | Description |
|---|---|
list[SP3SatelliteId] | list[SP3SatelliteId]: Satellite identifiers. |
seconds_of_week property ¶
seconds_of_week: float | None
Seconds of the GPS week of the first epoch, in the time system of the file.
Returns:
| Type | Description |
|---|---|
float | None | float | None: The value, or None if the file has no epochs or its time system has no Brahe equivalent. |
start_epoch property ¶
start_epoch: Epoch | None
First epoch of the file.
Returns:
| Type | Description |
|---|---|
Epoch | None | Epoch | None: First epoch, or None if the file has no epochs. |
from_bytes staticmethod ¶
Parse an SP3 file from bytes that are plain text or compressed.
Gzip and Unix compress (.Z) data is detected from its leading bytes and decompressed; the decompressed size is limited to 1 GiB.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data | bytes | File contents: SP3 text, or a gzip or Unix compress stream of SP3 text. | required |
Returns:
| Name | Type | Description |
|---|---|---|
SP3 | SP3 | The parsed file. |
Raises:
| Type | Description |
|---|---|
BraheError | If the compressed stream is corrupt or decompresses to more than 1 GiB, the text is not UTF-8, or the header or any record is malformed. |
from_file staticmethod ¶
Read and parse an SP3 file.
Gzip and Unix compress (.Z) files are decompressed based on their leading bytes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Path to a plain-text, gzip-compressed, or Unix-compressed file; any | required |
Returns:
| Name | Type | Description |
|---|---|---|
SP3 | SP3 | The parsed file. |
Raises:
| Type | Description |
|---|---|
BraheError | If the file cannot be read or parsed. |
from_str staticmethod ¶
from_trajectories staticmethod ¶
from_trajectories(trajectories: list[tuple[str | SP3SatelliteId, OrbitTrajectory]], step: float | None = None, header: SP3Header | None = None) -> SP3
Build an SP3 file from orbit trajectories.
Without step, the file holds the epochs the trajectories store: the trajectories must store the same epochs, to within 1 ms, on a regular grid whose interval is the spacing of the first two. With step, each trajectory is interpolated at start + k * step over the span all trajectories cover, from the latest first epoch to the earliest last epoch. States are converted to ITRF. Velocities are stored when header.has_velocity is set. Clocks and clock rates are absent and are written as the format's bad-clock value unless set with set_clocks and set_clock_rates. The file type follows the satellite systems.
A propagator supplies the trajectory it has propagated as propagator.trajectory, and an SP3Satellite supplies one with to_trajectory().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
trajectories | list[tuple[str | SP3SatelliteId, OrbitTrajectory]] | Satellite identifiers paired with their trajectories. | required |
step | float | None | Epoch spacing to resample at, seconds. Default: None, which keeps the stored epochs. | None |
header | SP3Header | None | Header of the file; defaults to | None |
Returns:
| Name | Type | Description |
|---|---|---|
SP3 | SP3 | The file. |
Raises:
| Type | Description |
|---|---|
TypeError | If an item is not a |
BraheError | If no trajectory is given, a trajectory is empty, the satellites are invalid, the trajectories share no span, the stored epochs differ between trajectories, number fewer than two, or are off a regular grid, or a state is unavailable or not finite. |
Example
record method descriptor ¶
record(satellite: str | SP3SatelliteId, epoch: Epoch) -> SP3Record | None
Record of a satellite at an epoch of the file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
satellite | str | SP3SatelliteId | Satellite. | required |
epoch | Epoch | One of the file's epochs, matched to within 1 ms. | required |
Returns:
| Type | Description |
|---|---|
SP3Record | None | SP3Record | None: A copy of the record, or None if the satellite is absent at that epoch. |
Raises:
| Type | Description |
|---|---|
BraheError | If the satellite is not in the file or the file has no such epoch. |
satellite method descriptor ¶
satellite(satellite: str | SP3SatelliteId) -> SP3Satellite
Extract one satellite.
The result keeps the epochs where the satellite has a record with a non-zero position.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
satellite | str | SP3SatelliteId | Satellite. | required |
Returns:
| Name | Type | Description |
|---|---|---|
SP3Satellite | SP3Satellite | The satellite. |
Raises:
| Type | Description |
|---|---|
BraheError | If the satellite is not in the file or has no valid sample. |
satellites method descriptor ¶
satellites() -> list[SP3Satellite]
Extract every satellite that has at least one valid sample.
Returns:
| Type | Description |
|---|---|
list[SP3Satellite] | list[SP3Satellite]: Satellites in header order, omitting satellites without a valid sample. |
set_clock_rates method descriptor ¶
set_clock_rates(satellite: str | SP3SatelliteId, rates: list[float | None]) -> Any
Set the clock rate of a satellite at every epoch.
Clock rates are stored on velocity records, so the file must have velocity records. None or NaN clears the rate at that epoch. Nothing is modified when the call fails.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
satellite | str | SP3SatelliteId | Satellite. | required |
rates | list[float | None] | One clock rate per epoch of the file, seconds per second. NaN is treated as None. | required |
Raises:
| Type | Description |
|---|---|
BraheError | If the file has no velocity records, the satellite is not in the file, |
Example
set_clocks method descriptor ¶
set_clocks(satellite: str | SP3SatelliteId, clocks: list[float | None]) -> Any
Set the clock correction of a satellite at every epoch.
None or NaN clears the clock at that epoch, so the clocks() array of an SP3Satellite can be passed back. Nothing is modified when the call fails.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
satellite | str | SP3SatelliteId | Satellite. | required |
clocks | list[float | None] | One clock correction per epoch of the file, seconds. NaN is treated as None. | required |
Raises:
| Type | Description |
|---|---|
BraheError | If the satellite is not in the file, |
Example
set_epoch method descriptor ¶
Set the records of every satellite at an epoch.
The epoch is added or addressed as in set_record. Satellites of the file that records does not list are absent at the epoch, so an empty list gives an epoch at which every satellite is absent. Nothing is modified when the call fails.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
epoch | Epoch | Epoch of the records. | required |
records | list[tuple[str | SP3SatelliteId, SP3Record]] | Satellites paired with their records. | required |
Raises:
| Type | Description |
|---|---|
BraheError | If a satellite is not in the file or is listed twice, the epoch is off the grid, or a position or velocity has a NaN or infinite component. |
Example
set_record method descriptor ¶
set_record(satellite: str | SP3SatelliteId, epoch: Epoch, record: SP3Record) -> Any
Set the record of a satellite at an epoch.
An epoch the file does not hold is added at its place in the epoch order, with every other satellite absent; it must lie on the grid of the epoch interval anchored at the first epoch, to within 1 ms. An epoch within 1 ms of one the file holds addresses that epoch. A record whose position is exactly zero marks the satellite as absent at that epoch. Nothing is modified when the call fails.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
satellite | str | SP3SatelliteId | Satellite. | required |
epoch | Epoch | Epoch of the record. | required |
record | SP3Record | Record to store. | required |
Raises:
| Type | Description |
|---|---|
BraheError | If the satellite is not in the file, the epoch is off the grid, or the position or velocity has a NaN or infinite component. |
Example
to_file method descriptor ¶
Write the file as SP3-d text.
The text is gzip-compressed when the path ends in .gz, compared case-insensitively. The data is written to a temporary file and renamed into place, so a failed write leaves any existing file unchanged. The parent directory must exist.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Destination path; any | required |
Raises:
| Type | Description |
|---|---|
BraheError | If the file cannot be represented in SP3-d or cannot be written. |
to_string method descriptor ¶
to_string() -> str
Render the file as SP3-d text.
The version, epoch count, start epoch, GPS week, and date fields are derived from the epoch table rather than taken from the header.
Returns:
| Name | Type | Description |
|---|---|---|
str | str | The file text. |
Raises:
| Type | Description |
|---|---|
BraheError | If the file cannot be represented in SP3-d, for example an off-grid epoch, an epoch interval that rounds to zero at 8 decimal places, a comment longer than 77 characters, a header label longer than its field (agency 4, coordinate system 5, data used 5, orbit type 3 characters; shorten it by assigning a modified |
SP3Satellite¶
SP3Satellite ¶
Orbit and clock samples of one satellite from SP3 data.
Only epochs where the satellite has a valid position are kept, and records() holds one SP3Record per epoch of epochs(). Positions and velocities are in the file's Earth-fixed frame (ITRF), in m and m/s.
The satellite is an orbit state provider with the same state_* and states_* methods as OrbitTrajectory, named after its identifier (such as "G01"), so it can be passed to location_accesses. A state is interpolated in ITRF with a Lagrange polynomial of degree interpolation_degree through the samples around the requested epoch, as centered as the samples allow; a satellite with fewer samples uses all of them. The velocity is interpolated from the records when every sample of the fit has one, and is the derivative of the position polynomial otherwise. A request before the first sample or after the last one raises BraheError, as does any request to a satellite with a single sample.
Missing samples do not stop interpolation: a state between two samples that are further apart than the epoch interval is fitted through the samples around the hole and loses accuracy as the hole grows. gaps() lists those holes.
Example
Initialize instance.
id property ¶
id: SP3SatelliteId
interpolation_degree property ¶
interpolation_degree: int
Degree of the Lagrange polynomials fitted through the samples. A fit uses degree + 1 samples, or every sample when the satellite has fewer. The satellite takes the degree of the file it comes from.
Returns:
| Name | Type | Description |
|---|---|---|
int | int | The degree, at least 1. |
Raises:
| Type | Description |
|---|---|
BraheError | If set to zero. |
state_dim property ¶
state_dim: int
Dimension of the provider state.
Returns:
| Name | Type | Description |
|---|---|---|
int | int | Always 6 (position then velocity). |
clock_rates method descriptor ¶
clock_rates() -> ndarray
Clock rates of the valid samples.
Returns:
| Type | Description |
|---|---|
ndarray | numpy.ndarray: Array of shape (N,) with the clock rate of each sample in seconds per second, NaN where the file has a bad or missing rate. |
clocks method descriptor ¶
clocks() -> ndarray
Clock corrections of the valid samples.
Returns:
| Type | Description |
|---|---|
ndarray | numpy.ndarray: Array of shape (N,) with the clock correction of each sample in seconds, NaN where the file has a bad or missing clock. |
epochs method descriptor ¶
from_files staticmethod ¶
from_files(files: list[SP3]) -> list[SP3Satellite]
Chain every satellite across several SP3 files.
The files are sorted by start epoch, so they may be passed in any order, and files without epochs are ignored. Each satellite in the union of the files' satellite lists collects its valid samples from every file that contains it; a file that lacks a satellite leaves a gap in it. Two consecutive files may share their boundary epoch, where the later file's sample is kept. The files must have the same epoch interval. Time systems, agencies, coordinate system labels, and orbit types need not match.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
files | list[SP3] | SP3 files covering consecutive, non-overlapping spans. | required |
Returns:
| Type | Description |
|---|---|
list[SP3Satellite] | list[SP3Satellite]: One satellite for each identifier with at least one valid sample, in ascending identifier order. |
Raises:
| Type | Description |
|---|---|
BraheError | If the files have different epoch intervals, two files overlap by more than a shared boundary epoch, or two consecutive samples are closer than half the epoch interval. |
gaps method descriptor ¶
Spans where samples are missing.
Two consecutive samples more than 1.5 epoch intervals apart have a gap between them. A satellite with zero positions at 10:15 and 10:30 in a 15-minute file has one gap, from 10:00 to 10:45.
Returns:
| Type | Description |
|---|---|
list[tuple[Epoch, Epoch]] | list[tuple[Epoch, Epoch]]: The last sample before and the first sample after each gap, in time order. |
positions method descriptor ¶
positions() -> ndarray
Positions of the valid samples.
Returns:
| Type | Description |
|---|---|
ndarray | numpy.ndarray: Array of shape (N, 3) with the ITRF position of each sample, meters. |
records method descriptor ¶
set_id method descriptor ¶
set_identity method descriptor ¶
Set every identity field in place.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name | str | None | Name to assign. | required |
uuid_str | str | None | UUID string to assign. | required |
id | int | None | Numeric ID to assign. | required |
Raises:
| Type | Description |
|---|---|
ValueError | If |
set_name method descriptor ¶
Set the name in place.
The trajectories returned afterwards carry the same name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name | str | None | Name to assign, or None to clear. | required |
state method descriptor ¶
State at an epoch in ITRF.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
epoch | Epoch | Epoch to evaluate. | required |
Returns:
| Type | Description |
|---|---|
ndarray | numpy.ndarray: ITRF state [x, y, z, vx, vy, vz] (meters, m/s). |
Raises:
| Type | Description |
|---|---|
BraheError | If the epoch is outside the samples or the satellite has a single sample. |
state_bcbf method descriptor ¶
state_bci method descriptor ¶
state_ecef method descriptor ¶
state_eci method descriptor ¶
state_eme2000 method descriptor ¶
state_gcrf method descriptor ¶
state_in_frame method descriptor ¶
state_in_frame(frame: CelestialFrame, epoch: Epoch) -> ndarray
State at an epoch expressed in an arbitrary reference frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frame | CelestialFrame | Reference frame to express the state in. | required |
epoch | Epoch | Epoch to evaluate. | required |
Returns:
| Type | Description |
|---|---|
ndarray | numpy.ndarray: State [x, y, z, vx, vy, vz] in |
state_itrf method descriptor ¶
state_koe_mean method descriptor ¶
state_koe_mean(epoch: Epoch, angle_format: AngleFormat) -> ndarray
Mean Keplerian elements at an epoch.
Mean elements are orbit-averaged elements that remove short-period and long-period J2 perturbations using first-order Brouwer-Lyddane theory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
epoch | Epoch | Epoch to evaluate. | required |
angle_format | AngleFormat | Angle format of the angular elements. | required |
Returns:
| Type | Description |
|---|---|
ndarray | numpy.ndarray: Mean elements [a, e, i, raan, argp, mean_anomaly]. |
state_koe_osc method descriptor ¶
state_koe_osc(epoch: Epoch, angle_format: AngleFormat) -> ndarray
Osculating Keplerian elements at an epoch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
epoch | Epoch | Epoch to evaluate. | required |
angle_format | AngleFormat | Angle format of the angular elements. | required |
Returns:
| Type | Description |
|---|---|
ndarray | numpy.ndarray: Osculating elements [a, e, i, raan, argp, mean_anomaly]. |
states method descriptor ¶
states_bcbf method descriptor ¶
states_bci method descriptor ¶
states_ecef method descriptor ¶
states_eci method descriptor ¶
states_eme2000 method descriptor ¶
states_gcrf method descriptor ¶
states_in_frame method descriptor ¶
states_in_frame(frame: CelestialFrame, epochs: list[Epoch]) -> list[ndarray]
States at several epochs expressed in an arbitrary reference frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frame | CelestialFrame | Reference frame to express the states in. | required |
epochs | list[Epoch] | Epochs to evaluate. | required |
Returns:
| Type | Description |
|---|---|
list[ndarray] | list[numpy.ndarray]: State in |
states_itrf method descriptor ¶
states_koe_mean method descriptor ¶
states_koe_mean(epochs: list[Epoch], angle_format: AngleFormat) -> list[ndarray]
Mean Keplerian elements at several epochs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
epochs | list[Epoch] | Epochs to evaluate. | required |
angle_format | AngleFormat | Angle format of the angular elements. | required |
Returns:
| Type | Description |
|---|---|
list[ndarray] | list[numpy.ndarray]: Mean elements [a, e, i, raan, argp, mean_anomaly] at each epoch. |
states_koe_osc method descriptor ¶
states_koe_osc(epochs: list[Epoch], angle_format: AngleFormat) -> list[ndarray]
Osculating Keplerian elements at several epochs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
epochs | list[Epoch] | Epochs to evaluate. | required |
angle_format | AngleFormat | Angle format of the angular elements. | required |
Returns:
| Type | Description |
|---|---|
list[ndarray] | list[numpy.ndarray]: Osculating elements [a, e, i, raan, argp, mean_anomaly] at each epoch. |
to_trajectory method descriptor ¶
to_trajectory() -> OrbitTrajectory
Convert the samples to an ITRF trajectory.
The trajectory is a Cartesian OrbitTrajectory in the ITRF frame with the name, ID, and UUID of the satellite and Lagrange interpolation of degree interpolation_degree, or the number of samples less one for a satellite with fewer samples. The state at each sample is the one the satellite provides at that epoch. Gaps are not marked in the trajectory; see gaps().
Returns:
| Name | Type | Description |
|---|---|---|
OrbitTrajectory | OrbitTrajectory | The trajectory. |
Raises:
| Type | Description |
|---|---|
BraheError | If the satellite has a single sample. |
velocities method descriptor ¶
velocities() -> ndarray
Velocities the file carries for the valid samples.
Only velocity records read from the file are returned; nothing is derived from the positions. Use the state methods for a velocity at any epoch.
Returns:
| Type | Description |
|---|---|
ndarray | numpy.ndarray: Array of shape (N, 3) with the ITRF velocity of each sample in meters per second, NaN where the file has none. |
with_id method descriptor ¶
with_id(id: int) -> SP3Satellite
Set the numeric ID and return self (builder pattern).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id | int | Numeric ID to assign. | required |
Returns:
| Name | Type | Description |
|---|---|---|
SP3Satellite | SP3Satellite | Self with the ID set. |
with_identity method descriptor ¶
with_identity(name: str | None, uuid_str: str | None, id: int | None) -> SP3Satellite
Set every identity field and return self (builder pattern).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name | str | None | Name to assign. | required |
uuid_str | str | None | UUID string to assign. | required |
id | int | None | Numeric ID to assign. | required |
Returns:
| Name | Type | Description |
|---|---|---|
SP3Satellite | SP3Satellite | Self with the identity set. |
Raises:
| Type | Description |
|---|---|
ValueError | If |
with_name method descriptor ¶
with_name(name: str) -> SP3Satellite
Set the name and return self (builder pattern).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name | str | Name to assign. | required |
Returns:
| Name | Type | Description |
|---|---|---|
SP3Satellite | SP3Satellite | Self with the name set. |
with_new_uuid method descriptor ¶
with_new_uuid() -> SP3Satellite
Generate a new UUID, set it, and return self (builder pattern).
Returns:
| Name | Type | Description |
|---|---|---|
SP3Satellite | SP3Satellite | Self with a new UUID set. |
with_uuid method descriptor ¶
with_uuid(uuid_str: str) -> SP3Satellite
Set the UUID and return self (builder pattern).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
uuid_str | str | UUID string to assign. | required |
Returns:
| Name | Type | Description |
|---|---|---|
SP3Satellite | SP3Satellite | Self with the UUID set. |
Raises:
| Type | Description |
|---|---|
ValueError | If |
SP3Header¶
SP3Header ¶
SP3Header(*, agency: str | None = None, time_system: SP3TimeSystem | str | None = None, coordinate_system: str | None = None, orbit_type: SP3OrbitType | str | None = None, data_used: str | None = None, has_velocity: bool | None = None, comments: list[str] | None = None, position_base: float | None = None, clock_base: float | None = None)
Header of an SP3 file.
Mirrors the header fields of the file. SP3.header returns a copy; modify the copy and assign it back with sp3.header = header. The start epoch, epoch count, GPS week, seconds of week, MJD, and fractional day of the header lines follow from the epochs of the file and are properties of SP3.
An argument left as None keeps the default: SP3-d with velocity records, data used ORBIT, coordinate system IGS20, orbit type EXT, agency BRHE, GPS time, a 900 s epoch interval, no standard deviation bases, and no comments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agency | str | None | Producing agency; at most 4 characters to be written. | None |
time_system | SP3TimeSystem | str | None | Time system of the epochs. | None |
coordinate_system | str | None | Coordinate system label; at most 5 characters to be written. | None |
orbit_type | SP3OrbitType | str | None | Orbit type; at most 3 characters to be written. | None |
data_used | str | None | Data used descriptor; at most 5 characters to be written. | None |
has_velocity | bool | None | Whether the file carries velocity records. | None |
comments | list[str] | None | Comment lines, at most 77 characters each to be written. | None |
position_base | float | None | Base of the position standard deviation exponents, millimeters. | None |
clock_base | float | None | Base of the clock standard deviation exponents, picoseconds. | None |
Example
Initialize instance.
accuracies property ¶
agency property ¶
agency: str
Producing agency; at most 4 characters to be written.
Returns:
| Name | Type | Description |
|---|---|---|
str | str | Agency label. |
clock_base property ¶
clock_base: float | None
Base of the clock and clock rate standard deviation exponents.
Returns:
| Type | Description |
|---|---|
float | None | float | None: Base in ps (or 1e-4 ps/s); None if the file declares none. |
comments property ¶
coordinate_system property ¶
coordinate_system: str
Coordinate system label; at most 5 characters to be written.
Returns:
| Name | Type | Description |
|---|---|---|
str | str | Label, for example |
data_used property ¶
data_used: str
Data used descriptor; at most 5 characters to be written.
Returns:
| Name | Type | Description |
|---|---|---|
str | str | Descriptor, for example |
file_type property ¶
file_type: SP3FileType
Satellite system covered by the file. Assignment accepts an SP3FileType or its code letter.
Returns:
| Name | Type | Description |
|---|---|---|
SP3FileType | SP3FileType | The file type. |
has_velocity property ¶
has_velocity: bool
Whether the file carries velocity records.
Returns:
| Name | Type | Description |
|---|---|---|
bool | bool | True if velocity records are present. |
orbit_type property ¶
orbit_type: SP3OrbitType
Orbit type; at most 3 characters to be written.
Returns:
| Name | Type | Description |
|---|---|---|
SP3OrbitType | SP3OrbitType | The orbit type. |
position_base property ¶
position_base: float | None
Base of the position and velocity standard deviation exponents.
Returns:
| Type | Description |
|---|---|
float | None | float | None: Base in mm (or 1e-4 mm/s); None if the file declares none. |
time_system property ¶
time_system: SP3TimeSystem
Time system of the epochs.
Returns:
| Name | Type | Description |
|---|---|---|
SP3TimeSystem | SP3TimeSystem | The time system. |
version property ¶
version: SP3Version
SP3 format version. Assignment accepts an SP3Version or its letter.
Returns:
| Name | Type | Description |
|---|---|---|
SP3Version | SP3Version | The version. |
SP3Record¶
SP3Record ¶
SP3Record(position: ndarray, *, clock: float | None = None, velocity: ndarray | None = None, clock_rate: float | None = None, position_std: Sequence[float | None] | None = None, clock_std: float | None = None, velocity_std: Sequence[float | None] | None = None, clock_rate_std: float | None = None, clock_event: bool = False, clock_predicted: bool = False, maneuver: bool = False, orbit_predicted: bool = False, position_correlation: SP3Correlation | None = None, velocity_correlation: SP3Correlation | None = None)
One satellite state at one epoch of an SP3 file.
All quantities are SI: meters, meters per second, seconds and seconds per second. Optional fields are None when the file leaves them blank or does not carry them. Properties return copies; to change a record held by an SP3, modify a copy and pass it to SP3.set_record.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position | ndarray | Position in the file's coordinate system, meters, shape (3,). | required |
clock | float | None | Clock offset, seconds. | None |
velocity | ndarray | None | Velocity, meters per second, shape (3,). | None |
clock_rate | float | None | Clock rate of change, seconds per second. | None |
position_std | Sequence[float | None] | None | Standard deviations of the position, meters. | None |
clock_std | float | None | Standard deviation of the clock, seconds. | None |
velocity_std | Sequence[float | None] | None | Standard deviations of the velocity, meters per second. | None |
clock_rate_std | float | None | Standard deviation of the clock rate, seconds per second. | None |
clock_event | bool | Whether a clock discontinuity occurred; defaults to False. | False |
clock_predicted | bool | Whether the clock is predicted; defaults to False. | False |
maneuver | bool | Whether a maneuver occurred; defaults to False. | False |
orbit_predicted | bool | Whether the orbit is predicted; defaults to False. | False |
position_correlation | SP3Correlation | None | Position and clock correlation record. | None |
velocity_correlation | SP3Correlation | None | Velocity and clock rate correlation record. | None |
Raises:
| Type | Description |
|---|---|
ValueError | If a vector argument does not have three components. |
Example
Initialize instance.
clock property ¶
clock: float | None
Clock offset.
Returns:
| Type | Description |
|---|---|
float | None | float | None: Clock offset, seconds; None if absent. |
clock_event property ¶
clock_event: bool
Clock event flag.
Returns:
| Name | Type | Description |
|---|---|---|
bool | bool | True if a clock discontinuity occurred at this epoch. |
clock_predicted property ¶
clock_predicted: bool
Clock prediction flag.
Returns:
| Name | Type | Description |
|---|---|---|
bool | bool | True if the clock value is predicted. |
clock_rate property ¶
clock_rate: float | None
Clock rate of change.
Returns:
| Type | Description |
|---|---|
float | None | float | None: Clock rate, seconds per second; None if absent. |
clock_rate_std property ¶
clock_rate_std: float | None
Standard deviation of the clock rate.
Returns:
| Type | Description |
|---|---|
float | None | float | None: Standard deviation, seconds per second; None where unknown. |
clock_std property ¶
clock_std: float | None
Standard deviation of the clock.
Returns:
| Type | Description |
|---|---|
float | None | float | None: Standard deviation, seconds; None where unknown. |
maneuver property ¶
maneuver: bool
Maneuver flag.
Returns:
| Name | Type | Description |
|---|---|---|
bool | bool | True if the satellite maneuvered since the previous epoch. |
position property ¶
position: ndarray
Position in the file's coordinate system.
Returns:
| Type | Description |
|---|---|
ndarray | numpy.ndarray: Position, meters, shape (3,). |
position_correlation property ¶
position_correlation: SP3Correlation | None
Position and clock correlation record (EP).
Returns:
| Type | Description |
|---|---|
SP3Correlation | None | SP3Correlation | None: A copy of the record; None if absent. |
position_std property ¶
velocity property ¶
velocity: ndarray | None
Velocity in the file's coordinate system.
Returns:
| Type | Description |
|---|---|
ndarray | None | numpy.ndarray | None: Velocity, meters per second, shape (3,); None if absent. |
velocity_correlation property ¶
velocity_correlation: SP3Correlation | None
Velocity and clock rate correlation record (EV).
Returns:
| Type | Description |
|---|---|
SP3Correlation | None | SP3Correlation | None: A copy of the record; None if absent. |
velocity_std property ¶
SP3Correlation¶
SP3Correlation ¶
SP3Correlation(std: Sequence[float | None] | None = None, clock_std: float | None = None, xy: float | None = None, xz: float | None = None, xc: float | None = None, yz: float | None = None, yc: float | None = None, zc: float | None = None)
Standard deviations and correlations of an SP3-c/d correlation record.
EP records carry position (m) and clock (s) values and EV records carry velocity (m/s) and clock rate (s/s) values. A correlation coefficient whose column is blank in the file is unknown and is None, distinct from an explicit 0. Properties return copies; assign the object back to its owner to change it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
std | Sequence[float | None] | None | Standard deviations of x, y, z; defaults to all unknown. | None |
clock_std | float | None | Standard deviation of the clock. | None |
xy | float | None | Correlation between x and y; defaults to None (unknown). | None |
xz | float | None | Correlation between x and z; defaults to None (unknown). | None |
xc | float | None | Correlation between x and the clock; defaults to None (unknown). | None |
yz | float | None | Correlation between y and z; defaults to None (unknown). | None |
yc | float | None | Correlation between y and the clock; defaults to None (unknown). | None |
zc | float | None | Correlation between z and the clock; defaults to None (unknown). | None |
Example
Initialize instance.
clock_std property ¶
clock_std: float | None
Standard deviation of the clock.
Returns:
| Type | Description |
|---|---|
float | None | float | None: Standard deviation in s (EP) or s/s (EV); None where unknown. |
std property ¶
xc property ¶
xc: float | None
Correlation between x and the clock.
Returns:
| Type | Description |
|---|---|
float | None | float | None: Correlation coefficient; None if unknown. |
xy property ¶
xy: float | None
Correlation between x and y.
Returns:
| Type | Description |
|---|---|
float | None | float | None: Correlation coefficient; None if unknown. |
xz property ¶
xz: float | None
Correlation between x and z.
Returns:
| Type | Description |
|---|---|
float | None | float | None: Correlation coefficient; None if unknown. |
yc property ¶
yc: float | None
Correlation between y and the clock.
Returns:
| Type | Description |
|---|---|
float | None | float | None: Correlation coefficient; None if unknown. |
SP3SatelliteId¶
SP3SatelliteId ¶
SP3SatelliteId(system: GNSSSystem | str, number: int)
Identifier of a satellite in an SP3 file: a system and a number.
Identifiers print as the system code followed by a two-digit number (G05) and order by system, then number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
system | GNSSSystem | str | Satellite system, or its one-letter code or name. | required |
number | int | Satellite number within the system, 1 to 99 inclusive. | required |
Raises:
| Type | Description |
|---|---|
BraheError | If the system is unknown or the number is outside 1 to 99. |
Example
An identifier also equals any string that parse reads as the same identifier. Its hash equals the hash of the canonical string str(sat) only, so a non-canonical spelling such as "G 5" compares equal but hashes differently.
Initialize instance.
system property ¶
system: GNSSSystem
parse staticmethod ¶
parse(s: str) -> SP3SatelliteId
Parse an identifier as written in an SP3 file.
The identifier has three characters: a system letter (a space means GPS) and a two-digit number, which may be space padded.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
s | str | Identifier such as | required |
Returns:
| Name | Type | Description |
|---|---|---|
SP3SatelliteId | SP3SatelliteId | The identifier. |
Raises:
| Type | Description |
|---|---|
BraheError | If the text is not a valid identifier. |
SP3Version¶
SP3Version ¶
SP3 format version.
Versions a through d are described by the NGS SP3 documentation and the IGS format specifications.
Example
Initialize instance.
A class-attribute ¶
A: SP3Version = SP3Version.A
B class-attribute ¶
B: SP3Version = SP3Version.B
C class-attribute ¶
C: SP3Version = SP3Version.C
D class-attribute ¶
D: SP3Version = SP3Version.D
from_char staticmethod ¶
from_char(c: str) -> SP3Version
Parse a version letter, ignoring case.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
c | str | Version letter, one of | required |
Returns:
| Name | Type | Description |
|---|---|---|
SP3Version | SP3Version | The version. |
Raises:
| Type | Description |
|---|---|
BraheError | If the letter is not a known version. |
GNSSSystem¶
GNSSSystem ¶
Satellite navigation system of an SP3 satellite identifier.
Each system has a one-letter code used as the first character of the satellite identifier (G05, R12, ...).
Example
Initialize instance.
BEIDOU class-attribute ¶
BEIDOU: GNSSSystem = GNSSSystem.BEIDOU
Satellite navigation system of an SP3 satellite identifier.
Each system has a one-letter code used as the first character of the satellite identifier (G05, R12, ...).
GALILEO class-attribute ¶
GALILEO: GNSSSystem = GNSSSystem.GALILEO
Satellite navigation system of an SP3 satellite identifier.
Each system has a one-letter code used as the first character of the satellite identifier (G05, R12, ...).
GLONASS class-attribute ¶
GLONASS: GNSSSystem = GNSSSystem.GLONASS
Satellite navigation system of an SP3 satellite identifier.
Each system has a one-letter code used as the first character of the satellite identifier (G05, R12, ...).
GPS class-attribute ¶
GPS: GNSSSystem = GNSSSystem.GPS
Satellite navigation system of an SP3 satellite identifier.
Each system has a one-letter code used as the first character of the satellite identifier (G05, R12, ...).
IRNSS class-attribute ¶
IRNSS: GNSSSystem = GNSSSystem.IRNSS
Satellite navigation system of an SP3 satellite identifier.
Each system has a one-letter code used as the first character of the satellite identifier (G05, R12, ...).
LEO class-attribute ¶
LEO: GNSSSystem = GNSSSystem.LEO
Satellite navigation system of an SP3 satellite identifier.
Each system has a one-letter code used as the first character of the satellite identifier (G05, R12, ...).
QZSS class-attribute ¶
QZSS: GNSSSystem = GNSSSystem.QZSS
Satellite navigation system of an SP3 satellite identifier.
Each system has a one-letter code used as the first character of the satellite identifier (G05, R12, ...).
SBAS class-attribute ¶
SBAS: GNSSSystem = GNSSSystem.SBAS
Satellite navigation system of an SP3 satellite identifier.
Each system has a one-letter code used as the first character of the satellite identifier (G05, R12, ...).
code property ¶
code: str
One-letter system code used in satellite identifiers.
Returns:
| Name | Type | Description |
|---|---|---|
str | str | The code letter. |
from_code staticmethod ¶
from_code(code: str) -> GNSSSystem
Parse a system code letter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
code | str | One of | required |
Returns:
| Name | Type | Description |
|---|---|---|
GNSSSystem | GNSSSystem | The system. |
Raises:
| Type | Description |
|---|---|
BraheError | If the code is not a known system letter. |
SP3FileType¶
SP3FileType ¶
Satellite system covered by an SP3 file.
Example
Initialize instance.
BEIDOU class-attribute ¶
BEIDOU: SP3FileType = SP3FileType.BEIDOU
GALILEO class-attribute ¶
GALILEO: SP3FileType = SP3FileType.GALILEO
GLONASS class-attribute ¶
GLONASS: SP3FileType = SP3FileType.GLONASS
GPS class-attribute ¶
GPS: SP3FileType = SP3FileType.GPS
IRNSS class-attribute ¶
IRNSS: SP3FileType = SP3FileType.IRNSS
LEO class-attribute ¶
LEO: SP3FileType = SP3FileType.LEO
MIXED class-attribute ¶
MIXED: SP3FileType = SP3FileType.MIXED
QZSS class-attribute ¶
QZSS: SP3FileType = SP3FileType.QZSS
SBAS class-attribute ¶
SBAS: SP3FileType = SP3FileType.SBAS
code property ¶
code: str
One-letter file type code written in the header.
Returns:
| Name | Type | Description |
|---|---|---|
str | str | The code letter. |
from_code staticmethod ¶
from_code(code: str) -> SP3FileType
Parse a file type code letter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
code | str | One of | required |
Returns:
| Name | Type | Description |
|---|---|---|
SP3FileType | SP3FileType | The file type. |
Raises:
| Type | Description |
|---|---|
BraheError | If the code is not a known file type letter. |
SP3TimeSystem¶
SP3TimeSystem ¶
Time system of the epochs in an SP3 file.
Example
Initialize instance.
BDT class-attribute ¶
BDT: SP3TimeSystem = SP3TimeSystem.BDT
GAL class-attribute ¶
GAL: SP3TimeSystem = SP3TimeSystem.GAL
GLO class-attribute ¶
GLO: SP3TimeSystem = SP3TimeSystem.GLO
GPS class-attribute ¶
GPS: SP3TimeSystem = SP3TimeSystem.GPS
IRN class-attribute ¶
IRN: SP3TimeSystem = SP3TimeSystem.IRN
QZS class-attribute ¶
QZS: SP3TimeSystem = SP3TimeSystem.QZS
TAI class-attribute ¶
TAI: SP3TimeSystem = SP3TimeSystem.TAI
UTC class-attribute ¶
UTC: SP3TimeSystem = SP3TimeSystem.UTC
from_time_system staticmethod ¶
from_time_system(time_system: TimeSystem) -> SP3TimeSystem | None
Convert a Brahe time system to the SP3 label.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time_system | TimeSystem | Brahe time system. | required |
Returns:
| Type | Description |
|---|---|
SP3TimeSystem | None | SP3TimeSystem | None: The SP3 time system, or None if SP3 has no label for it. |
parse staticmethod ¶
parse(s: str) -> SP3TimeSystem
Parse a time system label.
Surrounding whitespace is ignored. The ccc placeholder that SP3-a and SP3-b files carry maps to GPS time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
s | str | Time system label, for example | required |
Returns:
| Name | Type | Description |
|---|---|---|
SP3TimeSystem | SP3TimeSystem | The time system. |
Raises:
| Type | Description |
|---|---|
BraheError | If the label is not a known time system. |
to_time_system method descriptor ¶
to_time_system() -> TimeSystem | None
Brahe time system equivalent to this SP3 time system.
Returns:
| Type | Description |
|---|---|
TimeSystem | None | TimeSystem | None: The Brahe time system, or None for GLO, QZS and IRN, which Brahe does not implement. |
SP3OrbitType¶
SP3OrbitType ¶
Orbit type label of an SP3 file.
The four standard labels are class attributes. Any other label found in a file is preserved verbatim by parse.
Example
Initialize instance.
BCT class-attribute ¶
BCT: SP3OrbitType = SP3OrbitType.parse('BCT')
EXT class-attribute ¶
EXT: SP3OrbitType = SP3OrbitType.parse('EXT')
FIT class-attribute ¶
FIT: SP3OrbitType = SP3OrbitType.parse('FIT')
HLM class-attribute ¶
HLM: SP3OrbitType = SP3OrbitType.parse('HLM')
parse staticmethod ¶
parse(s: str) -> SP3OrbitType
Parse an orbit type label.
Surrounding whitespace is ignored. Labels other than the four standard ones are kept as written.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
s | str | Orbit type label, for example | required |
Returns:
| Name | Type | Description |
|---|---|---|
SP3OrbitType | SP3OrbitType | The orbit type. |
See Also¶
- SP3 Precise Orbit Files -- Format, data model, time systems, parsing, and writing
- Data Files -- Overview of the datafiles module