The time drifting problem of archived earthquake datasets in China ========================================================================= The problem ------------------------------- We discovered that some archived seed files in the earthquake datasets from the Sichuan Earthquake Agency suffered from time drifting problems. The main features of the problem are unstable drifting amounts, unstable occurrence periods and low occurrence probability. Communication with peers show that the same scanarios were encountered when processing other datasets in China. .. figure:: 0X_time_errors.png :align: center Inconsistencies between archived waveforms and saved P&S arrivals. -------------------------------------- The diagnose and the solution -------------------------------- Trial and error tests were conducted for months to infer the possible reason and to find out the potential data recovery method. The problem was eceptionally rare, to the extent that even the system developer was unable to offer any insights. Fortunately, a plausible solution eventually discovered at the last minute of rigorous testing for months even though whether the errors were systematic or manual remains elusive. .. figure:: Solution_to_time_errors.png :align: center The inferred system running logistiscs, the possible time drifting reason and the proposed sulotion. -------------------------------------- The recovered data -------------------------------------- After the application of the data recovery method, we are able to reduce most (95%) of the encountered time drifting. the recovery rate can be higher by decreasing the splited seed waveforms length. However, the time consumed for processing will increase dramatically. .. figure:: 0X_three_components_features.png :align: center Waveforms with time drifting problem (black) and recovered waveforms (blue). Most time drifting errors are recovered. --------------------------------------- The solution demo --------------------------------------- .. code:: import os import re import obspy from obspy import UTCDateTime seedName="2019032121.SC.seed" tarDir = '20190321' assert len(re.split("\.",seed))==3 _dateHr = re.split("\.",seed)[0] yr = int(_dateHr[:4]) mo = int(_dateHr[4:6]) dy = int(_dateHr[6:8]) hr = int(_dateHr[8:10]) btime = UTCDateTime(yr,mo,dy,hr) etime = UTCDateTime(yr,mo,dy,hr+1) loopTime = btime while loopTime < etime: _dateHrMin = loopTime.strftime("%Y%m%d%H%M") _bbtime = loopTime.strftime("%Y-%m-%d %H:%M:%S") tmpTime = loopTime+60 _eetime = tmpTime.strftime("%Y-%m-%d %H:%M:%S") if not os.path.exists(tarDir): os.makedirs(tarDir) os.system(f"bash utils/SeedReWriter.sh -s 'SC/.*' -b '{_bbtime}' -e '{_eetime}' utils/{seedName} {tarDir}/{_dateHrMin}.SC.seed") loopTime += 60 The most important thing is to find the ``SeedRewriter.sh`` in the newly updated **JOPENS** software (available in JOPENS2021). Utilizing this module, we can slice JOPENS seed files into 1-minute segments. The using the ``Event2SAC.sh`` module, we can convert the sliced seed files into SAC format. The SAC files will have the correct time and can be used for further processing. The processing command is ``bash Event2SAC.sh {seedpth} {save_directory}``