Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gr.load() error on RINEX 2 observation file #88

Open
pietrovermicelli opened this issue Jul 25, 2022 · 5 comments
Open

gr.load() error on RINEX 2 observation file #88

pietrovermicelli opened this issue Jul 25, 2022 · 5 comments

Comments

@pietrovermicelli
Copy link

  1. RINEX OBS 2.11 2.11.
    File: kaza0150.22o.

Traceback (most recent call last):
File "/Users/pietrovermicelli/Desktop/firstpythonproject/RINEX.py", line 5, in
dat = gr.load("/Users/pietrovermicelli/SpacEarth Dropbox/SpacEarth Dropbox/calibrazione_TEC_pietrovermicelli/abpo0210.16o")
File "/Users/pietrovermicelli/.local/share/virtualenvs/firstpythonproject-q2IRJTKJ/lib/python3.10/site-packages/georinex/base.py", line 67, in load
return rinexobs(
File "/Users/pietrovermicelli/.local/share/virtualenvs/firstpythonproject-q2IRJTKJ/lib/python3.10/site-packages/georinex/base.py", line 217, in rinexobs
obs = rinexobs2(
File "/Users/pietrovermicelli/.local/share/virtualenvs/firstpythonproject-q2IRJTKJ/lib/python3.10/site-packages/georinex/obs2.py", line 54, in rinexobs2
obs = xarray.merge((obs, o))
File "/Users/pietrovermicelli/.local/share/virtualenvs/firstpythonproject-q2IRJTKJ/lib/python3.10/site-packages/xarray/core/merge.py", line 1023, in merge
merge_result = merge_core(
File "/Users/pietrovermicelli/.local/share/virtualenvs/firstpythonproject-q2IRJTKJ/lib/python3.10/site-packages/xarray/core/merge.py", line 752, in merge_core
aligned = deep_align(
File "/Users/pietrovermicelli/.local/share/virtualenvs/firstpythonproject-q2IRJTKJ/lib/python3.10/site-packages/xarray/core/alignment.py", line 827, in deep_align
aligned = align(
File "/Users/pietrovermicelli/.local/share/virtualenvs/firstpythonproject-q2IRJTKJ/lib/python3.10/site-packages/xarray/core/alignment.py", line 764, in align
aligner.align()
File "/Users/pietrovermicelli/.local/share/virtualenvs/firstpythonproject-q2IRJTKJ/lib/python3.10/site-packages/xarray/core/alignment.py", line 551, in align
self.align_indexes()
File "/Users/pietrovermicelli/.local/share/virtualenvs/firstpythonproject-q2IRJTKJ/lib/python3.10/site-packages/xarray/core/alignment.py", line 404, in align_indexes
joined_index = joiner(matching_indexes)
File "/Users/pietrovermicelli/.local/share/virtualenvs/firstpythonproject-q2IRJTKJ/lib/python3.10/site-packages/xarray/core/indexes.py", line 442, in join
coord_dtype = np.result_type(self.coord_dtype, other.coord_dtype)
File "<array_function internals>", line 180, in result_type
TypeError: The DType <class 'numpy.dtype[float64]'> could not be promoted by <class 'numpy.dtype[datetime64]'>. This means that no common DType exists for the given inputs. For example they cannot be stored in a single array unless the dtype is object. The full list of DTypes is: (<class 'numpy.dtype[float64]'>, <class 'numpy.dtype[datetime64]'>)
4. the gr.load() used to work just fine until Friday on this observation file, and other Rinex 2.11 obs. However, today I opened my project and I got the error above. I don't get the error while loading the corresponding nav file.

@m-montaqami
Copy link

please use the following versions:
pandas == 0.25.3
numpy == 1.19.0
xarray == 0.12.1

@pietrovermicelli
Copy link
Author

Thank you, I was using differen versions. Although I've found that by enforcing the dtype to be 'object' for coord_type, I don't get that error anymore, and it doesn't seem to compromise the correct reading of the observations.

@gleatd01
Copy link

gleatd01 commented Dec 6, 2022

Thank you, I was using differen versions. Although I've found that by enforcing the dtype to be 'object' for coord_type, I don't get that error anymore, and it doesn't seem to compromise the correct reading of the observations.

Hello, I am relatively new to numpy, how are you enforcing the dtype to be object?

@pietrovermicelli
Copy link
Author

Hi, if you're getting the same error, I think I did something of the kind:
try:
coord_dtype = np.result_type(self.coord_dtype, other.coord_dtype)
except:
coord_dtype = np.dtype('object') #here I am enforcing the type 'object' in case the result_type fails
more on numpy.dtype https://numpy.org/doc/stable/reference/generated/numpy.dtype.html

@gleatd01
Copy link

gleatd01 commented Dec 7, 2022

I ended up using python 3.8 and the above 3 packages. it did work for loading rinex files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants