georinex icon indicating copy to clipboard operation
georinex copied to clipboard

georinex.read() : Read error for mixed rinex observation files

Open anand-satnav opened this issue 6 years ago • 3 comments

Hello Michael,

I am trying to load measurements from a single GNSS system with the 'use' argument.

The Dataset returned after the load does not contain any data variables

dat = gr.load("cutsamp.16o",meas=['C1C','S1C',],use=['G']) print(dat) Output ... Data variables: *empty*

But when I add more than one GNSS system as part of the 'use' argument it loads the data correctly

dat = gr.load("cutsamp.16o",meas=['C1C','S1C',],use=['G','S']) print(dat) Output ... Data variables: C1C (time, sv) : ... S1C (time, sv) : ...

I have attached the file "cutsamp.16o" for your reference. Note that it is a RINEX 3.02 file cutsamp.zip

anand-satnav avatar May 03 '19 12:05 anand-satnav

I inspected the code and I think I might have found the bug. Please confirm

File : georinex/obs3.py Function : _epoch Line : 204 - 209

When a single satellite system is present in hdr['fields'], the elif condition is triggered calling xarray.concat. Concatenation of data and epoch_data results in an empty dataset since data is empty. This is surprising as I expected it to concatenate all 'epoch_data' information into 'data'

When I remove this elif condition, and re-run the problem is solved . The else condition is triggered calling xarray.merge which correctly merges data and epoch_data

Note The if condition is never triggered in this case since len(data) evaluates to 2 even when it is empty

anand-satnav avatar May 03 '19 15:05 anand-satnav

Thanks for the detailed report, we'll look into this

scivision avatar May 17 '19 22:05 scivision

Sorry for my delay. Using your file:

dat = gr.load("cutsamp.16o",meas=['C1C','S1C',],use=['G'])

results in

<xarray.Dataset>
Dimensions:  (sv: 12, time: 1)
Coordinates:
  * time     (time) datetime64[ns] 2016-01-08
  * sv       (sv) <U3 'G18' 'G07' 'G15' 'G17' 'G20' ... 'G30' 'G05' 'G13' 'G19'
Data variables:
    C1C      (time, sv) float64 2.519e+07 2.588e+07 ... 2.053e+07 2.23e+07
    S1C      (time, sv) float64 35.8 33.0 48.2 49.6 43.2 ... 43.5 42.1 49.9 49.0
Attributes:
    version:            3.02
    interval:           30.0
    rinextype:          obs
    fast_processing:    0
    time_system:        GPS
    filename:           cutsamp.16o
    position:           [-2364337.2971, 4870285.5843, -3360809.8188]
    position_geodetic:  (-32.003888575142994, 115.89479894212391, 24.00298790...

I wonder if something has been fixed in xarray or georinex in the meanwhile. I just tested this with

  • georinex git revision 2a7a614
  • pandas 0.24.2
  • xarray 0.12.1
  • python 3.7.4

scivision avatar Sep 03 '19 19:09 scivision