@@ -10,12 +10,13 @@ use std::{
1010 path:: { Path , PathBuf } ,
1111} ;
1212
13- use rinex:: {
14- prelude:: { Almanac , GroundPosition , Rinex , TimeScale } ,
15- types:: Type as RinexType ,
16- Error as RinexError ,
13+ use rinex:: prelude:: {
14+ nav:: { Almanac , Orbit } ,
15+ Rinex , RinexType , TimeScale ,
1716} ;
1817
18+ use qc_traits:: { Merge , MergeError } ;
19+
1920use anise:: {
2021 almanac:: {
2122 metaload:: MetaAlmanacError ,
@@ -30,7 +31,7 @@ use anise::{
3031#[ cfg( feature = "sp3" ) ]
3132use sp3:: prelude:: SP3 ;
3233
33- use qc_traits:: { Filter , Merge , MergeError , Preprocessing , Repair , RepairTrait } ;
34+ use qc_traits:: { Filter , Preprocessing , Repair , RepairTrait } ;
3435
3536/// Context Error
3637#[ derive( Debug , Error ) ]
@@ -41,14 +42,12 @@ pub enum Error {
4142 MetaAlmanac ( #[ from] MetaAlmanacError ) ,
4243 #[ error( "planetary data error" ) ]
4344 PlanetaryData ( #[ from] PlanetaryDataError ) ,
44- #[ error( "failed to extend gnss context" ) ]
45- ContextExtensionError ( #[ from] MergeError ) ,
4645 #[ error( "non supported file format" ) ]
4746 NonSupportedFileFormat ,
4847 #[ error( "failed to determine filename" ) ]
4948 FileNameDetermination ,
50- #[ error( "invalid rinex: {0} " ) ]
51- RinexError ( #[ from] RinexError ) ,
49+ #[ error( "failed to extend context " ) ]
50+ Merge ( #[ from] MergeError ) ,
5251}
5352
5453#[ derive( Debug , Copy , Clone , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
@@ -379,7 +378,7 @@ impl QcContext {
379378 pub fn timescale ( & self ) -> Option < TimeScale > {
380379 #[ cfg( feature = "sp3" ) ]
381380 if let Some ( sp3) = self . sp3 ( ) {
382- return Some ( sp3. time_scale ) ;
381+ return Some ( sp3. header . timescale ) ;
383382 }
384383
385384 if let Some ( obs) = self . observation ( ) {
@@ -601,7 +600,7 @@ impl QcContext {
601600 /// Returns true if High Precision Orbits also contains temporal information.
602601 pub fn sp3_has_clock ( & self ) -> bool {
603602 if let Some ( sp3) = self . sp3 ( ) {
604- sp3. sv_clock ( ) . count ( ) > 0
603+ sp3. has_satellite_clock_offset ( )
605604 } else {
606605 false
607606 }
@@ -667,16 +666,18 @@ impl QcContext {
667666 pub fn nav_compatible ( & self ) -> bool {
668667 self . observation ( ) . is_some ( ) && self . brdc_navigation ( ) . is_some ( )
669668 }
669+
670670 /// True if Self is compatible with CPP positioning,
671671 /// see <https://docs.rs/gnss-rtk/latest/gnss_rtk/prelude/enum.Method.html#variant.CodePPP>
672672 pub fn cpp_compatible ( & self ) -> bool {
673673 // TODO: improve: only PR
674674 if let Some ( obs) = self . observation ( ) {
675- obs. carrier ( ) . count ( ) > 1
675+ obs. carrier_iter ( ) . count ( ) > 1
676676 } else {
677677 false
678678 }
679679 }
680+
680681 /// [Self] cannot be True if self is compatible with PPP positioning,
681682 /// see <https://docs.rs/gnss-rtk/latest/gnss_rtk/prelude/enum.Method.html#variant.PPP>
682683 pub fn ppp_compatible ( & self ) -> bool {
@@ -705,21 +706,15 @@ impl QcContext {
705706 pub fn tropo_bias_model_optimization ( & self ) -> bool {
706707 self . has_meteo ( )
707708 }
709+
708710 /// Returns possible Reference position defined in this context.
709711 /// Usually the Receiver location in the laboratory.
710- pub fn reference_position ( & self ) -> Option < GroundPosition > {
711- if let Some ( data) = self . observation ( ) {
712- if let Some ( pos) = data. header . ground_position {
713- return Some ( pos) ;
714- }
715- }
716- if let Some ( data) = self . brdc_navigation ( ) {
717- if let Some ( pos) = data. header . ground_position {
718- return Some ( pos) ;
719- }
720- }
721- None
712+ pub fn reference_rx_orbit ( & self ) -> Option < Orbit > {
713+ let obs_rinex = self . observation ( ) ?;
714+ let first_epoch = obs_rinex. first_epoch ( ) ?;
715+ obs_rinex. header . rx_orbit ( first_epoch, self . earth_cef )
722716 }
717+
723718 /// Apply preprocessing filter algorithm to mutable [Self].
724719 /// Filter will apply to all data contained in the context.
725720 pub fn filter_mut ( & mut self , filter : & Filter ) {
0 commit comments