def test_rnx_nav_unknown_version(content): with NamedTemporaryFile(mode='w') as tmp_file: tmp_file.writelines(content) tmp_file.seek(0) with pytest.raises(RinexNavFileError, match=r'Version \S+ is not supported.'): rnx_nav(filename=tmp_file.name)
def read_nav_data(filename): """Returns dictionary which contains navigation data from the file. Navigation records are sorted by epoch. """ nav_data = defaultdict(list) for row in rnx_nav(filename): satellite, number, epoch, sv_clock, message = row record = {'epoch': epoch, 'message': message} nav_data[(satellite, number)].append(record) for sat in nav_data: nav_data[sat].sort(key=itemgetter('epoch')) return nav_data
def test_rnx_nav_v2(nav_file_v2): with nav_file_v2 as filename: nav = rnx_nav(filename) assert isinstance(nav, RinexNavFileV2)
def test_rnx_nav(content, expected_type): with NamedTemporaryFile(mode='w') as tmp_file: tmp_file.writelines(content) tmp_file.seek(0) obj = rnx_nav(filename=tmp_file.name) assert isinstance(obj, expected_type)