Пример #1
0
def test_all_systems(tmp_path, use):
    """
    ./ReadRinex.py tests/demo.10o -o r2all.nc
    ./ReadRinex.py tests/demo.10n -o r2all.nc
    """
    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
Пример #2
0
def test_all_systems(tmp_path, use):
    """
    ./ReadRinex.py tests/demo.10o -o r2all.nc
    ./ReadRinex.py tests/demo.10n -o r2all.nc
    """
    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
Пример #3
0
def test_all_systems():
    """
    ./ReadRinex.py tests/demo.10o -o r2all.nc
    ./ReadRinex.py tests/demo.10n -o r2all.nc
    """
    pytest.importorskip('netCDF4')

    truth = xarray.open_dataset(R / 'r2all.nc', group='OBS', autoclose=True)
    # %% test reading all satellites
    for u in (None, ' ', '', ['G', 'R', 'S']):
        print('use', u)
        obs = gr.load(R / 'demo.10o', use=u)
        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
    with tempfile.TemporaryDirectory() as d:
        outfn = Path(d) / 'testout.nc'
        gr.rinexobs(R / 'demo.10o', outfn=Path(d) / 'testout.nc')
        assert outfn.is_file() and 50000 > outfn.stat().st_size > 30000
Пример #4
0
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)
Пример #5
0
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)
Пример #6
0
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)
Пример #7
0
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)
Пример #8
0
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)
Пример #9
0
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)
Пример #10
0
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
Пример #11
0
def test_meas_indicators():
    """
    python -m georinex.read 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
Пример #12
0
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