Skip to content

Commit

Permalink
remove NaN values in RinexNav
Browse files Browse the repository at this point in the history
  • Loading branch information
betaBison committed Feb 13, 2024
1 parent c9457b1 commit ec70614
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gnss_lib_py/parsers/rinex_nav.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,11 @@ def _get_ephemeris_dataframe(self, rinex_path, constellations=None):
else:
data = gr.load(rinex_path,
verbose=self.verbose).to_dataframe()
data.dropna(how='all', inplace=True)
data.reset_index(inplace=True)
data_header = gr.rinexheader(rinex_path)
leap_seconds = self.load_leapseconds(data_header)
data['leap_seconds'] = leap_seconds
data.dropna(how='all', inplace=True)
data.reset_index(inplace=True)
data['source'] = rinex_path
data['t_oc'] = pd.to_numeric(data['time'] - consts.GPS_EPOCH_0.replace(tzinfo=None))
data['t_oc'] = 1e-9 * data['t_oc'] - consts.WEEKSEC * np.floor(1e-9 * data['t_oc'] / consts.WEEKSEC)
Expand Down
15 changes: 15 additions & 0 deletions tests/parsers/test_rinex_nav.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,18 @@ def test_no_iono_params(ephem_path):
rinex_path = os.path.join(ephem_path,"rinex","nav",
"BRDM00DLR_S_20230730000_01D_MN_no_gps_iono.rnx")
RinexNav(rinex_path)

def test_nan_removal(ephem_path):
"""Test that NaN values are being removed appropriately.
Parameters
----------
ephem_path : string
Location where ephemeris files are stored/to be downloaded to.
"""

rinex_path = os.path.join(ephem_path,"rinex","nav",
"brdc0730.17n")
rinex_data = RinexNav(rinex_path)
assert rinex_data.shape == (36,4)

0 comments on commit ec70614

Please sign in to comment.