Documentation
¶
Index ¶
- func FormatFrequencyBand(system gnss.System, freq FrequencyBand) (string, error)
- func FormatObservationKey(system gnss.System, signal ObservationKey) (string, error)
- type Epoch
- func (e *Epoch) AddObservation(o Observation) error
- func (e Epoch) FindObservation(satKey SatelliteKey, obsKey ObservationKey) (Observation, error)
- func (e Epoch) FindSatellite(satKey SatelliteKey) (ObservationMap, error)
- func (e *Epoch) GPSTimeOfWeekMs() int
- func (e *Epoch) GPSTimeOfWeekSec() float64
- func (e *Epoch) GetSystems() []gnss.System
- func (e *Epoch) IsClockSteeringSet() bool
- func (e *Epoch) IsSmoothingSet() bool
- func (e Epoch) ToJSON(w io.Writer) (err error)
- type EpochFlag
- type FrequencyBand
- type Observation
- type ObservationKey
- type ObservationMap
- type ObservationSet
- type ObservationsBySystem
- func (o *ObservationsBySystem) AddEpoch(epoch Epoch)
- func (o *ObservationsBySystem) AddObservation(system gnss.System, key ObservationKey)
- func (o *ObservationsBySystem) GetObservations(system gnss.System) (*ObservationSet, error)
- func (o *ObservationsBySystem) GetSystems() []gnss.System
- func (o *ObservationsBySystem) MarshalJSON() ([]byte, error)
- func (o *ObservationsBySystem) UnmarshalJSON(data []byte) error
- type SatelliteKey
- type SatelliteMap
- func (sm *SatelliteMap) AddObservation(o Observation) error
- func (sm SatelliteMap) FindObservation(satKey SatelliteKey, obsKey ObservationKey) (Observation, error)
- func (sm SatelliteMap) FindSatellite(satKey SatelliteKey) (ObservationMap, error)
- func (sm SatelliteMap) MarshalJSON() ([]byte, error)
- func (sm *SatelliteMap) UnmarshalJSON(data []byte) error
- type SignalType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatFrequencyBand ¶ added in v0.16.0
func FormatFrequencyBand(system gnss.System, freq FrequencyBand) (string, error)
FormatFrequencyBand returns the code representation of the FrequencyBand for the given GNSS system.
func FormatObservationKey ¶ added in v0.16.0
func FormatObservationKey(system gnss.System, signal ObservationKey) (string, error)
FormatObservationKey returns a string representation of the GNSS signal.
Types ¶
type Epoch ¶
type Epoch struct {
Time time.Time `json:"time"`
ReceiverClockOffset time.Duration `json:"receiver_clock_offset"`
ClockSteeringIndicator int `json:"clock_steering_indicator"`
ExternalClockIndicator int `json:"external_clock_indicator"`
SmoothingIndicator int `json:"smoother_indicator"`
SmoothingInterval int `json:"smoother_interval"`
EpochFlag EpochFlag `json:"epoch_flag"`
Event string `json:"event"`
Satellites SatelliteMap `json:"satellites"`
}
Epoch is a struct containing the observations
func CombineEpochs ¶
CombineEpochs merges multiple Epoch instances into a single Epoch if their times match. This function checks if all provided epochs have the same time and combines them only if they do. It concatenates the observation slices from all matching epochs.
Parameters:
- epochs ...Epoch: A variadic slice of Epoch structs to be combined.
Returns:
- Epoch: A single Epoch struct containing all observations from the input epochs with matching times.
- error: An error if the epoch times do not match or if no epochs are provided.
Example:
epoch1 := Epoch{Time: time.Now(), Observations: []Observation{{Sys: gnss.SystemGPS, SvID: 1, Code: "1C"}}}
epoch2 := Epoch{Time: epoch1.Time, Observations: []Observation{{Sys: gnss.SystemGPS, SvID: 2, Code: "1C"}}}
combinedEpoch, err := CombineEpochs(epoch1, epoch2)
if err != nil {
fmt.Println(err)
} else {
fmt.Println(len(combinedEpoch.Observations)) // Output: 2
}
Note: Only combines epochs with exactly matching times.
func (*Epoch) AddObservation ¶ added in v0.16.0
func (e *Epoch) AddObservation(o Observation) error
AddObservation adds an observation to the Epoch.
func (Epoch) FindObservation ¶ added in v0.16.0
func (e Epoch) FindObservation(satKey SatelliteKey, obsKey ObservationKey) (Observation, error)
FindObservation finds an observation in the Epoch.
func (Epoch) FindSatellite ¶ added in v0.16.0
func (e Epoch) FindSatellite(satKey SatelliteKey) (ObservationMap, error)
FindSatellite finds the ObservationMap for a given satellite in the Epoch.
func (*Epoch) GPSTimeOfWeekMs ¶ added in v0.16.0
GPSTimeOfWeekMs returns the number of milliseconds into the current GPS week
func (*Epoch) GPSTimeOfWeekSec ¶ added in v0.16.0
GPSTimeOfWeekSec returns the number of seconds into the current GPS week as float64
func (*Epoch) GetSystems ¶
func (*Epoch) IsClockSteeringSet ¶
func (*Epoch) IsSmoothingSet ¶
type EpochFlag ¶
type EpochFlag uint8
EpochFlag enumerates possible RINEX epoch flag cases
Note: these will not guard against unassigned integers
type FrequencyBand ¶ added in v0.16.0
type FrequencyBand int
FrequencyBand represents the frequency band of a GNSS signal.
const ( // Unknown frequency band FrequencyUnknown FrequencyBand = iota // ------------------ // GPS, SBAS, QZSS // ------------------ GPS_L1 // 1575.42 MHz GPS_L2 // 1227.60 MHz GPS_L5 // 1176.45 MHz // ------------------ // GLONASS // ------------------ GLONASS_G1 // 1602.00 + k*9/16 MHz GLONASS_G1a // 1600.995 MHz GLONASS_G2 // 1246.00 + k*7/16 MHz GLONASS_G2a // 1248.06 MHz GLONASS_G3 // 1202.025 MHz // ------------------ // Galileo // ------------------ Galileo_E1 // 1575.42 MHz Galileo_E5a // 1176.45 MHz Galileo_E5b // 1207.14 MHz Galileo_E5ab // 1191.795 MHz (Combined E5a + E5b) Galileo_E6 // 1278.75 MHz // ------------------ // SBAS // ------------------ SBAS_L1 // 1575.42 MHz SBAS_L5 // 1176.45 MHz // ------------------ // QZSS // ------------------ QZSS_L1 // 1575.42 MHz QZSS_L2 // 1227.60 MHz QZSS_L5 // 1176.45 MHz QZSS_L6 // 1278.75 MHz // ------------------ // BeiDou // ------------------ BeiDou_B1 // 1561.098 MHz BeiDou_B1c // 1575.42 MHz BeiDou_B1a // 1575.42 MHz BeiDou_B2a // 1176.45 MHz BeiDou_B2 // 1207.14 MHz BeiDou_B2b // 1207.14 MHz BeiDou_B2ab // 1191.795 MHz (Combined B2a + B2b) BeiDou_B3 // 1268.52 MHz BeiDou_B3a // 1268.52 MHz // ------------------ // NavIC // ------------------ )
func ParseFrequencyBand ¶ added in v0.16.0
func ParseFrequencyBand(system gnss.System, code string) (FrequencyBand, error)
ParseFrequencyBand parses the frequency band code based on the GNSS system. It returns the corresponding FrequencyBand or an error if the input is invalid.
func (FrequencyBand) String ¶ added in v0.16.0
func (b FrequencyBand) String() string
String returns the human-readable name of the FrequencyBand.
type Observation ¶
type Observation struct {
System gnss.System `json:"system"` // Satellite System (G:1, R:2, S:3, E:4, C:5, J:6, I:7)
SatelliteID int `json:"satellite_id"` // Satellite PRN or Slot Number
Code string `json:"code"` // Observation Type Code (e.g 1C, 1W, 2C, 2W, ...)
Frequency float64 `json:"frequency"` // Frequency [Mhz] (e.g. 1575.42)
Fcn int `json:"frequency_channel_number"` // Frequency Channel Number (GLONASS Only)
Range float64 `json:"range"` // Pseudorange [m]
Phase float64 `json:"phase"` // Phase [cyc]
Doppler float64 `json:"doppler"` // Doppler [Hz]
SNR float32 `json:"snr"` // Signal-to-noise [db-Hz]
LLI uint16 `json:"lli"` // Slip count or timer
Flags uint16 `json:"flags"` // Flags - bit 0,1,2 same as rinex
HalfCycleAmbiguity *uint8 `json:"half_cycle_ambiguity"` // Half-cycle ambiguity indicator
LockTimeIndicatorDF407 *uint16 `json:"lock_time_indicator_df407"` // Lock time indicator
LockTimeIndicatorDF402 *uint8 `json:"lock_time_indicator_df402"` // Lock time indicator
}
Observation - holds GNSS observation data
type ObservationKey ¶ added in v0.16.0
type ObservationKey struct {
Frequency FrequencyBand
SignalType SignalType
}
ObservationKey represents a GNSS signal frequency band, and signal type.
func ParseObservationKey ¶ added in v0.16.0
func ParseObservationKey(system gnss.System, code string) (ObservationKey, error)
ParseObservationKey parses a two-character GNSS signal code (e.g. "1C") and returns the corresponding ObservationKey.
func (ObservationKey) Equals ¶ added in v0.16.0
func (s ObservationKey) Equals(other ObservationKey) bool
Equals checks if two GNSSSignals are equal.
type ObservationMap ¶ added in v0.16.0
type ObservationMap map[ObservationKey]Observation
ObservationMap is a map of ObservationKeys to Observations
func (*ObservationMap) Add ¶ added in v0.16.0
func (om *ObservationMap) Add(o Observation) error
Add adds an observation to the ObservationMap, overwriting any existing observation with the same key.
func (ObservationMap) Find ¶ added in v0.16.0
func (om ObservationMap) Find(key ObservationKey) (Observation, error)
Find searches for an observation in the ObservationMap based on the ObservationKey.
func (ObservationMap) MarshalJSON ¶ added in v0.16.0
func (om ObservationMap) MarshalJSON() ([]byte, error)
MarshalJSON for ObservationMap
func (*ObservationMap) UnmarshalJSON ¶ added in v0.16.0
func (om *ObservationMap) UnmarshalJSON(data []byte) error
UnmarshalJSON for ObservationMap
type ObservationSet ¶ added in v0.16.0
type ObservationSet struct {
// contains filtered or unexported fields
}
ObservationSet encapsulates ordered and unique ObservationKeys.
func NewObservationSet ¶ added in v0.16.0
func NewObservationSet() *ObservationSet
func (*ObservationSet) Add ¶ added in v0.16.0
func (os *ObservationSet) Add(key ObservationKey)
func (*ObservationSet) Keys ¶ added in v0.16.0
func (os *ObservationSet) Keys() []ObservationKey
type ObservationsBySystem ¶ added in v0.16.0
type ObservationsBySystem struct {
Observations map[gnss.System]*ObservationSet
}
ObservationsBySystem manages observations across multiple GNSS systems.
func NewObservationsBySystem ¶ added in v0.16.0
func NewObservationsBySystem() *ObservationsBySystem
func (*ObservationsBySystem) AddEpoch ¶ added in v0.16.0
func (o *ObservationsBySystem) AddEpoch(epoch Epoch)
func (*ObservationsBySystem) AddObservation ¶ added in v0.16.0
func (o *ObservationsBySystem) AddObservation(system gnss.System, key ObservationKey)
func (*ObservationsBySystem) GetObservations ¶ added in v0.16.0
func (o *ObservationsBySystem) GetObservations(system gnss.System) (*ObservationSet, error)
func (*ObservationsBySystem) GetSystems ¶ added in v0.16.0
func (o *ObservationsBySystem) GetSystems() []gnss.System
func (*ObservationsBySystem) MarshalJSON ¶ added in v0.16.0
func (o *ObservationsBySystem) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface for ObservationsBySystem.
func (*ObservationsBySystem) UnmarshalJSON ¶ added in v0.16.0
func (o *ObservationsBySystem) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface for ObservationsBySystem.
type SatelliteKey ¶ added in v0.16.0
type SatelliteKey struct {
System gnss.System `json:"system"`
SatelliteID int `json:"satellite_id"`
}
SatelliteKey is a struct containing the satellite system and satellite ID
func ParseSatelliteKey ¶ added in v0.16.0
func ParseSatelliteKey(s string) (SatelliteKey, error)
ParseSatelliteKey parses a string into a SatelliteKey
func (SatelliteKey) String ¶ added in v0.16.0
func (s SatelliteKey) String() string
Stringer for SatelliteKey
type SatelliteMap ¶ added in v0.16.0
type SatelliteMap map[SatelliteKey]ObservationMap
SatelliteMap is a map of SatelliteKeys to ObservationMaps
func (*SatelliteMap) AddObservation ¶ added in v0.16.0
func (sm *SatelliteMap) AddObservation(o Observation) error
addObservation adds an observation to the SatelliteMap, creating the necessary nested maps if they don't exist.
func (SatelliteMap) FindObservation ¶ added in v0.16.0
func (sm SatelliteMap) FindObservation(satKey SatelliteKey, obsKey ObservationKey) (Observation, error)
findObservation finds an observation in the SatelliteMap based on the satellite key and observation key.
func (SatelliteMap) FindSatellite ¶ added in v0.16.0
func (sm SatelliteMap) FindSatellite(satKey SatelliteKey) (ObservationMap, error)
FindSatellite finds the ObservationMap for a given satellite in the SatelliteMap.
func (SatelliteMap) MarshalJSON ¶ added in v0.16.0
func (sm SatelliteMap) MarshalJSON() ([]byte, error)
MarshalJSON for SatelliteMap
func (*SatelliteMap) UnmarshalJSON ¶ added in v0.16.0
func (sm *SatelliteMap) UnmarshalJSON(data []byte) error
UnmarshalJSON for SatelliteMap
type SignalType ¶ added in v0.16.0
type SignalType int
SignalType represents the tracking mode or channel for a given GNSS signal.
const ( SignalTypeUnknown SignalType = iota // 0: Unknown or unspecified attribute A B C D E I L M N P Q R S W X Y Z )
The following signal types are defined in the RINEX 4.02 specification: https://files.igs.org/pub/data/format/rinex_4.02.pdf
func ParseSignalType ¶ added in v0.16.0
func ParseSignalType(code string) (SignalType, error)
ParseSignalType parses a two-character GNSS signal type code (e.g. "1C") and returns the corresponding SignalType. It extracts the second character to determine the signal type.
func (SignalType) String ¶ added in v0.16.0
func (s SignalType) String() string
String returns the string representation (third character) of the SignalType.