Beispiel #1
0
def test_mixed():
    fn = R / 'ELKO00USA_R_20182100000_01D_MN.rnx.gz'
    nav = gr.load(fn,
                  tlim=(datetime(2018, 7, 28, 21), datetime(2018, 7, 28, 23)))

    assert isinstance(nav, xarray.Dataset)
    assert sorted(nav.svtype) == ['C', 'E', 'G', 'R']

    times = gr.to_datetime(nav.time)

    assert times.size == 15
    # %% full flle test
    nav = gr.load(fn)
    assert (nav.sv.values == [
        'C06', 'C07', 'C08', 'C11', 'C12', 'C14', 'C16', 'C20', 'C21', 'C22',
        'C27', 'C29', 'C30', 'E01', 'E02', 'E03', 'E04', 'E05', 'E07', 'E08',
        'E09', 'E11', 'E12', 'E14', 'E18', 'E19', 'E21', 'E24', 'E25', 'E26',
        'E27', 'E30', 'E31', 'G01', 'G02', 'G03', 'G04', 'G05', 'G06', 'G07',
        'G08', 'G09', 'G10', 'G11', 'G12', 'G13', 'G14', 'G15', 'G16', 'G17',
        'G18', 'G19', 'G20', 'G21', 'G22', 'G23', 'G24', 'G25', 'G26', 'G27',
        'G28', 'G29', 'G30', 'G31', 'G32', 'R01', 'R02', 'R03', 'R04', 'R05',
        'R06', 'R07', 'R08', 'R09', 'R10', 'R11', 'R12', 'R13', 'R14', 'R15',
        'R16', 'R17', 'R18', 'R19', 'R20', 'R21', 'R22', 'R23', 'R24'
    ]).all()

    C05 = nav.sel(sv='C06').dropna(how='all', dim='time')
    E05 = nav.sel(sv='E05').dropna(how='all', dim='time')

    assert C05.time.size == 3  # from inspection of file
    assert E05.time.size == 22  # duplications in file at same time--> take first time
Beispiel #2
0
def test_galileo():
    nav = gr.load(R / "ceda2100.18e")

    E18 = nav.sel(sv="E18").dropna(dim="time", how="all")
    assert gr.to_datetime(E18.time) == datetime(2018, 7, 29, 12, 40)

    assert E18.to_array().values.squeeze() == approx([
        6.023218797054e-3,
        -2.854960712284e-11,
        0.0,
        76,
        79.53125,
        3.006910964197e-09,
        -1.308337580849,
        6.468966603279e-06,
        1.659004657995e-01,
        3.594905138016e-07,
        5.289377120972e3,
        45600,
        5.243346095085e-06,
        1.437602366755,
        4.358589649200e-06,
        8.809314114035e-01,
        3.329375000000e2,
        1.349316878658,
        -4.092313318419e-09,
        -6.553844422498e-10,
        517,
        2.012000000000e3,
        3.12,
        455,
        1.396983861923e-08,
        1.536682248116e-08,
        47064,
    ])
Beispiel #3
0
def test_tlim_past_eof(fname):
    fn = R / fname
    nav = gr.load(fn, tlim=("2018-07-29T23", "2018-07-29T23:30"))

    times = gr.to_datetime(nav.time)

    assert times == datetime(2018, 7, 29, 23)
Beispiel #4
0
def test_tlim_past_eof():
    fn = R / 'CEDA00USA_R_20182100000_01D_MN.rnx.gz'
    nav = gr.load(fn, tlim=('2018-07-29T23', '2018-07-29T23:30'))

    times = gr.to_datetime(nav.time)

    assert times == datetime(2018, 7, 29, 23)
Beispiel #5
0
def test_mangled():
    fn = R/'14601736.18n'

    nav = gr.load(fn)

    times = gr.to_datetime(nav.time)

    assert times == datetime(2018, 6, 22, 8)
Beispiel #6
0
def test_mangled_times():
    fn = R / 'badtime.10o'

    obs = gr.load(fn)

    times = gr.to_datetime(obs.time)

    assert times
Beispiel #7
0
def test_mangled_times():
    fn = R/'badtime.10o'

    obs = gr.load(fn)

    times = gr.to_datetime(obs.time)

    assert times
Beispiel #8
0
def test_mangled():
    fn = R / "14601736.18n"

    nav = gr.load(fn)

    times = gr.to_datetime(nav.time)

    assert times == datetime(2018, 6, 22, 8)
Beispiel #9
0
def test_interval_obs3(interval, expected_len):

    obs = gr.load(R/'CEDA00USA_R_20182100000_23H_15S_MO.rnx.gz', interval=interval,
                  tlim=('2018-07-29T01:00', '2018-07-29T01:05'))

    times = gr.to_datetime(obs.time)

    assert len(times) == expected_len
Beispiel #10
0
def test_interval_obs3(interval, expected_len):

    obs = gr.load(R / 'CEDA00USA_R_20182100000_23H_15S_MO.rnx.gz',
                  interval=interval,
                  tlim=('2018-07-29T01:00', '2018-07-29T01:05'))

    times = gr.to_datetime(obs.time)

    assert len(times) == expected_len
Beispiel #11
0
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
Beispiel #12
0
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
Beispiel #13
0
def test_mangled_data():
    fn = R/'14601736.18o'

    obs = gr.load(fn)

    times = gr.to_datetime(obs.time)

    assert (times == (datetime(2018, 6, 22, 6, 17, 30),
                      datetime(2018, 6, 22, 6, 17, 45),
                      datetime(2018, 6, 22, 6, 18))).all()

    assert not obs.fast_processing
Beispiel #14
0
def test_mangled_data():
    fn = R/'14601736.18o'

    obs = gr.load(fn)

    times = gr.to_datetime(obs.time)

    assert (times == (datetime(2018, 6, 22, 6, 17, 30),
                      datetime(2018, 6, 22, 6, 17, 45),
                      datetime(2018, 6, 22, 6, 18))).all()

    assert not obs.fast_processing
Beispiel #15
0
def test_obs2():
    pytest.importorskip('unlzw')

    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
Beispiel #16
0
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
Beispiel #17
0
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
Beispiel #18
0
def test_galileo():
    nav = gr.load(R/'ceda2100.18e')

    E18 = nav.sel(sv='E18').dropna(dim='time', how='all')
    assert gr.to_datetime(E18.time) == datetime(2018, 7, 29, 12, 40)

    assert E18.to_array().values.squeeze() == approx([6.023218797054e-3, -2.854960712284e-11, 0.,
                                                      76, 79.53125, 3.006910964197e-09, -1.308337580849, 6.468966603279e-06,
                                                      1.659004657995e-01, 3.594905138016e-07, 5.289377120972e3,
                                                      45600, 5.243346095085e-06, 1.437602366755, 4.358589649200e-06,
                                                      8.809314114035e-01, 3.329375000000e2, 1.349316878658, -4.092313318419e-09,
                                                      -6.553844422498e-10, 517, 2.012000000000e3, 3.12, 455, 1.396983861923e-08,
                                                      1.536682248116e-08, 47064])
Beispiel #19
0
def test_obs3_gz():

    fn = R / "CEBR00ESP_R_20182000000_01D_30S_MO.crx.gz"

    info = gr.rinexinfo(fn)
    assert int(info["version"]) == 3

    # %% full file
    obs = gr.load(fn, tlim=("2018-07-19T01", "2018-07-19T01:10"))

    assert (obs.sv.values == [
        "C05",
        "C10",
        "C14",
        "C22",
        "C31",
        "E01",
        "E04",
        "E09",
        "E11",
        "E19",
        "E21",
        "E31",
        "G02",
        "G05",
        "G07",
        "G13",
        "G15",
        "G21",
        "G24",
        "G28",
        "G30",
        "R03",
        "R04",
        "R05",
        "R13",
        "R14",
        "R15",
        "R16",
        "R21",
        "S20",
        "S23",
        "S25",
        "S47",
        "S48",
    ]).all()

    times = gr.to_datetime(obs.time)

    assert times[0] == datetime(2018, 7, 19, 1)
    assert times[-1] == datetime(2018, 7, 19, 1, 10)
Beispiel #20
0
def test_obs3(suffix):
    fn = R / ("P43300USA_R_20190012056_17M_15S_MO" + suffix)

    info = gr.rinexinfo(fn)

    assert int(info["version"]) == 3
    # %% full file
    obs = gr.load(fn, tlim=("2019-01-01", "2019-01-01T20:57"))

    assert (obs.sv.values == [
        "C08",
        "C19",
        "C20",
        "C22",
        "C32",
        "C36",
        "C37",
        "E02",
        "E03",
        "E05",
        "E08",
        "E24",
        "E25",
        "G01",
        "G03",
        "G06",
        "G09",
        "G14",
        "G16",
        "G22",
        "G23",
        "G26",
        "G31",
        "R01",
        "R02",
        "R08",
        "R10",
        "R11",
        "R12",
        "R17",
        "S31",
        "S33",
        "S35",
        "S38",
    ]).all()

    times = gr.to_datetime(obs.time)

    assert times[0] == datetime(2019, 1, 1, 20, 56, 45)
    assert times[-1] == datetime(2019, 1, 1, 20, 57)
Beispiel #21
0
def test_gps():
    nav = gr.load(R/'brdc2800.15n')

    times = gr.to_datetime(nav.time)
    assert times[1] == datetime(2015, 10, 7, 1, 59, 28)

    nav1 = nav.sel(time='2015-10-07T01:59:28').dropna(dim='sv', how='all')

    assert nav1.to_array().values.squeeze() == approx([-0.488562509417e-04, -0.534328137292e-11, 0.,
                                                       4., 51.125, 0.408659879467e-08, -0.818212975386,
                                                       0.254809856415e-05, 0.463423598558e-02, 0.755488872528e-05,
                                                       0.515362124443e+04, 266368, 0.800937414169e-07, -0.124876382768,
                                                       0.819563865662e-07, 0.978795513619, 244., 0.737626996302,
                                                       -0.794890253227e-08, 0.621454457501e-10, 1., 1865, 0., 2.,
                                                       0., 0.558793544769e-08, 4., 265170, 4.])
Beispiel #22
0
def test_meas_continuation():
    """
    tests OBS2 files with more than 10 types of observations
    """
    fn = R/'ab430140.18o.zip'
    obs = gr.load(fn, verbose=True)

    assert len(obs.data_vars) == 20
    for v in ['L1', 'L2', 'C1', 'P2', 'P1', 'S1', 'S2', 'C2', 'L5', 'C5', 'S5',
              'L6', 'C6', 'S6', 'L7', 'C7', 'S7', 'L8', 'C8', 'S8']:
        assert v in obs

    times = gr.to_datetime(obs.time)
    assert times.size == 9

    assert obs.fast_processing
Beispiel #23
0
def test_mangled2():
    fn = R/'brdc2420.18n.gz'

    nav = gr.load(fn)

    G10 = nav.sel(sv='G10').dropna(dim='time', how='all')
    assert G10['Crc'].values == approx([221.59375, 225.7421875])
    assert np.isnan(G10['FitIntvl'][0])
    assert G10['FitIntvl'][1] == approx(4)

    times = gr.to_datetime(nav.time)
    assert (times == [datetime(2018, 8, 29, 22, 0),
                      datetime(2018, 8, 29, 23, 0),
                      datetime(2018, 8, 29, 23, 30),
                      datetime(2018, 8, 29, 23, 59, 12),
                      datetime(2018, 8, 29, 23, 59, 44)]).all()
Beispiel #24
0
def test_meas_continuation():
    """
    tests OBS2 files with more than 10 types of observations
    """
    fn = R/'ab430140.18o.zip'
    obs = gr.load(fn, verbose=True)

    assert len(obs.data_vars) == 20
    for v in ['L1', 'L2', 'C1', 'P2', 'P1', 'S1', 'S2', 'C2', 'L5', 'C5', 'S5',
              'L6', 'C6', 'S6', 'L7', 'C7', 'S7', 'L8', 'C8', 'S8']:
        assert v in obs

    times = gr.to_datetime(obs.time)
    assert times.size == 9

    assert obs.fast_processing
Beispiel #25
0
def test_tlim(fn, tlim, tref, tlen):
    """
    Important test, be sure it's runnable on all systems
    """
    dat = gr.load(fn, tlim=tlim)

    times = gr.to_datetime(dat.time)

    assert (times == tref).all()

    if dat.rinextype == 'obs' and 2 <= dat.version < 3:
        assert dat.fast_processing

    alltimes = gr.gettime(fn)
    assert isinstance(alltimes, np.ndarray)
    assert alltimes.size == tlen

    assert np.isin(times, alltimes).size == times.size
Beispiel #26
0
def test_mangled2():
    fn = R / "brdc2420.18n.gz"

    nav = gr.load(fn)

    G10 = nav.sel(sv="G10").dropna(dim="time", how="all")
    assert G10["Crc"].values == approx([221.59375, 225.7421875])
    assert np.isnan(G10["FitIntvl"][0])
    assert G10["FitIntvl"][1] == approx(4)

    times = gr.to_datetime(nav.time)
    assert (times == [
        datetime(2018, 8, 29, 22, 0),
        datetime(2018, 8, 29, 23, 0),
        datetime(2018, 8, 29, 23, 30),
        datetime(2018, 8, 29, 23, 59, 12),
        datetime(2018, 8, 29, 23, 59, 44),
    ]).all()
Beispiel #27
0
def test_tlim(fn, tlim, tref, tlen):
    """
    Important test, be sure it's runnable on all systems
    """
    dat = gr.load(fn, tlim=tlim)

    times = gr.to_datetime(dat.time)

    assert (times == tref).all()

    if dat.rinextype == 'obs' and 2 <= dat.version < 3:
        assert dat.fast_processing

    alltimes = gr.gettime(fn)
    assert isinstance(alltimes, np.ndarray)
    assert alltimes.size == tlen

    assert np.isin(times, alltimes).size == times.size
Beispiel #28
0
def test_obs3():
    fn = R / 'P43300USA_R_20190012056_17M_15S_MO.crx'

    info = gr.rinexinfo(fn)

    assert int(info['version']) == 3
    # %% full file
    obs = gr.load(fn, tlim=('2019-01-01', '2019-01-01T20:57'))

    assert (obs.sv.values == [
        'C08', 'C19', 'C20', 'C22', 'C32', 'C36', 'C37', 'E02', 'E03', 'E05',
        'E08', 'E24', 'E25', 'G01', 'G03', 'G06', 'G09', 'G14', 'G16', 'G22',
        'G23', 'G26', 'G31', 'R01', 'R02', 'R08', 'R10', 'R11', 'R12', 'R17',
        'S31', 'S33', 'S35', 'S38'
    ]).all()

    times = gr.to_datetime(obs.time)

    assert times[0] == datetime(2019, 1, 1, 20, 56, 45)
    assert times[-1] == datetime(2019, 1, 1, 20, 57)
Beispiel #29
0
def test_obs3():
    if not gr.crxexe():
        pytest.skip(f'crx2rnx not found')

    fn = R / 'P43300USA_R_20190012056_17M_15S_MO.crx'

    info = gr.rinexinfo(fn)

    assert int(info['version']) == 3
# %% full file
    obs = gr.load(fn, tlim=('2019-01-01', '2019-01-01T20:57'))

    assert (obs.sv.values == ['C08', 'C19', 'C20', 'C22', 'C32', 'C36', 'C37', 'E02', 'E03',
                              'E05', 'E08', 'E24', 'E25', 'G01', 'G03', 'G06', 'G09', 'G14',
                              'G16', 'G22', 'G23', 'G26', 'G31', 'R01', 'R02', 'R08', 'R10',
                              'R11', 'R12', 'R17', 'S31', 'S33', 'S35', 'S38']).all()

    times = gr.to_datetime(obs.time)

    assert times[0] == datetime(2019, 1, 1, 20, 56, 45)
    assert times[-1] == datetime(2019, 1, 1, 20, 57)
Beispiel #30
0
def test_obs3_gz():

    fn = R / 'CEBR00ESP_R_20182000000_01D_30S_MO.crx.gz'

    info = gr.rinexinfo(fn)
    assert int(info['version']) == 3

    if not gr.crxexe():
        pytest.skip(f'crx2rnx not found')
# %% full file
    obs = gr.load(fn, tlim=('2018-07-19T01', '2018-07-19T01:10'))

    assert (obs.sv.values == ['C05', 'C10', 'C14', 'C22', 'C31', 'E01', 'E04', 'E09', 'E11',
                              'E19', 'E21', 'E31', 'G02', 'G05', 'G07', 'G13', 'G15', 'G21',
                              'G24', 'G28', 'G30', 'R03', 'R04', 'R05', 'R13', 'R14', 'R15',
                              'R16', 'R21', 'S20', 'S23', 'S25', 'S47', 'S48']).all()

    times = gr.to_datetime(obs.time)

    assert times[0] == datetime(2018, 7, 19, 1)
    assert times[-1] == datetime(2018, 7, 19, 1, 10)
Beispiel #31
0
def test_meas_continuation():
    """
    tests OBS2 files with more than 10 types of observations
    """
    fn = R / "ab430140.18o.zip"
    obs = gr.load(fn, verbose=True)

    assert len(obs.data_vars) == 20
    for v in [
            "L1",
            "L2",
            "C1",
            "P2",
            "P1",
            "S1",
            "S2",
            "C2",
            "L5",
            "C5",
            "S5",
            "L6",
            "C6",
            "S6",
            "L7",
            "C7",
            "S7",
            "L8",
            "C8",
            "S8",
    ]:
        assert v in obs

    times = gr.to_datetime(obs.time)
    assert times.size == 9

    assert obs.fast_processing
Beispiel #32
0
def test_tlim_past_eof():
    nav = gr.load(R/'p1462100.18g', tlim=('2018-07-29T23:45', '2018-07-30'))

    times = gr.to_datetime(nav.time)

    assert times == datetime(2018, 7, 29, 23, 45)
Beispiel #33
0
def test_to_datetime(time, exp_time):
    assert gr.to_datetime(time) == exp_time
Beispiel #34
0
def test_interval_obs2(interval, expected_len):
    obs = gr.load(R / 'ab430140.18o.zip', interval=interval)
    times = gr.to_datetime(obs.time)

    assert len(times) == expected_len
Beispiel #35
0
def test_to_datetime(time, exp_time):
    assert gr.to_datetime(time) == exp_time
Beispiel #36
0
def test_interval_obs2(interval, expected_len):
    obs = gr.load(R/'ab430140.18o.zip', interval=interval)
    times = gr.to_datetime(obs.time)

    assert len(times) == expected_len
Beispiel #37
0
def test_mixed(fname):
    fn = R / fname
    nav = gr.load(fn, tlim=(datetime(2018, 7, 28, 21), datetime(2018, 7, 28, 23)))

    E04 = nav.sel(sv="E04").dropna(dim="time", how="all")
    E04_1 = nav.sel(sv="E04_1").dropna(dim="time", how="all")

    E04tt = E04["TransTime"].values
    E04_1tt = E04_1["TransTime"].values

    assert E04tt != approx(E04_1tt)

    assert isinstance(nav, xarray.Dataset)
    assert set(nav.svtype) == {"C", "E", "G", "R"}

    times = gr.to_datetime(nav.time)

    assert times.size == 15
    # %% full flle test
    nav = gr.load(fn)

    svin = {
        "C06",
        "C07",
        "C08",
        "C11",
        "C12",
        "C14",
        "C16",
        "C20",
        "C21",
        "C22",
        "C27",
        "C29",
        "C30",
        "E01",
        "E02",
        "E03",
        "E04",
        "E05",
        "E07",
        "E08",
        "E09",
        "E11",
        "E12",
        "E14",
        "E18",
        "E19",
        "E21",
        "E24",
        "E25",
        "E26",
        "E27",
        "E30",
        "E31",
        "G01",
        "G02",
        "G03",
        "G04",
        "G05",
        "G06",
        "G07",
        "G08",
        "G09",
        "G10",
        "G11",
        "G12",
        "G13",
        "G14",
        "G15",
        "G16",
        "G17",
        "G18",
        "G19",
        "G20",
        "G21",
        "G22",
        "G23",
        "G24",
        "G25",
        "G26",
        "G27",
        "G28",
        "G29",
        "G30",
        "G31",
        "G32",
        "R01",
        "R02",
        "R03",
        "R04",
        "R05",
        "R06",
        "R07",
        "R08",
        "R09",
        "R10",
        "R11",
        "R12",
        "R13",
        "R14",
        "R15",
        "R16",
        "R17",
        "R18",
        "R19",
        "R20",
        "R21",
        "R22",
        "R23",
        "R24",
    }
    assert len(svin.intersection(nav.sv.values)) == len(svin)

    C05 = nav.sel(sv="C06").dropna(how="all", dim="time")
    E05 = nav.sel(sv="E05").dropna(how="all", dim="time")

    assert C05.time.size == 3  # from inspection of file
    assert E05.time.size == 22  # duplications in file at same time--> take first time
Beispiel #38
0
def test_tlim_past_eof():
    nav = gr.load(R / "p1462100.18g", tlim=("2018-07-29T23:45", "2018-07-30"))

    times = gr.to_datetime(nav.time)

    assert times == datetime(2018, 7, 29, 23, 45)