From 280dfea5fbc698743f822e3b83d89cbf24760979 Mon Sep 17 00:00:00 2001 From: Rakib Hassan Date: Thu, 16 Nov 2023 13:03:31 +1100 Subject: [PATCH] Minor fixes in the correlator module --- seismic/xcorqc/correlator.py | 9 +++++++++ seismic/xcorqc/xcorqc.py | 13 +++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/seismic/xcorqc/correlator.py b/seismic/xcorqc/correlator.py index 2343fbb9..d3f895ef 100644 --- a/seismic/xcorqc/correlator.py +++ b/seismic/xcorqc/correlator.py @@ -291,6 +291,15 @@ def get_loccha(cha1, cha2): continue # nothing more to do # end if + station_pair = '%s.%s.%s.%s' % (netsta1, loccha1, netsta2, loccha2) + fn = os.path.join(output_path, + '%s.nc' % (station_pair if not time_tag else '.'.join([station_pair, time_tag]))) + + if(os.path.exists(fn)): + print('Cross-correlation output found for station pair {}. Moving along..'.format(station_pair)) + continue + # end if + IntervalStackXCorr(ds1.fds, ds2.fds, startTime, endTime, netsta1, netsta2, netsta1inv, netsta2inv, instrument_response_output, water_level, diff --git a/seismic/xcorqc/xcorqc.py b/seismic/xcorqc/xcorqc.py index 52fa8d70..6a68f6f3 100644 --- a/seismic/xcorqc/xcorqc.py +++ b/seismic/xcorqc/xcorqc.py @@ -316,8 +316,17 @@ def xcorr2(tr1, tr2, sta1_inv=None, sta2_inv=None, # STEPS 4, 5: resample after lowpass @ resample_rate/2 Hz if resample_rate: - tr1_d = lowpass(tr1_d, resample_rate/2., sr1_orig, corners=2, zerophase=True) - tr2_d = lowpass(tr2_d, resample_rate/2., sr2_orig, corners=2, zerophase=True) + try: + if(resample_rate/2. < sr1_orig): + tr1_d = lowpass(tr1_d, resample_rate/2., sr1_orig, corners=2, zerophase=True) + # end if + + if(resample_rate/2. < sr2_orig): + tr2_d = lowpass(tr2_d, resample_rate/2., sr2_orig, corners=2, zerophase=True) + # end if + except Exception as e: + logger.error(str(e)) + # end try tr1_d = Trace(data=tr1_d, header=Stats(header={'sampling_rate': sr1_orig,