ratal / mdfreader

Read Measurement Data Format (MDF) versions 3.x and 4.x file formats in python
Other
169 stars 74 forks source link

bug: convert to pandas error with mdf3 test file #74

Closed danielhrisca closed 6 years ago

danielhrisca commented 6 years ago
Traceback (most recent call last):
  File "D:\WinPython-64bit-3.6.2.0Qt5b3\notebooks\untitled7.py", line 13, in <module>
    print(x.convertToPandas())
  File "d:\WinPython-64bit-3.6.2.0Qt5b3\python-3.6.2rc1.amd64\lib\site-packages\mdfreader\mdfreader.py", line 1180, in convertToPandas
    temp[channel] = pd.Series(data, index=time)
  File "d:\WinPython-64bit-3.6.2.0Qt5b3\python-3.6.2rc1.amd64\lib\site-packages\pandas\core\series.py", line 156, in __init__
    index = _ensure_index(index)
  File "d:\WinPython-64bit-3.6.2.0Qt5b3\python-3.6.2rc1.amd64\lib\site-packages\pandas\core\indexes\base.py", line 4027, in _ensure_index
    return Index(index_like)
  File "d:\WinPython-64bit-3.6.2.0Qt5b3\python-3.6.2rc1.amd64\lib\site-packages\pandas\core\indexes\base.py", line 189, in __new__
    dtype=dtype, **kwargs)
  File "d:\WinPython-64bit-3.6.2.0Qt5b3\python-3.6.2rc1.amd64\lib\site-packages\pandas\util\_decorators.py", line 91, in wrapper
    return func(*args, **kwargs)
  File "d:\WinPython-64bit-3.6.2.0Qt5b3\python-3.6.2rc1.amd64\lib\site-packages\pandas\core\indexes\datetimes.py", line 358, in __new__
    subarr = libts.cast_to_nanoseconds(data)
  File "pandas\_libs\tslib.pyx", line 4053, in pandas._libs.tslib.cast_to_nanoseconds (pandas\_libs\tslib.c:69042)
  File "pandas\_libs\tslib.pyx", line 1774, in pandas._libs.tslib._check_dts_bounds (pandas\_libs\tslib.c:32752)
pandas._libs.tslib.OutOfBoundsDatetime: Out of bounds nanosecond timestamp: 4300-10-15 14:08:07

and the script used:

from mdfreader import mdf

x = mdf(r'd:\TMP\test.mdf')

print(x.convertToPandas())
ratal commented 6 years ago

Hi Daniel, time is wrongly defined. Could you print the following ? print(time) print(self.getChannelData(group)) print(datetimeInfo) just before temp[channel] = pd.Series(data, index=time) one of them is probably wrong, most probably time from getChannelData.

ratal commented 6 years ago

Did you try writing mdf4 after reading the mdf3 you mention in issue #73 ?

danielhrisca commented 6 years ago

The input file is the same file as issue #73. I'll send the prints next week

danielhrisca commented 6 years ago

Hello Aymeric, I get None as the output for print(x.convertToPandas())

If this is correct then this issue can be closed

ratal commented 6 years ago

Hi Daniel, I tried axactly same command with your file error.mdf (from issue #67 ) and I get pandas frame, not None. Again having difficulties to reproduce. Same file ?

danielhrisca commented 6 years ago

I've tried this again with the latest commit on Linux and I still get None as the returned value. I also get the same result with the version 4 test file.

3.6.2 (default, Jul 20 2017, 03:52:27)
[GCC 7.1.1 20170630]
Linux-4.9.40-1-MANJARO-x86_64-with-glibc2.3.4
ratal commented 6 years ago

Dear Daniel, Yes I see my mistake. Indeed I could reproduce it by applying exactly your code, I also get None, maybe some issue in mdf_skeleton.str However, the mdf contains dataframes for each raster as expected, you can confirm it with ipython for instance without the print() or doing a print(x) after x.convertToPandas(), not sure yet why.

danielhrisca commented 6 years ago

Looking at the code I see the method doesn't return so it is correct to see None as the print output.