Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if verbose:
print(f'{fn.name}: {e}')
return
# %% output
Ntimes = times.size
if Ntimes == 0:
return
ostr = (f"{fn.name}:"
f" {times[0].isoformat()}"
f" {times[-1].isoformat()}"
f" {Ntimes}")
hdr = gr.rinexheader(fn)
interval = hdr.get('interval', np.nan)
if ~np.isnan(interval):
ostr += f" {interval}"
Nexpect = (times[-1] - times[0]) // timedelta(seconds=interval) + 1
if Nexpect != Ntimes:
logging.warning(f'{fn.name}: expected {Nexpect} but got {Ntimes} times')
print(ostr)
if verbose:
print(times)
def test_zip():
fn = R/'ABMF00GLP_R_20181330000_01D_30S_MO.zip'
obs = gr.load(fn)
assert (obs.sv.values == ['E04', 'E09', 'E12', 'E24', 'G02', 'G05', 'G06', 'G07', 'G09', 'G12', 'G13',
'G17', 'G19', 'G25', 'G30', 'R01', 'R02', 'R08', 'R22', 'R23', 'R24', 'S20',
'S31', 'S35', 'S38']).all()
times = gr.gettime(fn)
assert (times == [datetime(2018, 5, 13, 1, 30), datetime(2018, 5, 13, 1, 30, 30), datetime(2018, 5, 13, 1, 31)]).all()
hdr = gr.rinexheader(fn)
assert hdr['t0'] <= times[0]
def test_dont_care_file_extension():
""" GeoRinex ignores the file extension and only considers file headers to determine what a file is."""
fn = R / 'brdc0320.16l.txt'
hdr = gr.rinexheader(R/fn)
assert int(hdr['version']) == 3
nav = gr.load(fn)
assert nav.ionospheric_corr_GAL == approx([139, 0.132, 0.0186])
def test_header(fn, rtype, vers):
if fn.suffix == '.nc' and netCDF4 is None:
pytest.skip('no netCDF4')
hdr = gr.rinexheader(fn)
assert isinstance(hdr, dict)
assert rtype in hdr['rinextype']
assert hdr['version'] == pytest.approx(vers)
# make sure string filenames work too
hdr = gr.rinexheader(str(fn))
assert isinstance(hdr, dict)
def test_header(fn, rtype, vers):
if fn.suffix == '.nc' and netCDF4 is None:
pytest.skip('no netCDF4')
hdr = gr.rinexheader(fn)
assert isinstance(hdr, dict)
assert rtype in hdr['rinextype']
assert hdr['version'] == pytest.approx(vers)
# make sure string filenames work too
hdr = gr.rinexheader(str(fn))
assert isinstance(hdr, dict)