Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 37015df
Author: Michael Hirsch, Ph.D <[email protected]>
Date:   Tue Aug 28 10:57:09 2018 -0400

    windows path

commit 0cf1d83
Author: Michael Hirsch, Ph.D <[email protected]>
Date:   Tue Aug 28 10:52:51 2018 -0400

    windows cwd shell bug workaround

commit 270e31d
Author: Michael Hirsch, Ph.D <[email protected]>
Date:   Tue Aug 28 10:47:19 2018 -0400

    correct windows hatanaka exe name

commit 3a86acb
Author: Michael Hirsch, Ph.D <[email protected]>
Date:   Tue Aug 28 10:26:51 2018 -0400

    skip

commit d83262a
Author: Michael Hirsch, Ph.D <[email protected]>
Date:   Tue Aug 28 10:24:06 2018 -0400

    better crx2rnx detect

commit 023cdc4
Author: Michael Hirsch, Ph.D <[email protected]>
Date:   Tue Aug 28 01:18:03 2018 -0400

    revert

commit 8a1673d
Author: Michael Hirsch, Ph.D <[email protected]>
Date:   Tue Aug 28 01:13:08 2018 -0400

    diag msgs

commit 23fe258
Author: Michael Hirsch, Ph.D <[email protected]>
Date:   Tue Aug 28 01:12:35 2018 -0400

    cleanup

commit d977f9d
Author: Michael Hirsch, Ph.D <[email protected]>
Date:   Tue Aug 28 01:05:12 2018 -0400

    diag msgs

commit f306f4f
Author: Michael Hirsch, Ph.D <[email protected]>
Date:   Tue Aug 28 01:02:18 2018 -0400

    diag msgs

commit 97f62e3
Author: Michael Hirsch, Ph.D <[email protected]>
Date:   Tue Aug 28 00:58:29 2018 -0400

    diag msgs

commit acfdfc5
Author: Michael Hirsch, Ph.D <[email protected]>
Date:   Tue Aug 28 00:56:20 2018 -0400

    diag msgs

commit 06c4ec5
Author: Michael Hirsch, Ph.D <[email protected]>
Date:   Tue Aug 28 00:49:41 2018 -0400

    more tolerant crx2rnx detection

commit 0a60041
Author: Michael Hirsch, Ph.D <[email protected]>
Date:   Tue Aug 28 00:42:55 2018 -0400

    cleanup

commit 8a703ea
Author: Michael Hirsch, Ph.D <[email protected]>
Date:   Tue Aug 28 00:40:47 2018 -0400

    tell windows what CC is

commit 9e255f5
Author: Michael Hirsch, Ph.D <[email protected]>
Date:   Tue Aug 28 00:36:29 2018 -0400

    PATH CI cleanup windows

commit aa46d89
Author: Michael Hirsch, Ph.D <[email protected]>
Date:   Tue Aug 28 00:32:47 2018 -0400

    CI windows chdir first

commit 0d5e459
Author: Michael Hirsch, Ph.D <[email protected]>
Date:   Tue Aug 28 00:31:54 2018 -0400

    CI dir make

commit 4d940e7
Author: Michael Hirsch, Ph.D <[email protected]>
Date:   Tue Aug 28 00:28:10 2018 -0400

    appveyor try compile windows

vers
  • Loading branch information
scivision committed Aug 28, 2018
1 parent 05b5949 commit 3611114
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 9 deletions.
9 changes: 8 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,23 @@ image:
stack: python 3

environment:
MINGW_DIR: C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin
PY_DIR: C:\Python37-x64

clone_depth: 3

build: off

init:
- cmd: set PATH=%MINGW_DIR%;%PATH%
- cmd: set PATH=%PY_DIR%;%PY_DIR%\Scripts;%PATH%
- cmd: set CC=gcc

install: pip install -e .[tests,io]
install:
- cmd: mingw32-make -C rnxcmp
- sh: make -C rnxcmp

- pip install -e .[tests,io]

test_script: pytest -xrsv

16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,22 @@ If you need to use `.crx` Hatanaka compressed RINEX, compile the `crx2rnx` code
make install -C rnxcmp
```

#### Windows
Windows as usual is more difficult to compile code on.
For optional Hatanaka converter, here are some tips.

> cc -O2 source/rnx2crx.c -o rnx2crx
process_begin: CreateProcess(NULL, cc -O2 source/rnx2crx.c -o rnx2crx, ...) failed.
make (e=2): The system cannot find the file specified.

Assuming you have
[installed MinGW compiler on Windows](https://www.scivision.co/windows-gcc-gfortran-cmake-make-install/):
```posh
set CC=gcc
mingw32-make -C rnxcmp
```


## Usage

The simplest command-line use is through the top-level `ReadRinex` script.
Expand Down
5 changes: 4 additions & 1 deletion georinex/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,15 @@ def _opencrx(f: TextIO) -> str:
Nbytes is used to read first line.
"""
exe = './crx2rnx'
shell = False
if os.name == 'nt':
exe = exe[2:]
shell = True

try:
In = f.read()
ret = subprocess.check_output([exe, '-'], input=In,
universal_newlines=True, cwd=R/'rnxcmp')
universal_newlines=True, cwd=R/'rnxcmp', shell=shell)
except FileNotFoundError as e:
raise FileNotFoundError(f'trouble converting Hatanka file, did you compile the crx2rnx program? {e}')

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = georinex
version = 1.6.2
version = 1.6.3
author = Michael Hirsch, Ph.D.
description = Python RINEX 2/3 NAV/OBS reader with speed and simplicity.
url = https://github.com/scivision/georinex
Expand Down
21 changes: 15 additions & 6 deletions tests/test_hatanaka.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,26 @@
from pathlib import Path
import georinex as gr
from datetime import datetime
R = Path(__file__).parent
import os

try:
# capture_output is py >= 3.7
ret = subprocess.run(['crx2rnx', '-h'], stderr=subprocess.PIPE, universal_newlines=True) # -h returncode == 1
R = Path(__file__).parent
Rexe = Path(__file__).resolve().parents[1] / 'rnxcmp'
exe = './crx2rnx'
shell = False
if os.name == 'nt':
exe = exe[2:]
shell = True

try: # capture_output is py >= 3.7
ret = subprocess.run([exe, '-h'], stderr=subprocess.PIPE,
universal_newlines=True, cwd=Rexe, shell=shell) # -h returncode == 1
nocrx = False if ret.stderr.startswith('Usage') else True
except (FileNotFoundError, PermissionError):
except (FileNotFoundError, PermissionError) as e:
print(e)
nocrx = True


@pytest.mark.skipif(nocrx, reason='crx2rnx not found')
@pytest.mark.skipif(nocrx, reason=f'crx2rnx not found in {Rexe}')
@pytest.mark.timeout(30)
def test_obs3():
fn = R / 'CEBR00ESP_R_20182000000_01D_30S_MO.crx.gz'
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
2 changes: 2 additions & 0 deletions tests/test_nav3.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def test_tlim():
def test_qzss():
"""./ReadRinex.py -q tests/qzss3.14n -o r3qzss.nc
"""
pytest.importorskip('netCDF4')

truth = gr.load(R/'r3qzss.nc')
nav = gr.load(R/'qzss3.14n')
assert nav.equals(truth)
Expand Down

0 comments on commit 3611114

Please sign in to comment.