Skip to content

Commit 1ae992d

Browse files
authored
Merge pull request #156 from Stanford-NavLab/derek/rinex-nan-removal
remove NaN values in RinexNav
2 parents c9457b1 + ec70614 commit 1ae992d

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

gnss_lib_py/parsers/rinex_nav.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,11 @@ def _get_ephemeris_dataframe(self, rinex_path, constellations=None):
204204
else:
205205
data = gr.load(rinex_path,
206206
verbose=self.verbose).to_dataframe()
207+
data.dropna(how='all', inplace=True)
208+
data.reset_index(inplace=True)
207209
data_header = gr.rinexheader(rinex_path)
208210
leap_seconds = self.load_leapseconds(data_header)
209211
data['leap_seconds'] = leap_seconds
210-
data.dropna(how='all', inplace=True)
211-
data.reset_index(inplace=True)
212212
data['source'] = rinex_path
213213
data['t_oc'] = pd.to_numeric(data['time'] - consts.GPS_EPOCH_0.replace(tzinfo=None))
214214
data['t_oc'] = 1e-9 * data['t_oc'] - consts.WEEKSEC * np.floor(1e-9 * data['t_oc'] / consts.WEEKSEC)

tests/parsers/test_rinex_nav.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,3 +205,18 @@ def test_no_iono_params(ephem_path):
205205
rinex_path = os.path.join(ephem_path,"rinex","nav",
206206
"BRDM00DLR_S_20230730000_01D_MN_no_gps_iono.rnx")
207207
RinexNav(rinex_path)
208+
209+
def test_nan_removal(ephem_path):
210+
"""Test that NaN values are being removed appropriately.
211+
212+
Parameters
213+
----------
214+
ephem_path : string
215+
Location where ephemeris files are stored/to be downloaded to.
216+
217+
"""
218+
219+
rinex_path = os.path.join(ephem_path,"rinex","nav",
220+
"brdc0730.17n")
221+
rinex_data = RinexNav(rinex_path)
222+
assert rinex_data.shape == (36,4)

0 commit comments

Comments
 (0)