Exemplo n.º 1
0
def test_tour():
    input_dics = test_read_input_command()

    input_dics['datapath'] = './dmt_tour_dir'
    input_dics['min_date'] = '2011-03-10'
    input_dics['max_date'] = '2011-03-12'
    input_dics['min_mag'] = '8.9'
    input_dics['identity'] = 'TA.1*.*.BHZ'
    input_dics['event_catalog'] = 'IRIS'
    input_dics['req_parallel'] = True
    input_dics['instrument_correction'] = True
    input_dics['net'] = 'TA'
    input_dics['sta'] = '1*'
    input_dics['loc'] = '*'
    input_dics['cha'] = 'BHZ'

    from obspyDMT import obspyDMT
    input_dics = obspyDMT.dmt_core(input_dics)

    from glob import glob
    assert len(glob('./dmt_tour_dir/*')) == 2
    assert len(glob('./dmt_tour_dir/20110311_054623.a/processed/*')) == 13
    assert len(glob('./dmt_tour_dir/20110311_054623.a/raw/*')) == 13
    assert len(glob('./dmt_tour_dir/20110311_054623.a/resp/*')) == 13
    assert len(glob('./dmt_tour_dir/20110311_054623.a/info/*')) >= 8

    import shutil
    shutil.rmtree('./dmt_tour_dir')
    shutil.rmtree('./obspydmt-data')
Exemplo n.º 2
0
def test_syngine_tour():
    (options, args, parser) = command_parse()
    input_dics = read_input_command(parser)

    input_dics['datapath'] = './dmt_tour_dir'
    input_dics['min_date'] = '2011-03-10'
    input_dics['max_date'] = '2011-03-12'
    input_dics['min_mag'] = '8.9'
    input_dics['identity'] = 'TA.1*.*.BHZ'
    input_dics['event_catalog'] = 'IRIS'
    input_dics['req_parallel'] = True
    input_dics['instrument_correction'] = True
    input_dics['net'] = 'TA'
    input_dics['sta'] = '1*'
    input_dics['loc'] = '*'
    input_dics['cha'] = 'BHZ'
    input_dics['syngine'] = True

    from obspyDMT import obspyDMT
    input_dics = obspyDMT.dmt_core(input_dics)

    from glob import glob
    assert len(glob('./dmt_tour_dir/*')) == 2
    assert len(glob('./dmt_tour_dir/20110311_054623.a/raw/*')) > 10
    assert len(glob('./dmt_tour_dir/20110311_054623.a/processed/*')) == len(glob('./dmt_tour_dir/20110311_054623.a/raw/*'))
    assert len(glob('./dmt_tour_dir/20110311_054623.a/syngine_iasp91_2s/*')) > 10
    assert len(glob('./dmt_tour_dir/20110311_054623.a/resp/*')) == len(glob('./dmt_tour_dir/20110311_054623.a/raw/*'))
    assert len(glob('./dmt_tour_dir/20110311_054623.a/info/*')) == 8

    import shutil
    shutil.rmtree('./dmt_tour_dir')
    shutil.rmtree('./obspydmt-data')
Exemplo n.º 3
0
def test_arclink_waveforms():
    (options, args, parser) = command_parse()
    input_dics = read_input_command(parser)

    import os
    input_dics['datapath'] = os.path.join(os.path.curdir,
                                          'event_based_dir_ARCLINK')
    input_dics['min_date'] = '2014-01-01'
    input_dics['max_date'] = '2015-01-01'
    input_dics['min_mag'] = '7.9'
    input_dics['identity'] = 'II.*.00.BHZ'
    input_dics['event_catalog'] = 'NEIC_USGS'
    input_dics['data_source'] = ['ARCLINK']
    input_dics['req_parallel'] = True
    input_dics['instrument_correction'] = True
    input_dics['net'] = 'II'
    input_dics['sta'] = '*'
    input_dics['loc'] = '00'
    input_dics['cha'] = 'BHZ'
    input_dics['offset'] = 100

    from obspyDMT import obspyDMT
    input_dics = obspyDMT.dmt_core(input_dics)

    from glob import glob
    assert len(
        glob(os.path.join(os.path.curdir, 'event_based_dir_ARCLINK',
                          '*'))) == 3
    assert len(
        glob(
            os.path.join(os.path.curdir, 'event_based_dir_ARCLINK',
                         '20140401_234647.a', '*'))) == 4
    assert len(
        glob(
            os.path.join(os.path.curdir, 'event_based_dir_ARCLINK',
                         '20140623_205309.a', '*'))) == 4
    assert len(
        glob(
            os.path.join(os.path.curdir, 'event_based_dir_ARCLINK',
                         '20140401_234647.a', 'raw', '*'))) >= 5
    assert len(
        glob(
            os.path.join(os.path.curdir, 'event_based_dir_ARCLINK',
                         '20140623_205309.a', 'raw', '*'))) >= 5
    assert len(
        glob(
            os.path.join(os.path.curdir, 'event_based_dir_ARCLINK',
                         '20140401_234647.a', 'processed', '*'))) >= 5
    assert len(
        glob(
            os.path.join(os.path.curdir, 'event_based_dir_ARCLINK',
                         '20140623_205309.a', 'processed', '*'))) >= 5

    import shutil
    shutil.rmtree(os.path.join(os.path.curdir, 'event_based_dir_ARCLINK'))
    shutil.rmtree('./obspydmt-data')
Exemplo n.º 4
0
def test_process_unit():
    (options, args, parser) = command_parse()
    input_dics = read_input_command(parser)

    input_dics['datapath'] = './event_based_dir'
    input_dics['min_date'] = '2014-01-01'
    input_dics['max_date'] = '2015-01-01'
    input_dics['min_mag'] = '7.5'
    input_dics['identity'] = 'II.*.00.BHZ'
    input_dics['event_catalog'] = 'NEIC_USGS'
    input_dics['data_source'] = ['IRIS']
    input_dics['req_parallel'] = True
    input_dics['instrument_correction'] = True
    input_dics['net'] = 'II'
    input_dics['sta'] = '*'
    input_dics['loc'] = '00'
    input_dics['cha'] = 'BHZ'
    input_dics['preset'] = 100
    input_dics['offset'] = 1800
    input_dics['process_np'] = 4
    input_dics['resample_method'] = 'lanczos'
    input_dics['sampling_rate'] = 2.0

    from obspyDMT import obspyDMT
    input_dics = obspyDMT.dmt_core(input_dics)

    from glob import glob
    assert len(glob('./event_based_dir/*')) == 6
    assert len(glob('./event_based_dir/20140401_234647.a/*')) == 4 
    assert len(glob('./event_based_dir/20140403_024313.a/*')) == 4 
    assert len(glob('./event_based_dir/20140412_201439.a/*')) == 4 
    assert len(glob('./event_based_dir/20140419_132800.a/*')) == 4 
    assert len(glob('./event_based_dir/20140623_205309.a/*')) == 4 

    from obspy import read
    tr_process = read('./event_based_dir/20140401_234647.a/processed/*')[0]
    assert (tr_process.stats.sampling_rate - input_dics['sampling_rate']) < 1e-2

    import shutil
    shutil.rmtree('./obspydmt-data')
    shutil.rmtree('./event_based_dir')
def test_arclink_waveforms():
    (options, args, parser) = command_parse()
    input_dics = read_input_command(parser)

    import os
    input_dics['datapath'] = os.path.join(os.path.curdir, 'event_based_dir_ARCLINK')
    input_dics['min_date'] = '2014-01-01'
    input_dics['max_date'] = '2015-01-01'
    input_dics['min_mag'] = '7.9'
    input_dics['identity'] = 'II.*.00.BHZ'
    input_dics['event_catalog'] = 'NEIC_USGS'
    input_dics['data_source'] = ['ARCLINK']
    input_dics['req_parallel'] = True
    input_dics['instrument_correction'] = True
    input_dics['net'] = 'II'
    input_dics['sta'] = '*'
    input_dics['loc'] = '00'
    input_dics['cha'] = 'BHZ'
    input_dics['offset'] = 100

    from obspyDMT import obspyDMT
    input_dics = obspyDMT.dmt_core(input_dics)

    from glob import glob
    assert len(glob(os.path.join(os.path.curdir, 'event_based_dir_ARCLINK', '*'))) == 3
    # uncomment the following lines
    #assert len(glob(os.path.join(os.path.curdir, 'event_based_dir_ARCLINK', '20140401_234647.a', '*'))) == 4
    #assert len(glob(os.path.join(os.path.curdir, 'event_based_dir_ARCLINK', '20140623_205309.a', '*'))) == 4
    #assert len(glob(os.path.join(os.path.curdir, 'event_based_dir_ARCLINK', '20140401_234647.a', 'raw', '*'))) >= 5
    #assert len(glob(os.path.join(os.path.curdir, 'event_based_dir_ARCLINK', '20140623_205309.a', 'raw', '*'))) >= 5
    #assert len(glob(os.path.join(os.path.curdir, 'event_based_dir_ARCLINK', '20140401_234647.a', 'processed', '*'))) >= 5
    #assert len(glob(os.path.join(os.path.curdir, 'event_based_dir_ARCLINK', '20140623_205309.a', 'processed', '*'))) >= 5

    import shutil
    shutil.rmtree(os.path.join(os.path.curdir, 'event_based_dir_ARCLINK'))
    shutil.rmtree('./obspydmt-data')