-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
446 lines (348 loc) · 16.7 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>
Road to Geophysics
</title>
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="atom.xml" rel="alternate" title="Road to Geophysics" type="application/atom+xml">
<link href="asset/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
<link href="asset/stylesheets/font-awesome.min.css" media="screen, projection" rel="stylesheet" type="text/css">
<script src="asset/javascripts/jquery.min.js"></script>
<script src="asset/highlightjs/highlight.pack.js"></script>
<link href="asset/highlightjs/styles/solarized_dark.css" media="screen, projection" rel="stylesheet" type="text/css">
<script>hljs.initHighlightingOnLoad();</script>
<!--[if lt IE 9]><script src="asset/javascripts/html5.js"></script><![endif]-->
<!-- <link href='http://fonts.googleapis.com/css?family=Nunito:400,300,700' rel='stylesheet' type='text/css'> -->
<style type="text/css">
/* latin */
@font-face {
font-family: 'Nunito';
font-style: normal;
font-weight: 300;
src: local('Nunito-Light'), url(asset/font/1TiHc9yag0wq3lDO9cw0voX0hVgzZQUfRDuZrPvH3D8.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
/* latin */
@font-face {
font-family: 'Nunito';
font-style: normal;
font-weight: 400;
src: local('Nunito-Regular'), url(asset/font/6TbRXKWJjpj6V2v_WyRbMX-_kf6ByYO6CLYdB4HQE-Y.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
/* latin */
@font-face {
font-family: 'Nunito';
font-style: normal;
font-weight: 700;
src: local('Nunito-Bold'), url(asset/font/TttUCfJ272GBgSKaOaD7KoX0hVgzZQUfRDuZrPvH3D8.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
</style>
<style type="text/css">
.container .left-col{ opacity: 1;}
#pagenavi a{ font-size: 1.3em;}
#pagenavi .next:before{ top: 3px;}
#pagenavi .prev:before{ top: 3px;}
.container .mid-col .mid-col-container #content .archives .title{ font-size: 1.5em;}
.container .mid-col .mid-col-container #content article{ padding: 15px 0px;}
#header .subtitle {
line-height: 1.2em;
padding-top: 8px;
}
article pre{ background: none; border: none; padding: 0;}
article .entry-content{text-align: left;}
.share-comment{ padding: 25px 0px; clear: both;}
hr{ margin: 20px 0px;border: 0; border-top:solid 1px #ddd;}
</style>
</head>
<body>
<div class="container">
<div class="left-col">
<div class="intrude-less">
<header id="header" class="inner">
<div class="profilepic">
<img src="asset/icon.jpg" style="width:160px;">
</div>
<h1><a href="index.html">Road to Geophysics</a></h1>
<p class="subtitle"></p>
<nav id="main-nav">
<ul class="main">
<li><a href="index.html">Home</a></li>
<!-- <li><a href="all.html">Blog</a></li>-->
<li><a href="archives.html">Archives</a></li>
</ul>
</nav>
<nav id="sub-nav">
<div class="social">
<!--
<a class="email" href="mailto:" title="Email">Email</a>
<a class="facebook" href="http://www.facebook.com/" title="Facebook">Facebook</a>
<a class="google" href="https://plus.google.com/" rel="author" title="Google+">Google+</a>
<a class="twitter" href="http://twitter.com/" title="Twitter">Twitter</a>
<a class="github" href="https://github.com/" title="GitHub">GitHub</a>
<a class="coderwall" href="https://coderwall.com/" title="Coderwall">Coderwall</a>
<a class="stackoverflow" href="http://stackoverflow.com/users/" title="StackOverflow"></a>
<a class="linkedin" href="http://www.linkedin.com/in/" title="LinkedIn">LinkedIn</a>
<a class="pinterest" href="https://pinterest.com/" title="Pinterest">Pinterest</a>
<a class="delicious" href="http://delicious.com/" title="Delicious">Delicious</a>
<a class="pinboard" href="https://pinboard.in/u:" title="Pinboard">Pinboard</a>
<a class="douban" href="https://www.douban.com/people/" title="Douban">Douban</a>
<a class="quora" href="https://quora.com/" title="Quora">Quora</a>
<a class="instagram" href="https://instagram.com/" title="Instagram">Instagram</a>
<a class="behance" href="https://www.behance.net/" title="Behance">Behance</a>
<a class="facebook" href="http://www.facebook.com/" title="Facebook">Facebook</a>
<a class="twitter" href="http://twitter.com/" title="Twitter">Twitter</a>
<a class="github" href="https://github.com/" title="GitHub">GitHub</a>
-->
<a class="rss" href="atom.xml" title="RSS">RSS</a>
</div>
</nav>
</header>
</div>
</div>
<div class="mid-col">
<div class="mid-col-container"> <div id="content" class="inner">
<div itemscope itemtype="http://schema.org/Blog">
<article class="post" itemprop="blogPost" itemscope itemtype="http://schema.org/BlogPosting">
<div class="meta">
<div class="date">
<time datetime="2016-02-22T20:44:52+08:00" itemprop="datePublished">2016/2/22</time>
</div>
<div class="tags">posted in
<a class='category' href='%E7%90%83%E5%87%BD%E6%95%B0.html'>球函数</a>
</div>
</div>
<h1 class="title" itemprop="name"><a href="14561450925713.html" itemprop="url">
球谐系数可视化</a></h1>
<div class="entry-content" itemprop="articleBody">
<p>可视化的三种方式</p>
<h2 id="toc_0">1. 单个文件,所有阶次的二维图</h2>
<ul>
<li><code>plot_SH(SH1)</code>
<img src="media/14561450925713/14561454957218.jpg" alt=""/>
<strong>图</strong>:2003年1月的结果(上图是取对数结果,下图是正负号)
<img src="media/14561450925713/14561455499740.jpg" alt=""/>
<strong>图</strong>:2003年6月结果</li>
</ul>
<p>结论:<br/>
1. 1月结果明显振幅大于6月(其实这是噪声)<br/>
2. 固定一个m看,明显有正负和振幅的震荡(即去相关滤波的出发点)</p>
<h2 id="toc_1">2. 单个文件,按阶或者次的序列</h2>
<ul>
<li><p><code>plot_SH_by_nm(SH1,n,m)</code></p></li>
</ul>
<ol>
<li>当m省略(不指定范围,默认从0到n),或者m为一列向量时(指定范围),以m为变量按照固定的n画图</li>
<li>当n为NaN(不指定范围,默认从m到Nmax),或者m为一个数值n为一列向量时(指定范围),以n为变量,按照固定的m画图</li>
</ol>
<p><img src="media/14561450925713/14561494999702.jpg" alt=""/><br/>
<strong>图</strong>:<code>plot_SH_by_nm(SH1,60,0:40)</code>:指定m范围</p>
<p><img src="media/14561450925713/14561495435469.jpg" alt=""/><br/>
<strong>图</strong>:<code>plot_SH_by_nm(SH1,60)</code>:省略m</p>
<p><img src="media/14561450925713/14561498507695.jpg" alt=""/><br/>
<strong>图</strong>:<code>plot_SH_by_nm(SH(1),nan,21)</code>:按照固定的m画图,自动分别连接奇偶项</p>
<h2 id="toc_2">3. 多个文件,某一阶次的时间序列</h2>
<ul>
<li><code>plot_SH_by_tt(SH1,n,m)</code>:n与m必须是scaler数值
<img src="media/14561450925713/14561514305613.jpg" alt=""/>
<strong>图</strong>:(10,10)的时间序列
<img src="media/14561450925713/14561515481615.jpg" alt=""/>
<strong>图</strong>:(30,30)的时间序列</li>
</ul>
</div>
</article>
<article class="post" itemprop="blogPost" itemscope itemtype="http://schema.org/BlogPosting">
<div class="meta">
<div class="date">
<time datetime="2016-01-22T13:26:26+08:00" itemprop="datePublished">2016/1/22</time>
</div>
<div class="tags">posted in
<a class='category' href='%E7%90%83%E5%87%BD%E6%95%B0.html'>球函数</a>
</div>
</div>
<h1 class="title" itemprop="name"><a href="14534403861434.html" itemprop="url">
质量反演方法</a></h1>
<div class="entry-content" itemprop="articleBody">
<h1 id="toc_0">通用公式</h1>
<h2 id="toc_1">一般球谐展开式</h2>
<pre><code>\\[f\left( {\theta ,\varphi } \right) = \sum\limits_{l = 0}^\infty {\sum\limits_{m = 0}^l {{{\tilde P}_{lm}}\left( {\cos \theta } \right)\left\{ {{C_{lm}}\cos m\varphi + {S_{lm}}\sin m\varphi } \right\}} } \\]
\\[\left\{ {\begin{array}{*{20}{c}}
{{C_{lm}}}\\
{{S_{lm}}}
\end{array}} \right\}\\]
</code></pre>
<h1 id="toc_2">SADI</h1>
<h2 id="toc_3">Matlab代码</h2>
<ul>
<li><code>[mass, LLZ_mass_trend, LLZ_d_F] =
ctl_SADI( SH_G, SH_d, LLZ_ind_obs, LLZ_ind_mass, m2matrix, N_lonlat, smooth, alpha )</code><br/>
空间域反演控制文件。其中:
<ul>
<li>SH_G:</li>
<li>SH_d:</li>
<li>LLZ_ind_obs</li>
<li>LLZ_ind_mass</li>
<li>m2matrix</li>
<li>N_lonlat, smooth</li>
<li>当alpha为矩阵的时候(如:<code>alpha=10^(-10:1:0)</code>),会调用这个函数内部的<code>[std_m,std_fit] = plot_l_curve(G,d,alpha)</code>画L曲线</li>
<li>当alpha为一个确定的值时,会反演并返回结果<br/></li>
</ul></li>
</ul>
<h3 id="toc_4">辅助代码</h3>
<ul>
<li><code>plot_inversion_map(LLZ_mass_trend, LLZ_d_F, cran, N_lonlat, N_lonlat_G, smooth)</code><br/>
画出反演结果的平面图。</li>
</ul>
<h1 id="toc_5">ITER</h1>
<h2 id="toc_6">Matlab代码</h2>
<ul>
<li><code>[rg_mass, SH_residue, totalmass]= ctrl_ITER_batch(SHs, LLZ_mask, smooth, Nstep, icheck, imethod)</code><br/>
调用<code>ctl_ITER_yi</code>或者<code>ctl_ITER_chen</code>,imethod设定</li>
<li><code>[rg_mass, s_list, varargout]= ctl_ITER_chen(SH_model0, LLZ_mask, smooth, Nstep)</code><br/>
chen的反演方法,海洋覆盖一层负质量</li>
<li><p><code>[rg_mass, s_list, sh_residue]= ctl_ITER_yi(SH_model0, LLZ_mask, smooth, Nstep)</code><br/>
我的反演方法,只有陆地有质量。rg_mass是格网值,只有mask为1的地方才有值;LLZ_mask只包含0和1;sh_residue为拟合残余系数,无量纲化。</p>
<p>s_list, 包含Nstep每一步的结果: <br/>
rg_F(rg_mass的展开结果), <br/>
rg_rsd(原始观测值减去rg_F), <br/>
rg_mass(反演出来的质量,第Nstep步就是最终返回值), <br/>
totalmass(rg_mass的总质量), <br/>
ratio(在mask为1的位置拟合残差比例)</p></li>
</ul>
</div>
</article>
<article class="post" itemprop="blogPost" itemscope itemtype="http://schema.org/BlogPosting">
<div class="meta">
<div class="date">
<time datetime="2016-01-22T10:47:15+08:00" itemprop="datePublished">2016/1/22</time>
</div>
<div class="tags">posted in
<a class='category' href='%E5%85%B6%E4%BB%96.html'>其他</a>
</div>
</div>
<h1 class="title" itemprop="name"><a href="14534308351747.html" itemprop="url">
Matlab与Google earth和GMT格式的交互</a></h1>
<div class="entry-content" itemprop="articleBody">
<h1 id="toc_0">Google earth</h1>
<h2 id="toc_1">使用google-earth获得范围内的点</h2>
<p>一个常见的需求是:怎么样划定一个范围,然后得到范围内的点?这里讲述怎么结合google earth和matlab实现这个功能。<br/>
google earth操作步骤:<br/>
* 1. 打开软件,缩放到合适的视图,然后点击添加路径:<br/>
<img src="media/14534308351747/14534308904208.jpg" alt=""/><br/>
* 2. 如图,我们添加了5个点,大概组成了一个矩形区域<br/>
<img src="media/14534308351747/14534309232558.jpg" alt=""/>
<br/>
可以给这个路径命名为myPath,并改变线条的颜色(样式/颜色),点击确定后会保存这个路径。<br/>
<strong>注意</strong>:已经放置的路径点可以用鼠标拖动修改;滚轮可以缩放调节视图,有利于更细节的修改;键盘的上下左右键可以移动视图;右键删除上一个放置的点(如果要删除中间的某个点,先左键单击它,再右键);如果想插入一个点,先在要插入位置的上一个点左键选中,再在需要插入位置左键点击。<br/>
* 3. 上一步中我们保存了名为myPath的路径,在左侧位置可以找到它,右击,选择将位置另存为<br/>
<img src="media/14534308351747/14534310265726.jpg" alt=""/><br/>
文件类型选择kml<br/>
<img src="media/14534308351747/14534310365955.jpg" alt=""/><br/>
这样我们得到了<code>myPath.kml</code>,用matlab代码可以读取<br/>
* 4. 用<code>read_kml</code>程序获得点的边界txt文件,保存在paths/路径下<br/>
* 5. 用<code>grid_in_bound</code>获得边界内的点,我们寻找所有在边界内的1°×1°的点。<br/>
* 6. 用<code>xyz2kml_points</code>把找到的点转为<code>points_myPath.kml</code>文件,导入到google earth中<br/>
<img src="media/14534308351747/14534310630825.jpg" alt=""/><br/>
可以看到,一共有87个点,每个点的编号标注在旁边。
这3个命令在<code>test_kml_data.m</code>中有具体代码。</p>
<h2 id="toc_2">matlab代码</h2>
<ul>
<li><code>read_kml(ip_kml,op_dir)</code><br/>
ip_kml为kml文件名称,op_dir为输出路径</li>
<li><code>[LLZ_ind,xyz]=grid_in_bound( BD, LLZ )</code><br/>
获得边界内的点</li>
<li><code>read_kml_to_a_single(ip_kml,op_file)</code><br/>
读取kml文件,写入到一个文件中,每个记录用 <code>> 记录名</code>隔开。这种文件适合GMT作图。</li>
<li><code>xyz2kml(op_kml,xy)</code><br/>
将多个线段写成kml文件,输入的xy可以通过命令<code>read_BD_and_name</code>生成。xy包含三个域:<code>xy(ii).x, xy(ii).y, xy(ii).name</code>,当name缺省时,自动转为1:N的字符串</li>
<li><code>xyz2kml_points(op_kml,xy,o_namelist)</code><br/>
将多个点写成kml文件。xy形状为(N,2),<code>o_namelist{ii}</code>为结构体</li>
<li><code>xy=read_BD_and_name(ipdir,namepattern)</code><br/>
例如:<code>read_BD_and_name(‘a/','*txt')</code>,专门供<code>xyz2kml</code>使用,生成其需要的xy</li>
</ul>
<h3 id="toc_3">批量处理模板: 从kml到mask</h3>
<pre><code>clear;
ip_kml = 'wang-Remote-sensing.kml';
bd_dir = 'BD';
op_xy = 'xy_with_nu.mat';
op_mask = 'mask_wang.mat';
iact = 4;
if iact == 1 % 1: kml2xyz
read_kml(ip_kml,bd_dir)
elseif iact == 2 % plot all
xy=read_BD_and_name(bd_dir,'*txt');
% xy = xy([6,7,4,8,2,3,5,1]); % re-order
Nxy = numel(xy);
ik = 0;
for ii = 1:Nxy
xy(ii).group = ii;
end
save( op_xy, 'xy')
elseif iact == 3 % generate group number
load(op_xy);%'xy');
Nxy = numel(xy);
% plot boundary and number
for ii = 1:Nxy
plot(xy(ii).x,xy(ii).y)
h = text(mean(xy(ii).x),mean(xy(ii).y),num2str(xy(ii).group));
set( h,'color','r','fontsize',14)
hold on;
end
all_plot('coast');
hold off
elseif iact == 4 % generate mask
load(op_xy);% 'xy');
OBS = mlonmlat(8);
Nfile = numel(xy);
LLZ_mask = OBS;
LLZ_mask.rg = zeros(size(LLZ_mask.lon));
for ii = 1:Nfile
info(ii).name = xy(ii).name;
info(ii).nu = xy(ii).group;
BD = [xy(ii).x,xy(ii).y];
[LLZ_ind0,vLLZ]=grid_in_bound( BD, OBS );
LLZ_mask.rg(LLZ_ind0.rg==1) = xy(ii).group;
end
LLZ_mask2 = LLZ_mask;
LLZ_mask2.rg(LLZ_mask2.rg==0) = NaN;
rg_plot(LLZ_mask2);
myaxis('tibet-L');
% save(op_mask,'LLZ_mask','info')
end
</code></pre>
<h3 id="toc_4">判断在边界内部:inpolygon</h3>
<p>一个附带的常见需求是求出边界内部的点。matlab自带的函数<code>inpolygon</code>可以解决这个问题<br/>
一个自带的例子:</p>
<pre><code>xv = rand(6,1); yv = rand(6,1);
xv = [xv ; xv(1)]; yv = [yv ; yv(1)];
x = rand(1000,1); y = rand(1000,1);
in = inpolygon(x,y,xv,yv);
plot(xv,yv,x(in),y(in),’.r’,x(~in),y(~in),'.b')
</code></pre>
<p><img src="media/14534308351747/14534323980173.jpg" alt=""/></p>
<h1 id="toc_5">GMT</h1>
<h2 id="toc_6">matlab代码</h2>
<ul>
<li><code>xys=read_segments(ip_xy)</code><br/>
从片段文件中(<code>></code>隔开)读取各个片段,组成<code>xys(ik)</code>,包含域<code>.x, .y, .name</code></li>
</ul>
</div>
</article>
</div>
<nav id="pagenavi">
<div class="center"><a href="archives.html">Blog Archives</a></div>
</nav>
</div>
</div>
<footer id="footer" class="inner">Copyright © 2014
Powered by <a target="_blank" href="http://www.mweb.im">MWeb</a>
Theme by <a href="http://shashankmehta.in/archive/2012/greyshade.html">Shashank Mehta</a>
</footer>
</div>
</div>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script><script type="text/x-mathjax-config">MathJax.Hub.Config({TeX: { equationNumbers: { autoNumber: "AMS" } }});</script>
</body>
</html>