cgq-qgc / HydroSensorReader

This project provides tools to read files from probes, sensors, or anything used in hydrogeology.
MIT License
8 stars 2 forks source link

Bug when trying to load a data file from a Solinst gold level or barologger #26

Closed jnsebgosselin closed 6 years ago

jnsebgosselin commented 6 years ago

image

The reason is that the header is not formatted the same and there is an additional index column in the data section.

A PR is on the way to fix that and add a test to cover that.

Traceback (most recent call last):

  File "<ipython-input-2-db1578e43be4>", line 1, in <module>
    runfile('C:/Users/User/OneDrive/Research/PostDoc - MDDELCC/Analyses Baro/hydrosensor.py', wdir='C:/Users/User/OneDrive/Research/PostDoc - MDDELCC/Analyses Baro')

  File "C:\Users\User\spyder-kernels\spyder_kernels\customize\spydercustomize.py", line 709, in runfile
    execfile(filename, namespace)

  File "C:\Users\User\spyder-kernels\spyder_kernels\customize\spydercustomize.py", line 108, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "C:/Users/User/OneDrive/Research/PostDoc - MDDELCC/Analyses Baro/hydrosensor.py", line 45, in <module>
    solinst_file = hsr.SolinstFileReader(fpath)

  File "C:\Users\User\HydroSensorReader\hydsensread\file_reader\compagny_file_reader\solinst_file_reader.py", line 28, in __init__
    self.__set_reader(wait_read)

  File "C:\Users\User\HydroSensorReader\hydsensread\file_reader\compagny_file_reader\solinst_file_reader.py", line 39, in __set_reader
    self._file, wait_read=wait_read)

  File "C:\Users\User\HydroSensorReader\hydsensread\file_reader\compagny_file_reader\solinst_file_reader.py", line 328, in __init__
    super().__init__(file_path, header_length, wait_read=wait_read)

  File "C:\Users\User\HydroSensorReader\hydsensread\file_reader\abstract_file_reader.py", line 193, in __init__
    self.read_file()

  File "C:\Users\User\HydroSensorReader\hydsensread\file_reader\abstract_file_reader.py", line 123, in read_file
    self._make_site()

  File "C:\Users\User\HydroSensorReader\hydsensread\file_reader\abstract_file_reader.py", line 149, in _make_site
    self._read_file_data_header()

  File "C:\Users\User\HydroSensorReader\hydsensread\file_reader\compagny_file_reader\solinst_file_reader.py", line 347, in _read_file_data_header
    self._date_list = self._get_date_list()

  File "C:\Users\User\HydroSensorReader\hydsensread\file_reader\compagny_file_reader\solinst_file_reader.py", line 382, in _get_date_list
    _date_datetime = Timestamp(date_format_string.format(*line[:cells_to_check]))

IndexError: tuple index out of range
jnsebgosselin commented 6 years ago

image