Skip to content

Commit

Permalink
Minor fixes in the correlator module
Browse files Browse the repository at this point in the history
  • Loading branch information
geojunky committed Nov 16, 2023
1 parent 2e607fd commit 280dfea
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
9 changes: 9 additions & 0 deletions seismic/xcorqc/correlator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
13 changes: 11 additions & 2 deletions seismic/xcorqc/xcorqc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 280dfea

Please sign in to comment.