Skip to content

Commit b4de7cb

Browse files
committed
streamline test
1 parent ebde618 commit b4de7cb

File tree

2 files changed

+33
-14
lines changed

2 files changed

+33
-14
lines changed

README.md

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.2580306.svg)](https://doi.org/10.5281/zenodo.2580306)
44
![ci](https://github.com/geospace-code/georinex/workflows/ci/badge.svg)
55
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/scivision/georinex.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/scivision/georinex/context:python)
6-
[![PyPi versions](https://img.shields.io/pypi/pyversions/georinex.svg)](https://pypi.python.org/pypi/georinex)
76
[![PyPi Download stats](http://pepy.tech/badge/georinex)](http://pepy.tech/project/georinex)
87

98
RINEX 3 and RINEX 2 reader and batch conversion to NetCDF4 / HDF5 in Python or Matlab.
@@ -112,6 +111,7 @@ Time bounds can be set for reading -- load only data between those time bounds:
112111
```sh
113112
--tlim start stop
114113
```
114+
115115
option, where `start` and `stop` are formatted like `2017-02-23T12:00`
116116

117117
```python
@@ -121,20 +121,20 @@ dat = gr.load('my.rnx', tlim=['2017-02-23T12:59', '2017-02-23T13:13'])
121121
### Measurement selection
122122

123123
Further speed increase can arise from reading only wanted measurements:
124+
124125
```sh
125126
--meas C1C L1C
126127
```
127128

128-
129129
```python
130130
dat = gr.load('my.rnx', meas=['C1C', 'L1C'])
131131
```
132132

133133
### Use Signal and Loss of Lock indicators
134+
134135
By default, the SSI and LLI (loss of lock indicators) are not loaded to speed up the program and save memory.
135136
If you need them, the `-useindicators` option loads SSI and LLI for OBS 2/3 files.
136137

137-
138138
## read RINEX
139139

140140
This convenience function reads any possible format (including compressed, Hatanaka) RINEX 2/3 OBS/NAV or `.nc` file:
@@ -143,19 +143,22 @@ This convenience function reads any possible format (including compressed, Hatan
143143
obs = gr.load('tests/demo.10o')
144144
```
145145

146-
147146
### read times in OBS, NAV file(s)
147+
148148
Print start, stop times and measurement interval in a RINEX OBS or NAV file:
149+
149150
```sh
150151
TimeRinex ~/my.rnx
151152
```
152153

153154
Print start, stop times and measurement interval for all files in a directory:
155+
154156
```sh
155157
TimeRinex ~/data *.rnx
156158
```
157159

158160
Get vector of `datetime.datetime` in RINEX file:
161+
159162
```python
160163
times = gr.gettimes('~/my.rnx')
161164
```
@@ -180,9 +183,10 @@ only certain fields are valid for particular satellite systems.
180183
Not every receiver receives every type of GNSS system.
181184
Most Android devices in the Americas receive at least GPS and GLONASS.
182185

183-
184186
### read OBS header
185-
To get a `dict()` of the RINEX file header:
187+
188+
Get a `dict()` of the RINEX file header:
189+
186190
```python
187191
hdr = gr.rinexheader('myfile.rnx')
188192
```
@@ -191,33 +195,39 @@ hdr = gr.rinexheader('myfile.rnx')
191195

192196
assume the OBS data from a file is loaded in variable `obs`.
193197

194-
Select satellite(s) (here, `G13`) by
198+
Select satellite(s) (here, `G13`)
199+
195200
```python
196201
obs.sel(sv='G13').dropna(dim='time',how='all')
197202
```
198203

199204
Pick any parameter (say, `L1`) across all satellites and time (or index via `.sel()` by time and/or satellite too) by:
205+
200206
```python
201207
obs['L1'].dropna(dim='time',how='all')
202208
```
203209

204210
Indexing only a particular satellite system (here, Galileo) using Boolean indexing.
211+
205212
```python
206213
import georinex as gr
207214
obs = gr.load('myfile.o', use='E')
208215
```
209-
would load only Galileo data by the parameter E.
216+
217+
loads only Galileo data by the parameter E.
210218
`ReadRinex` allow this to be specified as the -use command line parameter.
211219

212220
If however you want to do this after loading all the data anyway, you can make a Boolean indexer
221+
213222
```python
214223
Eind = obs.sv.to_index().str.startswith('E') # returns a simple Numpy Boolean 1-D array
215224
Edata = obs.isel(sv=Eind) # any combination of other indices at same time or before/after also possible
216225
```
217226

218-
### Plot OBS data
227+
### Plot OBS data
219228

220229
Plot for all satellites L1C:
230+
221231
```python
222232
from matplotlib.pyplot import figure, show
223233
ax = figure().gca()
@@ -226,31 +236,33 @@ show()
226236
```
227237

228238
Suppose L1C pseudorange plot is desired for `G13`:
239+
229240
```python
230241
obs['L1C'].sel(sv='G13').dropna(dim='time',how='all').plot()
231242
```
232243

233244
## read Nav
234245

235-
236246
If you desire to specifically read a RINEX 2 or 3 NAV file:
247+
237248
```python
238249
nav = gr.load('tests/demo_MN.rnx')
239250
```
240251

241-
This returns an `xarray.Dataset` of the data within the RINEX 3 or RINEX 2 Navigation file.
252+
Returns an `xarray.Dataset` of the data within the RINEX 3 or RINEX 2 Navigation file.
242253
Indexed by time x quantity
243254

244-
245255
### Index NAV data
246256

247257
assume the NAV data from a file is loaded in variable `nav`.
248258
Select satellite(s) (here, `G13`) by
259+
249260
```python
250261
nav.sel(sv='G13')
251262
```
252263

253264
Pick any parameter (say, `M0`) across all satellites and time (or index by that first) by:
265+
254266
```python
255267
nav['M0']
256268
```
@@ -260,24 +272,31 @@ A significant reason for using `xarray` as the base class of GeoRinex is that bi
260272
It's suggested to load the original RINEX files with the `-use` or `use=` option to greatly speed loading and conserve memory.
261273

262274
A copy of the processed data can be saved to NetCDF4 for fast reloading and out-of-core processing by:
275+
263276
```python
264277
obs.to_netcdf('process.nc', group='OBS')
265278
```
279+
266280
`georinex.__init.py__` shows examples of using compression and other options if desired.
267281

268282
### Join data from multiple files
283+
269284
Please see documentation for `xarray.concat` and `xarray.merge` for more details.
270285
Assuming you loaded OBS data from one file into `obs1` and data from another file into `obs2`, and the data needs to be concatenated in time:
286+
271287
```python
272288
obs = xarray.concat((obs1, obs2), dim='time')
273289
```
290+
274291
The `xarray.concat`operation may fail if there are different SV observation types in the files.
275292
you can try the more general:
293+
276294
```python
277295
obs = xarray.merge((obs1, obs2))
278296
```
279297

280298
### Receiver location
299+
281300
While `APPROX LOCATION XYZ` gives ECEF location in RINEX OBS files, this is OPTIONAL for moving platforms.
282301
If available, the `location` is written to the NetCDF4 / HDF5 output file on conversion.
283302
To convert ECEF to Latitude, Longitude, Altitude or other coordinate systems, use

src/georinex/tests/test_nav3.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def test_mixed():
3838
assert E04tt != approx(E04_1tt)
3939

4040
assert isinstance(nav, xarray.Dataset)
41-
assert sorted(nav.svtype) == ["C", "E", "G", "R"]
41+
assert set(nav.svtype) == {"C", "E", "G", "R"}
4242

4343
times = gr.to_datetime(nav.time)
4444

@@ -175,7 +175,7 @@ def test_large(filename, sv, shape):
175175
def test_large_all(sv, size):
176176
fn = R / "VILL00ESP_R_20181700000_01D_MN.rnx.gz"
177177
nav = gr.load(fn)
178-
assert sorted(nav.svtype) == ["C", "E", "G", "R", "S"]
178+
assert set(nav.svtype) == {"C", "E", "G", "R", "S"}
179179

180180
dat = nav.sel(sv=sv).dropna(how="all", dim="time").to_dataframe()
181181
assert dat.shape[0] == size # manually counted from file

0 commit comments

Comments
 (0)