From fae1847cf8e73349e5d3740157c451f68553b0ad Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F" Date: Thu, 20 Oct 2022 12:29:24 +0200 Subject: [PATCH] Belongs to previous commit --- src/lasp/lasp_measurement.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/lasp/lasp_measurement.py b/src/lasp/lasp_measurement.py index f62a8d4..587e421 100644 --- a/src/lasp/lasp_measurement.py +++ b/src/lasp/lasp_measurement.py @@ -251,28 +251,27 @@ class Measurement: self._time = f.attrs['time'] + # Quantity stored as channel. self._qtys = None - try: - qtys_json = f.attrs['qtys'] - # Load quantity data - self._qtys = [Qty.from_json(qty_json) for qty_json in qtys_json] - except KeyError: - # If quantity data is not available, this is an 'old' - # measurement file. - pass try: qtys_enum_idx = f.attrs['qtys_enum_idx'] self._qtys = [SIQtys.fromInt(idx) for idx in qtys_enum_idx] except KeyError: - pass + try: + qtys_json = f.attrs['qtys'] + # Load quantity data + self._qtys = [Qty.from_json(qty_json) for qty_json in qtys_json] + except KeyError: + # If quantity data is not available, this is an 'old' + # measurement file. + pass if self._qtys is None: self._qtys = [SIQtys.default() for i in range(self.nchannels)] logging.debug(f'Physical quantity data not available in measurement file. Assuming {SIQtys.default}') - - logging.debug(f'Physical quantity data not available in measurement file. Assuming {SIQtys.default}') + def setAttribute(self, atrname, value): """ Set an attribute in the measurement file, and keep a local copy in