diff --git a/sohstationviewer/model/reftek/from_rt2ms/core.py b/sohstationviewer/model/reftek/from_rt2ms/core.py index 4ca268642c8df05226d4f3490139caefe29b9523..00d27a17258c0d4b4cb75fb3b6b92757a8267ff3 100644 --- a/sohstationviewer/model/reftek/from_rt2ms/core.py +++ b/sohstationviewer/model/reftek/from_rt2ms/core.py @@ -12,6 +12,8 @@ Maeva Pourpoint IRIS/PASSCAL import copy import os +from pathlib import Path +from typing import Optional, Union import obspy.io.reftek.core as obspy_rt130_core import warnings @@ -33,7 +35,29 @@ from sohstationviewer.model.reftek.rt130_experiment.reftek_helper import ( class DiscontinuousTrace(Trace): def __init__(self, *args, times, **kwargs): super().__init__(*args, **kwargs) - self.times = times + self._times = times + + def times(self, type: str = "relative", + reftime: Optional[UTCDateTime] = None) -> np.ndarray: + """ + Override Trace.times(). Returns a numpy array of stored times data, + modified based on the argument "type". + :param type: the type of times data to return. For more information, + refer to Trace.times(). Note: this method does not implement + types 'utcdatetime' and 'matplotlib' because they are not going + to be useful. + :param reftime: the time used as a reference point when getting + relative time. If None, the start time of the trace is used as + the reference point. + :return: the requested array of time data, modified based on the type + requested. + """ + if type == 'utcdatetime' or type == 'matplotlib': + raise NotImplementedError + if type == 'relative': + return self._times - self.stats.starttime.timestamp + elif type == 'timestamp': + return self._times class Reftek130Exception(ObsPyException):