Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_one_sv():
obs = gr.load(R / 'rinex2onesat.10o')
assert len(obs.sv) == 1
assert obs.sv.item() == 'G13'
times = gr.to_datetime(gr.gettime(R/'rinex2onesat.10o'))
assert (times == [datetime(2010, 3, 5, 0, 0), datetime(2010, 3, 5, 0, 0, 30)]).all()
assert obs.fast_processing
def test_blank_times(filename):
times = gr.gettime(R/filename)
assert times.size == 0
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_time():
times = gr.gettime(R/'VILL00ESP_R_20181700000_01D_MN.rnx.gz')
assert times[0] == datetime(2018, 4, 24, 8)
assert times[-1] == datetime(2018, 6, 20, 22)
def test_time():
times = gr.gettime(R/'ab422100.18n')
assert times[0] == datetime(2018, 7, 29, 1, 59, 44)
assert times[-1] == datetime(2018, 7, 30)
def test_obs(rinex_version):
fn = R / f'minimal{rinex_version}.10o'
txt = fn.read_text()
with io.StringIO(txt) as f:
info = gr.rinexinfo(f)
assert info['rinextype'] == 'obs'
times = gr.gettime(f)
obs = gr.load(f)
assert times == datetime(2010, 3, 5, 0, 0, 30)
assert obs.equals(gr.load(fn)), 'StringIO not matching direct file read'
def eachfile(fn: Path, verbose: bool = False):
try:
times = gr.gettime(fn)
except Exception as e:
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}")