Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: 删除无仪器响应的数据 #66

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions example/process.pl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
system "perl eventinfo.pl $event";
system "perl marktime.pl $event";
system "perl transfer.pl $event";
system "perl rotate.pl $event";
system "perl resample.pl $event";
#system "perl rotate.pl $event";
#system "perl resample.pl $event";
}
30 changes: 25 additions & 5 deletions example/transfer.pl
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,34 @@

chdir $dir;

# 删除有报错的数据
# 你的数据有两个问题:1缺失一些resp文件2resp文件中缺失一些台站的信息
# 问题1可以靠代码解决,问题2目前需要自己手动删除,你把删除的代码写进脚本里,就方便了

# 解决问题2
my @exclude = ('TJ.WUQ.00', 'TJ.XZZ.00');#你把报错的台站手动填进来,perl以随意跨行
foreach my $sac (@exclude) {
unlink glob "$sac*";
}

# 去仪器响应
open(SAC, "| sac") or die "Error in opening sac\n";
print SAC "wild echo off\n";
print SAC "r *.SAC \n";
print SAC "rglitches; rmean; rtrend; taper \n";
print SAC "trans from evalresp to vel freq $f1 $f2 $f3 $f4\n";
print SAC "mul 1e-7\n";
print SAC "w over\n";
# 解决问题1
foreach my $sac (glob "*.SAC") {
my $resp = substr $sac, 0, -4;
if (-e "RESP.$resp") {
print SAC "r $sac\n";
print SAC "rglitches; rmean; rtrend; taper \n";
print SAC "trans from evalresp to vel freq $f1 $f2 $f3 $f4\n";
print SAC "mul 1e-7\n";
print SAC "w over\n";
}else{
# 删除没有仪器响应文件的数据
print "Oh My CAP: cannot find RESP.$resp\n";
unlink $sac;
}
}
print SAC "q\n";
close(SAC);
unlink glob "RESP.*";
Expand Down