Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit c636c9afe0b9bb7f3487f2b7dfdfdfac49e64b00
Author: Michael Hirsch, Ph.D <[email protected]>
Date:   Mon Aug 13 17:13:34 2018 -0400

    one-liner

commit 8a3153569f905313c9948799b5659b948fb7f794
Author: Michael Hirsch, Ph.D <[email protected]>
Date:   Mon Aug 13 17:09:33 2018 -0400

    boost NAV3 SV rename speed

commit 1415c0040534056b4028cb0e608e4f0e02243068
Author: Michael Hirsch, Ph.D <[email protected]>
Date:   Mon Aug 13 17:07:39 2018 -0400

    boost NAV2 SV rename speed

commit 1b2ec2ea7989818e324233acc75896cfb41c5f36
Author: Michael Hirsch, Ph.D <[email protected]>
Date:   Mon Aug 13 17:05:16 2018 -0400

    boost OBS2 SV rename speed

commit 33e75a71135edb1b80aefc1a1d80435b8a44eb94
Author: Michael Hirsch, Ph.D <[email protected]>
Date:   Mon Aug 13 16:55:11 2018 -0400

    boost OBS3 SV rename speed
  • Loading branch information
scivision committed Aug 13, 2018
1 parent cdbc26f commit 9e2b504
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 23 deletions.
6 changes: 4 additions & 2 deletions georinex/nav2.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def rinexnav2(fn: Path, tlim: Tuple[datetime, datetime]=None) -> xarray.Dataset:
elif time > tlim[1]:
break
# %% format I2 http://gage.upc.edu/sites/default/files/gLAB/HTML/GPS_Navigation_Rinex_v2.11.html
svs.append(f'{svtype}{ln[:2].replace(" ","0")}') # 5x faster than f-strings
svs.append(f'{svtype}{ln[:2]}')

times.append(time)
"""
Expand Down Expand Up @@ -118,7 +118,9 @@ def rinexnav2(fn: Path, tlim: Tuple[datetime, datetime]=None) -> xarray.Dataset:
xarray.Dataset(dsf,
coords={'time': t[svi],
'sv': [sv]})))

# %% patch SV names in case of "G 7" => "G07"
nav = nav.assign_coords(sv=[s.replace(' ', '0') for s in nav.sv.values.tolist()])
# %% other attributes
nav.attrs['version'] = header['version']
nav.attrs['filename'] = fn.name
nav.attrs['rinextype'] = 'nav'
Expand Down
6 changes: 4 additions & 2 deletions georinex/nav3.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def rinexnav3(fn: Path,
continue
# not break due to non-monotonic NAV files

sv = line[:3].replace(' ', '0')
sv = line[:3]
if use is not None and not sv[0] in use:
_skip(f, Nl[sv[0]])
continue
Expand Down Expand Up @@ -128,7 +128,9 @@ def rinexnav3(fn: Path,
else:
nav = xarray.merge((nav,
xarray.Dataset(dsf, coords={'time': tu, 'sv': [sv]})))

# %% patch SV names in case of "G 7" => "G07"
nav = nav.assign_coords(sv=[s.replace(' ', '0') for s in nav.sv.values.tolist()])
# %% other attributes
nav.attrs['version'] = header['version']
nav.attrs['filename'] = fn.name
nav.attrs['svtype'] = svtypes
Expand Down
25 changes: 12 additions & 13 deletions georinex/obs2.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,15 @@ def rinexobs2(fn: Path,
data = xarray.concat((data,
xarray.Dataset(dsf, coords={'time': [time], 'sv': gsv}, attrs={'toffset': toffset})),
dim='time')
# %% patch SV names in case of "G 7" => "G07"
data = data.assign_coords(sv=[s.replace(' ', '0') for s in data.sv.values.tolist()])
# %% other attributes
data.attrs['filename'] = fn.name
data.attrs['version'] = hdr['version']
data.attrs['position'] = hdr['position']
data.attrs['rinextype'] = 'obs'

data.attrs['filename'] = fn.name
data.attrs['version'] = hdr['version']
data.attrs['position'] = hdr['position']
data.attrs['rinextype'] = 'obs'

return data
return data


def _indicators(d: dict, k: str, arr: np.ndarray) -> Dict[str, tuple]:
Expand Down Expand Up @@ -244,19 +246,16 @@ def _getsvind(f: TextIO, ln: str) -> List[str]:
while n > 0:
sv = _getSVlist(f.readline(), min(12, n), sv)
n -= 12
assert Nsv == len(sv), 'satellite list read incorrectly'

if Nsv != len(sv):
raise LookupError('satellite list read incorrectly')

return sv


def _getSVlist(ln: str, N: int, sv: List[str]) -> List[str]:
""" parse a line of text from RINEX2 SV list"""
for i in range(N):
s = ln[32+i*3:35+i*3].strip()
if not s.strip():
raise ValueError(f'did not get satellite names from {ln}')
# %% reformat to assure 0
sv.append(s.replace(' ', '0')) # 5x faster than f-string
sv.extend([ln[32+i*3:35+i*3] for i in range(N)])

return sv

Expand Down
6 changes: 4 additions & 2 deletions georinex/obs3.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def rinexobs3(fn: Path,
sv = []
raw = ''
for i, ln in zip(range(Nsv), f):
sv.append(ln[:3].replace(' ', '0'))
sv.append(ln[:3])
raw += ln[3:]

if tlim is not None:
Expand All @@ -79,7 +79,9 @@ def rinexobs3(fn: Path,

if data is None: # all outside time bounds, etc.
return

# %% patch SV names in case of "G 7" => "G07"
data = data.assign_coords(sv=[s.replace(' ', '0') for s in data.sv.values.tolist()])
# %% other attributes
data.attrs['filename'] = fn.name
data.attrs['version'] = hdr['version']
data.attrs['position'] = hdr['position']
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.0
version = 1.6.0.1
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
6 changes: 3 additions & 3 deletions tests/demo3.10o
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,22 @@ S L1C 0.00000 1 S24 SYS / PHASE SHIFTS
G13 121367582.20508 94572134.49208 23095489.677 9 23095481.949 9 23095483.463 7 42.000 40.000
R19 134357446.85408 23095483.463 7 51.000
G32 34357446.85408 104694102.10708 25567381.585 9 25567371.841 9 25567379.659 7 76.000 84.000
G07 118767195.32608 91018570.22508 22600658.277 9 22600648.232 9 22227666.760 7 57.000 32.000
G 7 118767195.32608 91018570.22508 22600658.277 9 22600648.232 9 22227666.760 7 57.000 32.000
R23 132798887.20808 22600648.288 7 39.000
G31 130586522.29708 101755719.98608 24849779.954 9 24849799.921 9 24849797.341 7 56.000 24.000
G20 135891004.29908 105889081.83208 25859215.981 9 25859207.736 9 25859205.875 7 44.000 46.000
R11 132678281.64008 25247845.883 7 38.000
G12 106712807.73208 83152833.16108 20306772.310 9 20306771.779 9 20306772.510 7 44.000 46.000
G26 116571368.18108 90834826.58108 22182792.370 9 22182793.119 9 22182794.240 7 35.000 27.000
G 9 132197034.89008 103010636.32308 25156289.677 9 25156300.244 9 25156289.059 7 51.000 40.000
G09 132197034.89008 103010636.32308 25156289.677 9 25156300.244 9 25156289.059 7 51.000 40.000
G21 119360658.19908 93008298.09808 22713580.654 9 22713581.674 9 22713580.663 7 78.000 35.000
G15 117320174.24208 91418311.51708 22325286.941 9 22325287.194 9 22325287.806 7 63.000 65.000
S24 195486861.41208 37199916.954 7 45.000
> 2010 03 05 00 00 30.0000000 0 8 -0.123456789012
G13 130321269.80108 101549030.34908 24799319.672 9 24799319.752 9 24799318.768 7 62.000 80.000
R19 129262004.57708 24597748.629 7 47.000
G32 133135049.38708 103741584.18208 25334766.349 9 25334768.879 9 25334766.309 7 75.000 83.000
G07 133174968.81808 103772690.97708 25342359.815 9 25342359.952 9 25342359.370 7 65.000 45.000
G 7 133174968.81808 103772690.97708 25342359.815 9 25342359.952 9 25342359.370 7 65.000 45.000
R23 119323293.47908 22706470.024 7 79.000
G31 114311363.56508 92979182.85108 21752728.352 9 21752728.204 9 21752729.338 7 72.000 63.000
G20 135891004.29908 105889081.83208 25859215.981 9 25859207.736 9 25859205.875 7 44.000 46.000
Expand Down

1 comment on commit 9e2b504

@VOMAY
Copy link
Contributor

@VOMAY VOMAY commented on 9e2b504 Aug 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

Please sign in to comment.