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)
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)
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)
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))
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)
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)
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)
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)
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")
def test_extract_pz_non_input(self): assert win32.extract_pz(None) is None