Skip to content

Commit 073c1e2

Browse files
committed
docstring edits
1 parent 47a0f24 commit 073c1e2

19 files changed

Lines changed: 256 additions & 173 deletions

gnss_lib_py/parsers/clk.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Functions to process precise ephemerides .sp3 and .clk files.
1+
"""Functions to process .clk and .CLK precise clock product files.
22
33
"""
44

@@ -32,20 +32,27 @@ class Clk(NavData):
3232
3333
Notes
3434
-----
35-
The format for .clk files can be viewed in [2]_.
35+
The format for .clk files can be viewed in [1]_.
3636
3737
Based on code written by J. Makela.
3838
AE 456, Global Navigation Sat Systems, University of Illinois
3939
Urbana-Champaign. Fall 2015
4040
4141
References
4242
-----
43-
.. [2] https://files.igs.org/pub/data/format/rinex_clock300.txt
43+
.. [1] https://files.igs.org/pub/data/format/rinex_clock300.txt
4444
Accessed as of August 24, 2022
4545
4646
"""
4747
def __init__(self, input_path):
48+
"""Clk loading and preprocessing.
4849
50+
Parameters
51+
----------
52+
input_path : string or path-like
53+
Path to clk file
54+
55+
"""
4956
super().__init__()
5057

5158
gps_millis = []
@@ -115,6 +122,8 @@ def extract_clk(self, gnss_sv_id, sidx, ipos = 10, \
115122
method : string
116123
Type of interpolation method used for clk data (the default is
117124
CubicSpline, which depicts third-order polynomial)
125+
verbose : bool
126+
If true, prints extra debugging statements.
118127
119128
Returns
120129
-------
@@ -139,7 +148,8 @@ def extract_clk(self, gnss_sv_id, sidx, ipos = 10, \
139148
return func_satbias
140149

141150

142-
def clk_snapshot(self, func_satbias, cxtime, hstep = 5e-1, method='CubicSpline'):
151+
def clk_snapshot(self, func_satbias, cxtime, hstep = 5e-1,
152+
method='CubicSpline'):
143153
"""Compute satellite clock bias and drift from clk interpolated function
144154
145155
Parameters

gnss_lib_py/parsers/nmea.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Nmea(NavData):
2121
"""Class used to parse through NMEA files
2222
2323
"""
24-
def __init__(self, filename, msg_types=None,
24+
def __init__(self, input_path, msg_types=None,
2525
check=False, keep_raw=False, include_ecef=False):
2626
"""Read instance of NMEA file following NMEA 0183 standard.
2727
@@ -32,7 +32,7 @@ def __init__(self, filename, msg_types=None,
3232
3333
Parameters
3434
----------
35-
filename : str or path-like
35+
input_path : str or path-like
3636
filepath to NMEA file to read.
3737
msg_types : list
3838
List of strings describing messages that can be parsed.
@@ -65,12 +65,12 @@ def __init__(self, filename, msg_types=None,
6565
field_dict = {}
6666
prev_timestamp = None
6767

68-
if not isinstance(filename, (str, os.PathLike)):
69-
raise TypeError("filename must be string or path-like")
70-
if not os.path.exists(filename):
68+
if not isinstance(input_path, (str, os.PathLike)):
69+
raise TypeError("input_path must be string or path-like")
70+
if not os.path.exists(input_path):
7171
raise FileNotFoundError("file not found")
7272

73-
with open(filename, "r", encoding='UTF-8') as open_file:
73+
with open(input_path, "r", encoding='UTF-8') as open_file:
7474
for line in open_file:
7575
check_ind = line.find('*')
7676
if not check and '*' in line:

gnss_lib_py/parsers/rinex_nav.py

Lines changed: 31 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,11 @@
11
"""Parses Rinex .n files.
2-
#TODO: Remove this description and move to the tutorials and description
3-
#in the documentation
4-
The Ephemeris Manager provides broadcast ephemeris for specific
5-
satellites at a specific timestep. The EphemerisDownloader class should be
6-
initialized and then the ``get_ephemeris`` function can be used to
7-
retrieve ephemeris for specific satellites. ``get_ephemeris`` returns
8-
the most recent broadcast ephemeris for the provided list of satellites
9-
that was broadcast BEFORE the provided timestamp. For example GPS daily
10-
ephemeris files contain data at a two hour frequency, so if the
11-
timestamp provided is 5am, then ``get_ephemeris`` will return the 4am
12-
data but not 6am. If provided a timestamp between midnight and 2am then
13-
the ephemeris from around midnight (might be the day before) will be
14-
provided. If no list of satellites is provided, then ``get_ephemeris``
15-
will return data for all satellites.
16-
17-
When multiple observations are provided for the same satellite and same
18-
timestep, the Ephemeris Manager will only return the first instance.
19-
This is applicable when requesting ephemeris for multi-GNSS for the
20-
current day. Same-day multi GNSS data is pulled from same day. For
21-
same-day multi-GNSS from https://igs.org/data/ which often has multiple
22-
observations.
2+
3+
Loads rinex navigation files into a NavData object. Loading time can be
4+
sped up significantly by passing in the "satellites" parameter which in
5+
turn gets passed into the georinex library used to parse the rinex file.
6+
7+
Rinex files can be downloaded with the load_ephemeris function in the
8+
utils/ephemeris_downloader.py file.
239
2410
"""
2511

@@ -28,8 +14,8 @@
2814
__date__ = "13 July 2021"
2915

3016
import os
31-
from datetime import timezone
3217
import warnings
18+
from datetime import timezone
3319

3420
import numpy as np
3521
import pandas as pd
@@ -42,28 +28,13 @@
4228

4329

4430
class RinexNav(NavData):
45-
"""Class to handle Rinex files containing SV parameters.
31+
"""Class to parse Rinex navigation files containing SV parameters.
4632
47-
The Ephemeris Manager provides broadcast ephemeris for specific
48-
satellites at a specific timestep. The EphemerisDownloader class
49-
should be initialized and then the ``get_ephemeris`` function
50-
can be used to retrieve ephemeris for specific satellites.
51-
``get_ephemeris`` returns the most recent broadcast ephemeris
52-
for the provided list of satellites that was broadcast BEFORE
53-
the provided timestamp. For example GPS daily ephemeris files
54-
contain data at a two hour frequency, so if the timestamp
55-
provided is 5am, then ``get_ephemeris`` will return the 4am data
56-
but not 6am. If provided a timestamp between midnight and 2am
57-
then the ephemeris from around midnight (might be the day
58-
before) will be provided. If no list of satellites is provided,
59-
then ``get_ephemeris`` will return data for all satellites.
6033
61-
When multiple observations are provided for the same satellite
62-
and same timestep, the Ephemeris Manager will only return the
63-
first instance. This is applicable when requesting ephemeris for
64-
multi-GNSS for the current day. Same-day multi GNSS data is
65-
pulled from same day. For same-day multi-GNSS from
66-
https://igs.org/data/ which often has multiple observations.
34+
Loads rinex navigation files into a NavData object. Loading time can
35+
be sped up significantly by passing in the "satellites" parameter
36+
which in turn gets passed into the georinex library used to parse
37+
the rinex file.
6738
6839
Inherits from NavData().
6940
@@ -214,14 +185,16 @@ def _get_ephemeris_dataframe(self, rinex_path, constellations=None):
214185
----------
215186
rinex_path : string or path-like
216187
Filepath to rinex file
217-
218-
constellations : Set
188+
constellations : set
219189
Set of satellites {"ConstIDSVID"}
220190
221191
Returns
222192
-------
223193
data : pd.DataFrame
224194
Parsed ephemeris DataFrame
195+
data_header : dict
196+
Header information from Rinex file.
197+
225198
"""
226199

227200
if constellations is not None:
@@ -258,7 +231,7 @@ def get_iono_params(self, rinex_header, constellations=None):
258231
259232
Parameters
260233
----------
261-
rinex_head : dict
234+
rinex_header : dict
262235
Dictionary containing RINEX file header information
263236
constellations : list
264237
List of strings indicating which constellations ionosphere
@@ -325,6 +298,15 @@ def get_iono_params(self, rinex_header, constellations=None):
325298

326299
@staticmethod
327300
def _iono_corr_key():
301+
"""Correlations between satellite name and iono param name.
302+
303+
Returns
304+
-------
305+
iono_corr_key : list
306+
String names for ionospheric correction parameters within
307+
the rinex navigation file.
308+
309+
"""
328310
iono_corr_key = {}
329311
iono_corr_key['gps'] = ['GPSA', 'GPSB']
330312
iono_corr_key['galileo'] = ['GAL']
@@ -339,7 +321,7 @@ def load_leapseconds(self, rinex_header):
339321
Parameters
340322
----------
341323
rinex_header : dict
342-
Header information from Rinex file
324+
Header information from Rinex file.
343325
344326
Returns
345327
-------
@@ -513,12 +495,14 @@ def get_time_cropped_rinex(gps_millis, satellites=None,
513495
List of satellite IDs as a string, for example ['G01','E11',
514496
'R06']. Defaults to None which returns get_ephemeris for
515497
all satellites.
498+
ephemeris_directory : string or path-like
499+
Directory where ephemeris files are downloaded if necessary.
516500
verbose : bool
517501
Prints extra debugging statements.
518502
519503
Returns
520504
-------
521-
data : gnss_lib_py.parsers.navdata.NavData
505+
rinex_data : gnss_lib_py.parsers.navdata.NavData
522506
ephemeris entries corresponding to timestamp
523507
524508
Notes

gnss_lib_py/parsers/rinex_obs.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
"""Parses Rinex .o files"""
22

3+
__authors__ = "Ashwin Kanhere"
4+
__date__ = "26 July 2023"
5+
36
import numpy as np
47
import georinex as gr
58

69
from gnss_lib_py.parsers.navdata import NavData
710
import gnss_lib_py.utils.constants as consts
811
from gnss_lib_py.utils.time_conversions import datetime_to_gps_millis
912

10-
__authors__ = "Ashwin Kanhere"
11-
__date__ = "26 July 2023"
1213

1314
class RinexObs(NavData):
1415
"""Class handling Rinex observation files [1]_.
@@ -30,7 +31,7 @@ class RinexObs(NavData):
3031
3132
3233
"""
33-
#TODO: Add support for selecting constellations and bands
34+
#TODO: Add support for selecting constellations and bands
3435
def __init__(self, input_path):
3536
"""Loading Rinex observation files into a NavData based class.
3637

gnss_lib_py/parsers/sp3.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Functions to process precise ephemerides .sp3 and .clk files.
1+
"""Functions to process .sp3 or .SP3 precise orbit files.
22
33
"""
44

@@ -119,6 +119,8 @@ def extract_sp3(self, gnss_sv_id, sidx, ipos = 10, \
119119
method : string
120120
Type of interpolation method used for sp3 data (the default is
121121
CubicSpline, which depicts third-order polynomial)
122+
verbose : bool
123+
If true, prints extra debugging statements.
122124
123125
Returns
124126
-------
@@ -152,8 +154,11 @@ def extract_sp3(self, gnss_sv_id, sidx, ipos = 10, \
152154
return func_satpos
153155

154156

155-
def sp3_snapshot(self, func_satpos, cxtime, hstep = 5e-1, method='CubicSpline'):
156-
"""Compute satellite 3-D position and velocity from sp3 interpolated function
157+
def sp3_snapshot(self, func_satpos, cxtime, hstep = 5e-1,
158+
method='CubicSpline'):
159+
"""Compute satellite 3D position and velocity.
160+
161+
Computes from the sp3 interpolated function.
157162
158163
Parameters
159164
----------

0 commit comments

Comments
 (0)