def test_obs2_allsat(): """ ./ReadRinex.py tests/demo.10o -o tests/test2all.nc ./ReadRinex.py tests/demo.10n -o tests/test2all.nc """ print('loading NetCDF4 file') truth = xarray.open_dataset(rdir / 'test2all.nc', group='OBS') print('loaded.') # %% test reading all satellites for u in (None, 'm', 'all', ' ', '', ['G', 'R', 'S']): print('use', u) obs = rinexobs(rdir / 'demo.10o', use=u) assert obs.equals(truth) # %% test read .nc print('load NetCDF via API') obs = rinexobs(rdir / 'test2all.nc') print('testing equality with truth') assert obs.equals(truth) # %% test write .nc print('testing with temp file') with tempfile.TemporaryDirectory() as d: obs = rinexobs(rdir / 'demo.10o', ofn=Path(d) / 'testout.nc')
def test_obs3_allsat(): """ ./ReadRinex.py tests/demo3.10o -o tests/test3all.nc """ obs = rinexobs(rdir / 'demo3.10o') truth = rinexobs(rdir / 'test3all.nc', group='OBS') assert obs.equals(truth)
def test_obs2_twosat(): """./ReadRinex.py tests/demo.10o -u G R -o tests/test2GR.nc""" truth = xarray.open_dataset(rdir / 'test2GR.nc', group='OBS') obs = rinexobs(rdir / 'demo.10o', use=('G', 'R')) assert obs.equals(truth)
def test_obs(): truth = xarray.open_dataarray(str(ofn), group='OBS') blocks, hdr = rinexobs(rdir / 'tests/demo.10o') assert_allclose(blocks, truth)
def test_obs2_onesat(): """./ReadRinex.py tests/demo.10o -u G -o tests/test2G.nc""" truth = xarray.open_dataset(rdir / 'test2G.nc', group='OBS') for u in ('G', ['G']): obs = rinexobs(rdir / 'demo.10o', use=u) assert obs.equals(truth)
def test_obs2_allsat(): """./ReadRinex.py tests/demo.10o -u all -o tests/test2all.nc""" truth = xarray.open_dataset(rdir / 'test2all.nc', group='OBS') # %% test reading all satellites for u in (None, 'm', 'all', ' ', '', ['G', 'R', 'S']): obs = rinexobs(rdir / 'demo.10o', use=u) assert obs.equals(truth) # %% test read .nc obs = rinexobs(rdir / 'test2all.nc') assert obs.equals(truth) # %% test write .nc with tempfile.TemporaryDirectory() as d: obs = rinexobs(rdir / 'demo.10o', ofn=Path(d) / 'testout.nc')
def test_obs3_multisat(): """ ./ReadRinex.py tests/demo3.10o -u G R -o tests/test3GR.nc """ use = ('G', 'R') obs = rinexobs(rdir / 'demo3.10o', use=use) truth = xarray.open_dataset(rdir / 'test3GR.nc', group='OBS') assert obs.equals(truth)
def test_obs(): truth = read_hdf(str(rdir / 'tests/demo.h5'), key='OBS') blocks, hdr = rinexobs(str(rdir / 'tests/demo.10o')) assert_allclose(blocks, truth)
help='Choose to read only the first N INTERVALs of OBS file', type=int) p.add_argument('--profile', help='profile code for debugging', action='store_true') p = p.parse_args() rinexfn = p.rinexfn if rinexfn.lower().endswith('n'): nav = rinexnav(rinexfn, p.outfn) print(nav.head()) elif rinexfn.lower().endswith('o'): if p.profile: import cProfile from pstats import Stats profFN = 'RinexObsReader.pstats' cProfile.run('rinexobs(rinexfn)', profFN) Stats(profFN).sort_stats('time', 'cumulative').print_stats(20) else: data, _ = rinexobs(rinexfn, p.outfn) ax = figure().gca() data.loc['P1', :, :, 'data'].plot(ax=ax) ax.set_xlabel('time [UTC]') ax.set_ylabel('P1') #%% TEC can be made another column (on the last axis) of the blocks array. else: raise ValueError("I dont know what type of file you're trying to read") show()
help='Choose to read only the first N INTERVALs of OBS file', type=int) p.add_argument('--profile', help='profile code for debugging', action='store_true') p = p.parse_args() rinexfn = p.rinexfn if rinexfn.lower().endswith('n'): nav = rinexnav(rinexfn, p.outfn) plotnav(nav) elif rinexfn.lower().endswith('o'): if p.profile: import cProfile from pstats import Stats profFN = 'RinexObsReader.pstats' cProfile.run('rinexobs(rinexfn)', profFN) Stats(profFN).sort_stats('time', 'cumulative').print_stats(20) else: obs, _ = rinexobs(rinexfn, p.outfn) plotobs(obs) #%% TEC can be made another column (on the last axis) of the blocks array. else: raise ValueError( "I dont know what type of file you're trying to read: {}".format( p.rinexfn)) show()