예제 #1
0
 def test_extract_pz_3(self):
     outdir = os.path.join(pwd, "ch3")
     win32.extract_pz(ctable, filter_by_component='U', outdir=outdir)
     pz_to_check = ['N.NNMH.U.SAC_PZ', 'N.NGUH.U.SAC_PZ']
     pz = os.listdir(outdir)
     assert pz == pz_to_check
     shutil.rmtree(outdir)
예제 #2
0
 def test_extract_pz_3(self):
     outdir = os.path.join(pwd, "ch3")
     win32.extract_pz(ctable, filter_by_component="U", outdir=outdir)
     pz_to_check = ["N.NNMH.U.SAC_PZ", "N.NGUH.U.SAC_PZ"]
     pz = os.listdir(outdir)
     assert sorted(pz) == sorted(pz_to_check)
     shutil.rmtree(outdir)
예제 #3
0
 def test_extract_pz_3(self):
     outdir = os.path.join(pwd, "ch3")
     win32.extract_pz(ctable, filter_by_component='U', outdir=outdir)
     pz_to_check = ['N.NNMH.U.SAC_PZ',
                    'N.NGUH.U.SAC_PZ']
     pz = os.listdir(outdir)
     assert sorted(pz) == sorted(pz_to_check)
     shutil.rmtree(outdir)
예제 #4
0
def data_process(data, ctable, data_path, ctable_path):
    try:
        if (os.path.exists(data)):
            win32.extract_sac(data, ctable, outdir=data_path)
            win32.extract_pz(ctable, outdir=ctable_path)
        else:
            print('no file: %s' % (path))
    except:
        print('error %s' % (path))
예제 #5
0
 def test_extract_pz_2(self):
     outdir = os.path.join(pwd, "ch2")
     win32.extract_pz(ctable, suffix="SACPZ", outdir=outdir)
     pz_to_check = [
         'N.NNMH.U.SACPZ', 'N.NNMH.N.SACPZ', 'N.NNMH.E.SACPZ',
         'N.NGUH.U.SACPZ', 'N.NGUH.N.SACPZ', 'N.NGUH.E.SACPZ'
     ]
     pz = os.listdir(outdir)
     assert pz == pz_to_check
     shutil.rmtree(outdir)
예제 #6
0
 def test_extract_pz_1(self):
     outdir = os.path.join(pwd, "ch1")
     win32.extract_pz(ctable, outdir=outdir)
     pz_to_check = [
         'N.NNMH.U.SAC_PZ', 'N.NNMH.N.SAC_PZ', 'N.NNMH.E.SAC_PZ',
         'N.NGUH.U.SAC_PZ', 'N.NGUH.N.SAC_PZ', 'N.NGUH.E.SAC_PZ'
     ]
     pz = os.listdir(outdir)
     assert sorted(pz) == sorted(pz_to_check)
     shutil.rmtree(outdir)
예제 #7
0
 def test_extract_pz_2(self):
     outdir = os.path.join(pwd, "ch2")
     win32.extract_pz(ctable, suffix="SACPZ", outdir=outdir)
     pz_to_check = ['N.NNMH.U.SACPZ',
                    'N.NNMH.N.SACPZ',
                    'N.NNMH.E.SACPZ',
                    'N.NGUH.U.SACPZ',
                    'N.NGUH.N.SACPZ',
                    'N.NGUH.E.SACPZ']
     pz = os.listdir(outdir)
     assert sorted(pz) == sorted(pz_to_check)
     shutil.rmtree(outdir)
예제 #8
0
 def test_extract_pz_2(self):
     outdir = os.path.join(pwd, "ch2")
     win32.extract_pz(ctable, suffix="SACPZ", outdir=outdir)
     pz_to_check = [
         "N.NNMH.U.SACPZ",
         "N.NNMH.N.SACPZ",
         "N.NNMH.E.SACPZ",
         "N.NGUH.U.SACPZ",
         "N.NGUH.N.SACPZ",
         "N.NGUH.E.SACPZ",
     ]
     pz = os.listdir(outdir)
     assert sorted(pz) == sorted(pz_to_check)
     shutil.rmtree(outdir)
예제 #9
0
def extract_sac(data, ctable, processes):
    """
    extract the downloaded data to the sac and pz format.
    """
    # * get dirname
    thedir = dirname(data)
    # * mkdir for the sac and pz files
    sh.mkdir("-p", join(thedir, "SAC"))
    sh.mkdir("-p", join(thedir, "PZ"))
    # * extract sac
    win32.extract_sac(data,
                      ctable,
                      with_pz=False,
                      outdir=join(thedir, "SAC"),
                      processes=processes)
    # * extract pz
    win32.extract_pz(ctable, outdir=join(thedir, "PZ"))
    # * return the sac and pz directory path
    return join(thedir, "SAC"), join(thedir, "PZ")
예제 #10
0
 def test_extract_pz_non_input(self):
     assert win32.extract_pz(None) is None