From 120e479a920b627483787893db3595c6832dbe17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20Gosselin?= Date: Mon, 10 Feb 2020 14:02:08 -0500 Subject: [PATCH 1/3] Dont'undo altitude systematically --- .../file_reader/compagny_file_reader/solinst_file_reader.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hydsensread/file_reader/compagny_file_reader/solinst_file_reader.py b/hydsensread/file_reader/compagny_file_reader/solinst_file_reader.py index 4b256fd..40d706e 100644 --- a/hydsensread/file_reader/compagny_file_reader/solinst_file_reader.py +++ b/hydsensread/file_reader/compagny_file_reader/solinst_file_reader.py @@ -143,7 +143,6 @@ def _read_file_data(self): self._get_data() self._format_data_units() self._undo_zero_point_offset() - self._undo_altitude_correction() # ---- Private API def _format_data_units(self): @@ -157,7 +156,7 @@ def _format_data_units(self): columns_map[column] = column self.records.rename(columns_map, axis='columns', inplace=True) - def _undo_altitude_correction(self): + def undo_altitude_correction(self): """ Undo the automatic compensation for elevation applied to readings made by level and baro loggers of the Gold series (1xxxxxx) and older. From aad465e6e9f66f8d04a1252a5fd1928312e775b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20Gosselin?= Date: Mon, 10 Feb 2020 14:02:44 -0500 Subject: [PATCH 2/3] Dont undo zero point offset systematically --- .../file_reader/compagny_file_reader/solinst_file_reader.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hydsensread/file_reader/compagny_file_reader/solinst_file_reader.py b/hydsensread/file_reader/compagny_file_reader/solinst_file_reader.py index 40d706e..f36221c 100644 --- a/hydsensread/file_reader/compagny_file_reader/solinst_file_reader.py +++ b/hydsensread/file_reader/compagny_file_reader/solinst_file_reader.py @@ -142,7 +142,6 @@ def _read_file_data(self): self._date_list = self._get_date_list() self._get_data() self._format_data_units() - self._undo_zero_point_offset() # ---- Private API def _format_data_units(self): @@ -181,7 +180,7 @@ def undo_altitude_correction(self): self.sites.records[column] = ( self.sites.records[column] - 0.12 * altitude) - def _undo_zero_point_offset(self): + def undo_zero_point_offset(self): """ Undo the zero point offset applied to readings made by level and baro loggers of the Gold series (1xxxxxx) and older. From e771a002bd72d1d43f6822205e8c6b82429e11ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20Gosselin?= Date: Mon, 10 Feb 2020 14:38:38 -0500 Subject: [PATCH 3/3] Update tests for solinst readers --- .../tests/test_solinst_reader.py | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/hydsensread/file_reader/compagny_file_reader/tests/test_solinst_reader.py b/hydsensread/file_reader/compagny_file_reader/tests/test_solinst_reader.py index a801902..aeae732 100644 --- a/hydsensread/file_reader/compagny_file_reader/tests/test_solinst_reader.py +++ b/hydsensread/file_reader/compagny_file_reader/tests/test_solinst_reader.py @@ -102,13 +102,23 @@ def test_solinst_levelogger_gold(test_files_dir, testfile): assert list(records.columns) == ["LEVEL_cm", "TEMPERATURE_degC"] assert records.index[0] == Timestamp('2017-05-02 13:00:00') - assert records.iloc[0].iloc[0] == 923.561 - (0.12 * 42) + 950 + assert records.iloc[0].iloc[0] == 923.561 assert records.iloc[0].iloc[1] == 8.936 assert records.index[-1] == Timestamp('2017-05-04 14:45:00') - assert records.iloc[-1].iloc[0] == 934.8801 - (0.12 * 42) + 950 + assert records.iloc[-1].iloc[0] == 934.8801 assert records.iloc[-1].iloc[1] == 8.914 + # Test undo altitude correction. + solinst_file.undo_altitude_correction() + assert records.iloc[-1].iloc[0] == 934.8801 - (0.12 * 42) + assert records.iloc[-1].iloc[0] == 934.8801 - (0.12 * 42) + + # Test undo zero point offset. + solinst_file.undo_zero_point_offset() + assert records.iloc[0].iloc[0] == 923.561 - (0.12 * 42) + 950 + assert records.iloc[-1].iloc[0] == 934.8801 - (0.12 * 42) + 950 + assert solinst_file.plot() @@ -133,9 +143,19 @@ def test_solinst_levelogger_M5(test_files_dir, testfile): assert list(records.columns) == ["LEVEL_cm"] assert records.index[0] == Timestamp('2016-11-04 13:00:00') - assert records.iloc[0].iloc[0] == 314.0 - (0.12 * 170) + 950 + assert records.iloc[0].iloc[0] == 314.0 assert records.index[-1] == Timestamp('2016-11-06 14:45:00') + assert records.iloc[-1].iloc[0] == 317.5 + + # Test undo altitude correction. + solinst_file.undo_altitude_correction() + assert records.iloc[0].iloc[0] == 314.0 - (0.12 * 170) + assert records.iloc[-1].iloc[0] == 317.5 - (0.12 * 170) + + # Test undo zero point offset. + solinst_file.undo_zero_point_offset() + assert records.iloc[0].iloc[0] == 314.0 - (0.12 * 170) + 950 assert records.iloc[-1].iloc[0] == 317.5 - (0.12 * 170) + 950 assert solinst_file.plot()