Skip to content

Commit

Permalink
better crx2rnx detect
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Aug 28, 2018
1 parent 023cdc4 commit d83262a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions georinex/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def _opencrx(f: TextIO) -> str:
exe = './crx2rnx'
if os.name == 'nt':
exe = exe[2:]

try:
In = f.read()
ret = subprocess.check_output([exe, '-'], input=In,
Expand Down
7 changes: 6 additions & 1 deletion tests/test_hatanaka.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@
from pathlib import Path
import georinex as gr
from datetime import datetime
import os

R = Path(__file__).parent
Rexe = Path(__file__).resolve().parents[1] / 'rnxcmp'
exe = './crx2rnx'
if os.name == 'nt':
exe = exe[:2]

try: # capture_output is py >= 3.7
ret = subprocess.run(['crx2rnx', '-h'], stderr=subprocess.PIPE,
ret = subprocess.run([exe, '-h'], stderr=subprocess.PIPE,
universal_newlines=True, cwd=Rexe) # -h returncode == 1
nocrx = False if ret.stderr.startswith('Usage') else True
except (FileNotFoundError, PermissionError) as e:
Expand Down
10 changes: 10 additions & 0 deletions tests/test_nav2.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@


def test_time():
pytest.importorskip('unlzw')

times = gr.gettime(R/'ab422100.18n.Z').values.astype('datetime64[us]').astype(datetime)

assert times[0] == datetime(2018, 7, 29, 1, 59, 44)
assert times[-1] == datetime(2018, 7, 30)


def test_data():
pytest.importorskip('unlzw')

nav = gr.load(R/'ab422100.18n.Z')

nav0 = nav.sel(time='2018-07-29T03:59:44').dropna(dim='sv', how='all')
Expand All @@ -43,6 +47,8 @@ def test_mangled():


def test_tlim():
pytest.importorskip('unlzw')

nav = gr.load(R/'ceda2100.18e.Z', tlim=('2018-07-29T11', '2018-07-29T12'))

times = nav.time.values.astype('datetime64[us]').astype(datetime)
Expand All @@ -57,6 +63,8 @@ def test_tlim():


def test_galileo():
pytest.importorskip('unlzw')

nav = gr.load(R/'ceda2100.18e.Z')

E18 = nav.sel(sv='E18').dropna(dim='time', how='all')
Expand All @@ -72,6 +80,8 @@ def test_galileo():


def test_gps():
pytest.importorskip('unlzw')

nav = gr.load(R/'brdc2800.15n.Z')

times = nav.time.values.astype('datetime64[us]').astype(datetime).tolist()
Expand Down

0 comments on commit d83262a

Please sign in to comment.