observation

package
v0.13.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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"`
	Observations           []Observation `json:"obs"`
}

Epoch is a struct containing the observations

func CombineEpochs

func CombineEpochs(epochs ...Epoch) (Epoch, error)

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) Find

func (e *Epoch) Find(s gnss.System, SvID int, Code string) (o Observation, err error)

Find returns the observation for a given system, svID, and code

func (*Epoch) GetSystems

func (e *Epoch) GetSystems() []gnss.System

func (*Epoch) IsClockSteeringSet

func (e *Epoch) IsClockSteeringSet() bool

func (*Epoch) IsSmoothingSet

func (e *Epoch) IsSmoothingSet() bool

func (*Epoch) ToEpochMap

func (e *Epoch) ToEpochMap(s *Set) (epochMap EpochMap, err error)

ToEpochMap converts observations from a slice to a map keeps track of observable types as a function system

func (Epoch) ToJSON added in v0.9.0

func (e Epoch) ToJSON(w io.Writer) (err error)

ToJSON writes the epoch as JSON to the provided writer

type EpochFlag

type EpochFlag uint8

EpochFlag enumerates possible RINEX epoch flag cases

const (
	Ok EpochFlag = iota
	PowerFailure
	MovingAntenna
	NewSite
	HeaderInfo
	ExternalEvent
	CycleSlip
)

Note: these will not guard against unassigned integers

func (EpochFlag) String

func (epochFlag EpochFlag) String() string

String strigifies the epoch flag

type EpochMap

type EpochMap struct {
	Time           time.Time                         `json:"time"`
	ObservationMap map[string]map[string]Observation `json:"obs"`
}

EpochMap stores observations for a given epoch as a nested map

type Observation

type Observation struct {
	// Satellite System
	// G:0, R:1, S:2, E:3, C:4, J:5, I:6
	Sys gnss.System `json:"system"`
	// Satellite PRN or Slot (R)
	SvID int `json:"sv"`
	// Observation Type Code (e.g 1C, 1W, 2C, 2W, ...)
	Code string `json:"code"`
	// Frequency [Mhz] (e.g. 1575.42)
	Freq float64 `json:"freq"`
	// Frequency Channel Number (GLONASS Only)
	Fcn int `json:"fcn"`
	// Pseudorange [m]
	Range float64 `json:"range"`
	// Phase [cyc]
	Phase float64 `json:"phase"`
	// Doppler [Hz]
	Doppler float64 `json:"doppler"`
	// Signal-to-noise [db-Hz]
	SNR float32 `json:"snr"`
	// Slip count or timer
	LLI uint16 `json:"lli"`
	// Flags - bit 0,1,2 same as rinex
	Flags uint16 `json:"flags"`

	// RTCM 3 MSM specific fields
	HalfCycleAmbiguity     *uint8  `json:"half_cycle_ambiguity"`
	LockTimeIndicatorDF407 *uint16 `json:"lock_time_indicator_df407"`
	LockTimeIndicatorDF402 *uint8  `json:"lock_time_indicator_df402"`
}

Observation - holds GNSS observation data

type Set

type Set struct {
	// contains filtered or unexported fields
}

Set - implemented as a map with an empty struct as the value

func NewSet

func NewSet() *Set

NewSet - A constuctor

func (*Set) Add

func (s *Set) Add(value SysCode)

Add - adds a new element to the set

func (*Set) Contains

func (s *Set) Contains(value SysCode) bool

Contains - returns true if value exists

func (*Set) GetObsBySys

func (s *Set) GetObsBySys(sys int) (obsType []string)

func (*Set) GetObsTypeMap

func (s *Set) GetObsTypeMap() (m map[string][]string)

func (*Set) Remove

func (s *Set) Remove(value SysCode)

Remove - removes an element from the set

type SysCode

type SysCode struct {
	// Satellite System
	// G:0, R:1, S:2, E:3, C:4, J:5, I:6
	Sys int
	// Observation Type Code (e.g 1C, 1W, 2C, 2W, ...)
	Code string
}

SysCode - a struct to be used as a key in a map

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL