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

更新到 v2.0 #60

Merged
merged 30 commits into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2343fb3
保留原 gmt4 脚本
wangliang1989 Oct 4, 2019
dca79e0
更正不正规的语法
wangliang1989 Oct 4, 2019
29910a5
简化脚本
wangliang1989 Oct 4, 2019
dbf6a47
波形拟合图改为 gmt6
wangliang1989 Oct 4, 2019
b0a9443
深度反演图改为 gmt6
wangliang1989 Oct 4, 2019
2cab3c4
small fix
wangliang1989 Oct 4, 2019
d850d8a
绘制RMS随深度变化图
wangliang1989 Oct 4, 2019
161c17b
a small fix
wangliang1989 Oct 6, 2019
f32d303
绘制波形时用头段a对齐
wangliang1989 Jul 10, 2022
f7026c7
简化代码
wangliang1989 Jul 11, 2022
b71a13e
调整波形对齐方式
wangliang1989 Jul 11, 2022
523d4cd
添加外部子函数
wangliang1989 Jul 13, 2022
d796a26
简化代码
wangliang1989 Jul 24, 2022
ba8e91f
修正作者信息的格式
wangliang1989 Jan 9, 2023
a816ddf
调整绘图参数
wangliang1989 Jan 9, 2023
11967fb
增添对新版本的描述
wangliang1989 Jan 9, 2023
a6c3355
针对新版本修改安装方法
wangliang1989 Jan 9, 2023
b0ecf68
代码简化
wangliang1989 Jan 10, 2023
8c3c369
更新图片
wangliang1989 Jan 10, 2023
273403a
删除不必要的输出
wangliang1989 Jan 10, 2023
1b579d2
html files stored in oh-my-cap instead of site
wangliang1989 Jan 12, 2023
d373f09
优化简化脚本
wangliang1989 Jan 12, 2023
166b344
删除自己的 gmt4 脚本
wangliang1989 Jan 12, 2023
26a02ef
生成 html 文件
wangliang1989 Jan 13, 2023
c26750a
删除 pssac 的记录
wangliang1989 Jan 13, 2023
8fc055e
删除 pssac
wangliang1989 Jan 13, 2023
c54a071
添加对 gcap 的修改的记录
wangliang1989 Jan 13, 2023
75dccd2
添加对 fk 的修改的记录
wangliang1989 Jan 13, 2023
c5c2600
更新文档
wangliang1989 Jan 13, 2023
ba966ac
完善版本发布记录
wangliang1989 Jan 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
56 changes: 27 additions & 29 deletions Glib/checkgrn.pl
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#!/usr/bin/env perl
use strict;
use warnings;
$ENV{SAC_DISPLAY_COPYRIGHT}=0;
use List::Util qw(min max);
use FindBin;
use lib $FindBin::Bin;
require config;
$ENV{SAC_DISPLAY_COPYRIGHT}=0;

my @config = @ARGV;
foreach my $fname (@config) {
Expand All @@ -16,34 +15,36 @@
my @dist = split m/\s+/, $pars{"DIST"};

chdir $model or die;
foreach my $dep (@evdp) {
system "rm -rf *.pdf";
my @pdf;
foreach my $dep (sort {$a <=> $b} @evdp) {
my @cpdf;
chdir "${model}_$dep" or die;
print "${model}_$dep\n";
foreach my $dist (@dist) {
&refresh_sac_headers($dist);
system "gmt begin junk pdf A1c";
system "gmt subplot begin 3x4 -Fs8c/4c -M0.5c/1c -T'Green Functions of $dist km'";
chdir "${model}_${dep}" or die;
print "${model}_${dep}\n";
foreach my $dist (sort {$a <=> $b} @dist) {
refresh_sac_headers($dist);
system "gmt begin $dist pdf A1c";
my $tilte = "Depth: $dep, Epicenter: $dist";
system "gmt subplot begin 3x4 -Fs8c/4c -M0.5c/1c -T'$tilte'";
foreach my $q (0, 1, 2, 3, 4, 5, 6, 7, 8, 'a', 'b', 'c') {
my $num = $q;
$num = 9 if ($q eq 'a');
$num = 10 if ($q eq 'b');
$num = 11 if ($q eq 'c');
&gmt_draw($dist, $q, $num);
$num = 9 if $q eq 'a';
$num = 10 if $q eq 'b';
$num = 11 if $q eq 'c';
gmt_draw($dist, $q, $num);
}
system "gmt subplot end";
system "gmt end";
system "mv junk.pdf ${dist}.pdf";
push @cpdf, "${dist}.pdf";
push @pdf, "${model}_${dep}/${dist}.pdf";
}
system "cpdf @cpdf -o ../${model}_${dep}.pdf";
unlink glob "*_*.pdf";
chdir ".." or die;
}
system "gmt psconvert -TF -F$model @pdf";
system "rm -rf */*.pdf";
chdir ".." or die;
}

sub refresh_sac_headers () {
sub refresh_sac_headers {
my ($dist) = @_;
open(SAC, "|sac ") or die "Error in opening sac\n";
print SAC "wild echo off\n";
Expand All @@ -52,31 +53,28 @@ ()
print SAC "q\n";
close(SAC);
}
sub gmt_draw () {
sub gmt_draw {
my ($dist, $q, $num) = @_;
my ($b, $e, $min, $max, $t1, $t2) = &getrange($dist, $q);
system "gmt subplot set $num";
system "gmt basemap -R$b/$e/$min/$max -Baf -BWSen+t'${dist}.grn.${q}'";
system "gmt sac -W1p,black ${dist}.grn.${q}";
&gmtline ($t1, "1p,blue", $min, $max);
&gmtline ($t2, "1p,red", $min, $max);
system "gmt sac -W1p,black ${dist}.grn.${q}";
gmtline ($t1, "1p,blue", $min, $max);
gmtline ($t2, "1p,red", $min, $max);
}
sub getrange () {
sub getrange {
my ($dist, $q) = @_;
my ($b, $e, $t1, $t2) = (split m/\s+/, `saclst b e t1 t2 f ${dist}.grn.$q`)[1..4];
my ($min) = (split m/\s+/, `saclst depmin f ${dist}.grn.$q`)[1];
my ($max) = (split m/\s+/, `saclst depmax f ${dist}.grn.$q`)[1];
$min = $min * 1.1;
$max = $max * 1.1;
if (($min == 0) and ($max == 0)) {
$min = -1;
$max = 1;
}
($min, $max) = (-1, 1) if ($min == 0) and ($max == 0);
return ($b, $e, $min, $max, $t1, $t2);
}
sub gmtline (){
sub gmtline {
my ($t, $w, $min, $max) = @_;
open (GMT, "| gmt plot -W$w") or die;
print GMT "$t $min\n $t $max\n";
close (GMT);
}
}
5 changes: 1 addition & 4 deletions Glib/run_fk.pl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
@ARGV >= 1 or die "Usage: perl $0 configname";
my @config = @ARGV;

my $date = `date`;
foreach my $fname (@config){
my %pars = read_config($fname);
my ($model) = split m/\./, $fname;
Expand All @@ -24,7 +23,7 @@
print "FLAT: $flat\n";
print "DEPTH:\n@depth\n";
print "DIST:\n@dist\n";

my $err = 0;
my @layer = split m/\n/, $pars{'MODEL'};
foreach (@layer) {
Expand Down Expand Up @@ -66,5 +65,3 @@

chdir ".." or die;
}
print "$date";
system "date";
37 changes: 23 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
# Oh My CAP

CAP 是计算震源机制的一种常用方法,很多地震学同行都需要学习、使用和研究它。我基于 gCAP1.0 建立了 Oh My CAP 这个开源项目,总结整理了在使用 CAP 中的经验,希望能够为大家提供一个学习、探讨 CAP 的平台。
CAP 是计算震源机制的一种常用方法,
很多地震同行都需要学习、使用和研究它。
我基于 gCAP1.0 建立了 Oh My CAP 这个开源项目,
总结整理了在使用 CAP 中的经验,
希望能够为大家提供一个学习、探讨 CAP 的平台。
本项目始自 2016 年,我在桂林理工大学读硕士学位期间。

项目主页: http://seiswave.cn/oh-my-cap/
** 项目主页: http://seiswave.cn/oh-my-cap/ **

##作者
## 作者

王亮 贺州学院公共基础教学部

Expand All @@ -14,24 +19,28 @@ CAP 是计算震源机制的一种常用方法,很多地震学同行都需要

## 版权协议

本项目中所使用的 fk、pssac 以及 gcap 的源码修改自 Prof. Zhu 的原始代码,遵循 GPL 协议,任何人均可免费获取、使用、修改和再发布代码,但是修改后的版本必须也公开并按 GPL 协议授权。
本项目中所使用的 fk 和 gcap 的源码修改自朱露培的原始代码。
这部分代码遵循 GPL 协议,任何人均可免费获取、使用、修改和再发布代码,
但是修改后的版本必须也按 GPL 协议公开和授权。

本项目中的其余源码以及文档采用更加宽松的 Apache 协议,即在尊重本项目署名权的前提下,可以选择不公开自己的修改。
本项目中的其余源码和文档采用更加宽松的 Apache 协议,
即在尊重本项目署名权的前提下,可以选择不公开自己的修改。

## 引引我的论文吧

如果你认为我的工作对你有帮助,欢迎引用我的论文。以下是我的论文的中英文信息:
如果本项目帮助了你,请引用我的论文。
有一些同学不愿意引用中文论文,或者不愿意引用非大牛的论文。
同学,讲点良心吧。
以下是我的论文的中英文信息:

> 王亮, 薛霆虓, 季海磊. 2016. 集集强余震震源机制解分析[J]. 地球物理学进展. 31(5): 1998-2004

> Wang L, Xue T X, Ji H L. 2016. Focal mechanisms of Taiwan ChiChi earthquake aftershocks[J]. Progress in Geophysics. 31(5): 1998-2004

下载这篇论文,请移步地球物理学进展的官网: http://www.progeophys.cn/CN/10.6038/pg20160515
这篇论文可以在地球物理学进展的官网下载:
http://www.progeophys.cn/CN/10.6038/pg20160515

我的硕士学位论文的下载地址是 https://www.jianguoyun.com/p/DeZplx8Q5s_iCRjo6okE

## 捐助

支付宝账户:wangliang0222@foxmail.com 。

我会尽力解答疑问,但无能力解决使用 CAP 遇到的所有问题。
另外,我也提供我的所有第一作者论文和学位论文。
在我的
[坚果云网盘](https://www.jianguoyun.com/p/DSgkfDkQ5s_iCRjznPMEIAA)
中可以找到这篇论文,也可以找到我的以 CAP 为主题的硕士论文:
2 changes: 1 addition & 1 deletion docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
site
oh-my-cap
28 changes: 28 additions & 0 deletions docs/build.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env perl
use strict;
use warnings;

system "mkdocs build -d oh-my-cap";
search_html("oh-my-cap");

sub search_html {
my $dir = shift;
chdir $dir or die;
foreach my $item (glob "*") {
search_html($item) if -d $item;
change_img($item) if -e $item and substr($item, -4) eq 'html';
}
chdir '..' or die;
}
sub change_img {
my $in = shift;
open (IN, "< $in") or die;
my @data = <IN>;
close(IN);
open (OUT, "> $in") or die;
foreach my $info (@data) {
$info =~ s/img\//oh-my-cap\/img\//g unless $info =~ "favicon";
print OUT "$info";
}
close(OUT);
}
25 changes: 22 additions & 3 deletions docs/docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
# 版本发布

现在,Oh My CAP 采用语意话版本的版本号规则代替之前的 bug 列表来说明版本问题
现在,Oh My CAP 在以前的语意话版本的版本号规则的基础上,改为如下原则

- 主版本号:不兼容的 API 修改,
- 次版本号:功能性新增,
- 修订号:问题修正。
- 次版本号:软件更新,
- 修订号:文档更新。

## 2.0.0

这一次更新间隔了近五年,修改较多。
这次更新通过如下 PR 合并到 master 分支:

- [更新到 2.0.0](https://github.com/wangliang1989/oh-my-cap/pull/60/files)

其中主要的更新有:

- [波形拟合图改为 gmt6](https://github.com/wangliang1989/oh-my-cap/pull/60/commits/dbf6a477ef3e6ef192337d9d426acd545661bab6)

- [深度反演图改为 gmt6](https://github.com/wangliang1989/oh-my-cap/pull/60/commits/b0a9443fef762618b0fa8feafff72a4a3801d7e9)

- [绘制RMS随深度变化图](https://github.com/wangliang1989/oh-my-cap/pull/60/commits/d850d8a86af3129e53ae7cb809d573b0661c259c)

- [添加外部子函数](https://github.com/wangliang1989/oh-my-cap/pull/60/commits/523d4cd6b9bf36ec9ba57cc600bc3659c41acd95)

- [全面更新文档](https://github.com/wangliang1989/oh-my-cap/pull/60/commits/c5c260033a3dffae0d93391069e56154801f9a82)

## 1.2

Expand Down
73 changes: 73 additions & 0 deletions docs/docs/cite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# 文献介绍

## CAP 提出论文

```text
Zhao L S, Helmberger D V. 1994. Source estimation from broadband regional seismograms[J]. Bulletin of the Seismological Society of America, 84(1): 91-104.
```

这篇文章于 1994 年,由赵连社和唐纳德·赫尔伯格发表在
[Bulletin of the Seismological Society of America](https://pubs.geoscienceworld.org/ssa/bssa/article-abstract/84/1/91/102552/Source-estimation-from-broadband-regional)。
Bulletin of the Seismological Society of America 一般简称为 BSSA。
是美国地震学会的下属期刊。
现代地震学很多重要研究都发表在这份期刊上。
这篇论文首次提出了 CAP 方法。

## CAP 发展论文

```text
Zhu L P, Helmberger D V. 1996. Advancement in source estimation techniques using broadband regional seismograms[J]. Bulletin of the Seismological Society of America, 86(5): 1634-1641.
```

这篇文章于 1996 年,由朱露培和唐纳德·赫尔伯格发表在
[Bulletin of the Seismological Society of America](https://pubs.geoscienceworld.org/ssa/bssa/article-abstract/86/5/1634/120218/Advancement-in-source-estimation-techniques-using)。
这篇论文相对于前一篇,在 CAP 方法中加入了距离因子,
能在计算震源机制时,考虑观测波形的振幅比。

## FK 的依据论文

```text
Zhu L P, Luis A. Rivera. 2002. A note on the dynamic and static displacements from a point source in multilayered media[J]. Geophysical Journal International, 148(3): 619–627.
```

这篇文章于 2002 年,由朱露培和路易斯·里维拉格发表在
[Geophysical Journal International](https://academic.oup.com/gji/article/148/3/619/823727)。
Geophysical Journal International 一般简称为 GJI,
是英国天文学会和德国地球物理学会下属的期刊。
一般认为,GJI 相对于其他期刊,更愿意刊登地球物理方法发展的论文。
这篇论文是 FK 程序的依据。

## gCAP 提出论文

```text
Zhu L P, Yehuda B. 2013. Parametrization of general seismic potency and moment tensors for source inversion of seismic waveform data[J]. Geophysical Journal International, 194(2): 839–843.
```

这篇文章于 2013 年,由朱露培和耶胡达·本锡安发表在
[Geophysical Journal International](https://academic.oup.com/gji/article/194/2/839/2111069)。
这篇论文提出了 gCAP。
gCAP 相对于 CAP,可以反演完整的震源机制解。

## Oh My CAP 的依据论文

```text
王亮, 薛霆虓, 季海磊. 2016. 集集强余震震源机制解分析[J]. 地球物理学进展. 31(5): 1998-2004
Wang L, Xue T X, Ji H L. 2016. Focal mechanisms of Taiwan ChiChi earthquake aftershocks[J]. Progress in Geophysics. 31(5): 1998-2004
```
这篇论文由我和我的导师薛霆虓、师弟季海磊发表在
[地球物理学进展](http://www.progeophys.cn/CN/10.6038/pg20160515)。
《地球物理学进展》由中国科学院创办。
我是在完成这篇论文期间和之后不久,完成了 Oh My CAP 这个项目。
如果你使用了 Oh My CAP 项目,你应该引用我这篇论文。
你可以在介绍 CAP 方法时说,该方法是地震学中计算震源机制解的常用方法。
这就能把我的论文引上。

**只要你引用了我的论文,无论是否为正式发表,你都可以告诉我,这是我继续做这个项目的动力。**

## 论文下载

在上面,我已经给出了各个论文的期刊的官方网站。
你也可以从我在坚果云上的分享中找到相应论文,进行下载。

- [我的所有第一作者论文和本硕博学位论文](https://www.jianguoyun.com/p/DSgkfDkQ5s_iCRjznPMEIAA)
- [他人的论文](https://www.jianguoyun.com/p/DbLcoakQ5s_iCRiuqfMEIAA)
14 changes: 2 additions & 12 deletions docs/docs/code-diffs.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,14 @@ fk 是 Prof. Lupei Zhu 写的一个计算水平分层介质中理论地震图的

相对于官方版的改动:

- 修改个别错误
- 删除了自带的示例
- 删除了无用的临时文件
- 修改 Makefile 使得其更通用
- 修改输出文件的命名规则以适应并行计算

详细修改历史见: <https://github.com/wangliang1989/oh-my-cap/commits/master/src/fk>

## pssac

pssac 是 Prof. Lupei Zhu 根据 GMT 的 psxy 命令修改得到,用于绘制 SAC 格式的波形数据的程序。

官方版本: [pssac.tar](http://www.eas.slu.edu/People/LZhu/downloads/pssac.tar) [pssac.c](http://www.eas.slu.edu/People/LZhu/downloads/pssac.c)

相对于官方版的改动:

- 修改 Makefile 使得其更通用

详细修改历史见: <https://github.com/wangliang1989/oh-my-cap/commits/master/src/pssac>

## gcap

Prof. Zhu 的官方版本: [gcap1.0.tar](http://www.eas.slu.edu/People/LZhu/downloads/gcap1.0.tar)
Expand All @@ -39,5 +28,6 @@ Prof. Zhu 的官方版本: [gcap1.0.tar](http://www.eas.slu.edu/People/LZhu/do
- 修改 `cap_plt.pl` 和 `depth.pl` 使得其不依赖于 GMT 的系统设置
- 修改 `cap.pl` 使得用户不必再自行修改该文件
- 修改 Makefile 使得其更通用
- 改用 GMT6 绘图

详细修改历史见: <https://github.com/wangliang1989/oh-my-cap/commits/master/src/gcap>
Binary file added docs/docs/img/depth_model.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/docs/img/linux_model_15.png
Binary file not shown.
Binary file removed docs/docs/img/linux_model_depth.png
Binary file not shown.
Binary file removed docs/docs/img/mac_model_15.png
Binary file not shown.
Binary file removed docs/docs/img/mac_model_depth.png
Binary file not shown.
Binary file added docs/docs/img/model_15.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/img/model_depth.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.