Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""
pytest.importorskip('netCDF4')
truth = xarray.open_dataset(R / 'r2all.nc', group='OBS')
# %% test reading all satellites
obs = gr.load(R/'demo.10o', use=use)
assert obs.equals(truth)
assert obs.fast_processing
assert obs.position == pytest.approx([4789028.4701, 176610.0133, 4195017.031])
try:
assert obs.position_geodetic == approx([41.38871005, 2.11199932, 166.25085213])
except AttributeError: # no pymap3d
pass
# %% test read .nc
obs = gr.rinexobs(R / 'r2all.nc')
assert obs.equals(truth)
# %% test write .nc
outdir = tmp_path
outfn = outdir / 'testout.nc'
gr.rinexobs(R/'demo.10o', outfn=outdir / 'testout.nc')
assert outfn.is_file() and 50000 > outfn.stat().st_size > 30000
def tests_all_indicators():
"""
./ReadRinex.py -q tests/demo3.10o -useindicators -o r3all_indicators.nc
"""
pytest.importorskip('netCDF4')
obs = gr.load(R/'demo3.10o', useindicators=True)
truth = gr.rinexobs(R/'r3all_indicators.nc', group='OBS')
assert obs.equals(truth)
def test_meas_indicators():
"""
./ReadRinex.py tests/demo.10o -useindicators -m C1 -o r2_C1_indicators.nc
"""
pytest.importorskip('netCDF4')
obs = gr.load(R/'demo.10o', meas='C1', useindicators=True)
truth = gr.rinexobs(R/'r2_C1_indicators.nc', group='OBS')
assert obs.equals(truth)
assert obs.fast_processing
def test_all_system():
"""
./ReadRinex.py -q tests/demo3.10o -o r3all.nc
"""
pytest.importorskip('netCDF4')
obs = gr.load(R/'demo3.10o')
truth = gr.rinexobs(R/'r3all.nc', group='OBS')
assert obs.equals(truth)
def test_all_indicators():
"""
./ReadRinex.py tests/demo.10o -useindicators -o r2all_indicators.nc
"""
pytest.importorskip('netCDF4')
obs = gr.load(R/'demo.10o', useindicators=True)
truth = gr.rinexobs(R/'r2all_indicators.nc', group='OBS')
assert obs.equals(truth)
assert obs.fast_processing
obs = gr.load(R/'demo.10o', use=use)
assert obs.equals(truth)
assert obs.fast_processing
assert obs.position == pytest.approx([4789028.4701, 176610.0133, 4195017.031])
try:
assert obs.position_geodetic == approx([41.38871005, 2.11199932, 166.25085213])
except AttributeError: # no pymap3d
pass
# %% test read .nc
obs = gr.rinexobs(R / 'r2all.nc')
assert obs.equals(truth)
# %% test write .nc
outdir = tmp_path
outfn = outdir / 'testout.nc'
gr.rinexobs(R/'demo.10o', outfn=outdir / 'testout.nc')
assert outfn.is_file() and 50000 > outfn.stat().st_size > 30000