1717from gnss_lib_py .utils .time_conversions import gps_datetime_to_gps_millis
1818
1919class Clk (NavData ):
20- """Clk specific loading and preprocessing for any GNSS constellation
21-
22- Parameters
23- ----------
24- input_paths : string or path-like or list of paths
25- Path to measurement clk file(s).
26-
27- Returns
28- -------
29- clkdata : dict
30- Populated gnss_lib_py.parsers.clk.Clk objects
31- with key of `gnss_sv_id` for each satellite.
20+ """Clk specific loading and preprocessing for any GNSS constellation.
3221
3322 Notes
3423 -----
@@ -44,59 +33,63 @@ class Clk(NavData):
4433 Accessed as of August 24, 2022
4534
4635 """
47- def __init__ (self , input_path ):
36+ def __init__ (self , input_paths ):
4837 """Clk loading and preprocessing.
4938
5039 Parameters
5140 ----------
52- input_path : string or path-like
53- Path to clk file
41+ input_paths : string or path-like or list of paths
42+ Path to measurement clk file(s).
5443
5544 """
5645 super ().__init__ ()
5746
47+ if isinstance (input_paths , (str , os .PathLike )):
48+ input_paths = [input_paths ]
49+
5850 gps_millis = []
5951 unix_millis = []
6052 gnss_sv_ids = []
6153 gnss_id = []
6254 sv_id = []
6355 b_sv_m = []
6456
65- # Initial checks for loading sp3_path
66- if not isinstance (input_path , (str , os .PathLike )):
67- raise TypeError ("input_path must be string or path-like" )
68- if not os .path .exists (input_path ):
69- raise FileNotFoundError ("file not found" )
70-
71- # Read Clock file
72- with open (input_path , 'r' , encoding = "utf-8" ) as infile :
73- clk = infile .readlines ()
74-
75- for clk_val in clk :
76-
77- timelist_val = clk_val .split ()
78-
79- if len (timelist_val ) == 0 or timelist_val [0 ] != 'AS' :
80- continue
81-
82- gnss_sv_id = timelist_val [1 ]
83-
84- curr_time = datetime (year = int (timelist_val [2 ]), \
85- month = int (timelist_val [3 ]), \
86- day = int (timelist_val [4 ]), \
87- hour = int (timelist_val [5 ]), \
88- minute = int (timelist_val [6 ]), \
89- second = int (float (timelist_val [7 ])), \
90- tzinfo = timezone .utc )
91- gps_millis_timestep = gps_datetime_to_gps_millis (curr_time )
92- unix_millis_timestep = gps_to_unix_millis (gps_millis_timestep )
93- gnss_sv_ids .append (gnss_sv_id )
94- gnss_id .append (CONSTELLATION_CHARS [gnss_sv_id [0 ]])
95- sv_id .append (int (gnss_sv_id [1 :]))
96- gps_millis .append (gps_millis_timestep )
97- unix_millis .append (unix_millis_timestep )
98- # clock bias is given in seconds, convert to meters
99- b_sv_m .append (float (timelist_val [9 ]) * C )
57+ for input_path in input_paths :
58+ # Initial checks for loading sp3_path
59+ if not isinstance (input_path , (str , os .PathLike )):
60+ raise TypeError ("input_path must be string or path-like" )
61+ if not os .path .exists (input_path ):
62+ raise FileNotFoundError ("file not found" )
63+
64+ # Read Clock file
65+ with open (input_path , 'r' , encoding = "utf-8" ) as infile :
66+ clk = infile .readlines ()
67+
68+ for clk_val in clk :
69+
70+ timelist_val = clk_val .split ()
71+
72+ if len (timelist_val ) == 0 or timelist_val [0 ] != 'AS' :
73+ continue
74+
75+ gnss_sv_id = timelist_val [1 ]
76+
77+ curr_time = datetime (year = int (timelist_val [2 ]), \
78+ month = int (timelist_val [3 ]), \
79+ day = int (timelist_val [4 ]), \
80+ hour = int (timelist_val [5 ]), \
81+ minute = int (timelist_val [6 ]), \
82+ second = int (float (timelist_val [7 ])), \
83+ tzinfo = timezone .utc )
84+ gps_millis_timestep = gps_datetime_to_gps_millis (curr_time )
85+ unix_millis_timestep = gps_to_unix_millis (gps_millis_timestep )
86+ gnss_sv_ids .append (gnss_sv_id )
87+ gnss_id .append (CONSTELLATION_CHARS [gnss_sv_id [0 ]])
88+ sv_id .append (int (gnss_sv_id [1 :]))
89+ gps_millis .append (gps_millis_timestep )
90+ unix_millis .append (unix_millis_timestep )
91+ # clock bias is given in seconds, convert to meters
92+ b_sv_m .append (float (timelist_val [9 ]) * C )
10093
10194 self ["gps_millis" ] = gps_millis
10295 self ["unix_millis" ] = unix_millis
0 commit comments