def build_anxcor(tau,interpolation_method='nearest'): broadband_data_dir = basedir+'test_data/correlation_integration_testing/Broadband' broadband_station_location_file = basedir+'test_data/correlation_integration_testing/broadband_stationlist.txt' nodal_data_dir = basedir+'test_data/correlation_integration_testing/Nodal' nodal_station_location_file = basedir+'test_data/correlation_integration_testing/nodal_stationlist.txt' broadband_database = DWellsDecimatedReader(broadband_data_dir, broadband_station_location_file) nodal_database = DWellsDecimatedReader(nodal_data_dir, nodal_station_location_file,extension='d') window_length = 10*60.0 #include_stations = ['Nodal.{}'.format(x) for x in range(1,10)] include_stations = ['UU.FORU','DV.1'] taper_ratio = 0.05 target_rate = 50.0 correlate_kwargs= dict(max_tau_shift=tau,taper=taper_ratio) resample_kwargs = dict(target_rate=target_rate,lowpass=False) anxcor_main = Anxcor(interp_method=interpolation_method) anxcor_main.set_window_length(window_length) anxcor_main.set_must_only_include_station_pairs(include_stations) anxcor_main.add_dataset(broadband_database,'BB') anxcor_main.add_dataset(nodal_database, 'Nodal') anxcor_main.add_process(XArrayTaper(taper=taper_ratio)) anxcor_main.add_process(XArrayRemoveMeanTrend()) anxcor_main.add_process(XArrayTaper(taper=taper_ratio)) anxcor_main.set_task_kwargs('crosscorrelate',correlate_kwargs) # anxcor_main.set_task('post-correlate',XArrayCustomComponentNormalizer()) return anxcor_main
def test_set_must_include(self): anxcorWavebank = WavebankWrapper(source_dir) min_starttime = anxcorWavebank.bank.get_availability_df( )['starttime'].min() endtime = anxcorWavebank.bank.get_availability_df()['endtime'].max() starttime = int(min_starttime + 1) endtime = int(endtime) overlap = 0.5 window_length = 3 * 60 resample_kwargs = dict(taper=0.05, target_rate=20.0) correlate_kwargs = dict(taper=0.01, max_tau_shift=60) anxcor_main = Anxcor() anxcor_main.add_dataset(anxcorWavebank, 'test') anxcor_main.set_must_only_include_station_pairs(['AX.1', 'AX.2']) correlations = anxcor_main.get_station_combinations() assert len(correlations) == 3