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