How to use georinex - 10 common examples

To help you get started, we’ve selected a few georinex examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github scivision / georinex / TimeRinex.py View on Github external
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)
github scivision / georinex / tests / test_sp3.py View on Github external
def test_sp3c():
    dat = gr.load(R / "igs19362.sp3")

    d0 = dat.sel(time="2017-02-14T00:15:00")

    assert len(d0.sv) == 32

    G20 = d0.sel(sv="G20")

    assert G20["position"].values == approx([-6468.900825, 14715.965428, 20990.8862])
    assert G20.clock.item() == approx(459.946483)
github scivision / georinex / tests / test_conv.py View on Github external
def test_netcdf_write(tmp_path):
    """
    NetCDF4 wants suffix .nc -- arbitrary tempfile.NamedTemporaryFile names do NOT work!
    """
    pytest.importorskip('netCDF4')

    fn = tmp_path / 'rw.nc'
    obs = gr.load(R/'demo.10o', out=fn)

    wobs = gr.load(fn)

    assert obs.equals(wobs)
github scivision / georinex / tests / test_sp3.py View on Github external
def test_minimal_sp3c():
    dat = gr.load(R / "minimal.sp3c")

    d0 = dat.sel(time="2017-02-14T00:00:00")

    assert len(d0.sv) == 32

    G20 = d0.sel(sv="G20")

    assert G20["position"].values == approx([-4091.382501, 15329.987734, 21147.362623])
    assert G20.clock.item() == approx(459.944522)
github scivision / georinex / tests / test_obs2.py View on Github external
def test_one_system(use):
    """./ReadRinex.py tests/demo.10o -u G -o r2G.nc
    """
    pytest.importorskip('netCDF4')

    truth = xarray.open_dataset(R / 'r2G.nc', group='OBS')

    obs = gr.load(R/'demo.10o', use=use)
    assert obs.equals(truth)
    assert obs.fast_processing
github scivision / georinex / tests / test_lzw.py View on Github external
def test_obs2_lzw():
    pytest.importorskip('unlzw3')

    fn = R / 'ac660270.18o.Z'

    obs = gr.load(fn)

    hdr = gr.rinexheader(fn)

    assert hdr['t0'] <= gr.to_datetime(obs.time[0])

    assert not obs.fast_processing
github scivision / georinex / tests / test_nav2.py View on Github external
def test_ionospheric_correction():
    nav = gr.load(R/"14601736.18n")
    assert nav.attrs['ionospheric_corr_GPS'] == approx(
                    [0.4657e-08,  0.1490e-07, -0.5960e-07, -0.1192e-06,
                     0.8192e+05,  0.9830e+05, -0.6554e+05, -0.5243e+06])
github scivision / georinex / tests / test_conv.py View on Github external
def test_nc_load(dtype):
    pytest.importorskip('netCDF4')

    truth = xarray.open_dataset(R/'r2all.nc', group=dtype)

    obs = gr.load(R/f'demo.10{dtype[0].lower()}')
    assert obs.equals(truth)
github scivision / georinex / tests / test_conv.py View on Github external
def test_bad_files(tmp_path):
    emptyfn = tmp_path/'nonexistingfilename'
    emptyfn.touch()
    emptyfnrinex = tmp_path/'nonexistingfilename.18o'
    emptyfnrinex.touch()
    emptyfnNC = tmp_path/'nonexistingfilename.nc'
    emptyfnNC.touch()

    nonexist = tmp_path/'nonexist'  # don't touch

    with pytest.raises(ValueError):
        gr.load(emptyfn)

    with pytest.raises(ValueError):
        gr.load(emptyfnrinex)

    with pytest.raises(FileNotFoundError):
        gr.load(nonexist)

    with pytest.raises(ValueError):
        gr.load(emptyfnNC)
github scivision / georinex / tests / test_conv.py View on Github external
def test_to_datetime(time, exp_time):
    assert gr.to_datetime(time) == exp_time