激情久久久_欧美视频区_成人av免费_不卡视频一二三区_欧美精品在欧美一区二区少妇_欧美一区二区三区的

腳本之家,腳本語(yǔ)言編程技術(shù)及教程分享平臺(tái)!
分類導(dǎo)航

Python|VBS|Ruby|Lua|perl|VBA|Golang|PowerShell|Erlang|autoit|Dos|bat|

服務(wù)器之家 - 腳本之家 - Python - python地震數(shù)據(jù)可視化詳解

python地震數(shù)據(jù)可視化詳解

2021-07-15 09:21幻影03 Python

這篇文章主要為大家詳細(xì)介紹了python地震數(shù)據(jù)可視化的相關(guān)資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了python地震數(shù)據(jù)可視化的具體代碼,供大家參考,具體內(nèi)容如下

參考源碼:seisplot

準(zhǔn)備工作:

在windows10下安裝python3.7,下載參考源碼到本地。

1. demo繪圖測(cè)試

demo繪圖指令

cmd> python seisplot.py --demo

問(wèn)題1)缺少依賴包

?
1
2
3
4
5
6
7
file "d:/desktop/python可視化/seisplot/seisplot.py", line 16, in <module>
 import yaml
modulenotfounderror: no module named 'yaml'
 
>pip3 install yaml
 could not find a version that satisfies the requirement yaml (from versions: )
no matching distribution found for yaml

查看environment.yml:

?
1
2
3
4
5
6
7
8
9
channels:
- defaults
- conda-forge
dependencies:
- matplotlib
- numpy
- obspy
- pillow
- pyyaml

安裝相關(guān)依賴包,如 obspy pillow pyyaml 

cmd> pip3 install obspy

出現(xiàn)proxy error, 添加選項(xiàng) --proxy server:port

安裝ok

問(wèn)題2)配置文件的編碼異常

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
d:\desktop\python可視化\seisplot>python seisplot.py --demo
[91m
 welcome to
 ┌─┐┌─┐┬┌─┐┌─┐┬ ┌─┐┌┬┐
 └─┐├┤ │└─┐├─┘│ │ │ │
 └─┘└─┘┴└─┘┴ ┴─┘└─┘ ┴
    good luck[0m
traceback (most recent call last):
 file "seisplot.py", line 421, in <module>
 cfg = yaml.load(f)
 file "d:\programfiles\python36\lib\site-packages\yaml\__init__.py", line 70, in load
 loader = loader(stream)
 file "d:\programfiles\python36\lib\site-packages\yaml\loader.py", line 34, in __init__
 reader.__init__(self, stream)
 file "d:\programfiles\python36\lib\site-packages\yaml\reader.py", line 85, in __init__
 self.determine_encoding()
 file "d:\programfiles\python36\lib\site-packages\yaml\reader.py", line 124, in determine_encoding
 self.update_raw()
 file "d:\programfiles\python36\lib\site-packages\yaml\reader.py", line 178, in update_raw
 data = self.stream.read(size)
unicodedecodeerror: 'gbk' codec can't decode byte 0x99 in position 2003: illegal multibyte sequence

分析源碼中參數(shù)傳遞情況:

?
1
2
3
4
5
6
7
8
9
10
11
def load(stream, loader=loader):
 """
 parse the first yaml document in a stream
 and produce the corresponding python object.
 """
 print(stream) ## debug by huanying03
 loader = loader(stream)
 try:
  return loader.get_single_data()
 finally:
  loader.dispose()

打印結(jié)果如下:

?
1
<_io.textiowrapper name='config.yml' mode='r' encoding='cp936'>

編碼不對(duì)?

65001  :utf-8代碼頁(yè)

936 :默認(rèn)的gbk

437 :是美國(guó)英語(yǔ)

仔細(xì)檢查發(fā)現(xiàn)config.yml中有異常字符,更正config.yml中錯(cuò)誤字符:ok

問(wèn)題3)python調(diào)試打印語(yǔ)句

print ("value=%d"%value)

demo數(shù)據(jù)繪圖結(jié)果

如下:

python地震數(shù)據(jù)可視化詳解

2. 本地?cái)?shù)據(jù)繪圖測(cè)試

應(yīng)用指令

cmd > python seisplot.py data/my.sgy

問(wèn)題1)數(shù)據(jù)道的采樣值異常

?
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
filename data2/t10.sgy
seismic.py:104:dt=4000
seismic.py:104:ns=512
seismic.py:144:header=b'c 1 client'
n_traces 500
n_samples 512
dt   0.004
t_start 0
t_end  2.044
max_val inf
min_val -inf
clip_val 180462501764003194804057887685476352
read data in 0.4 s
 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
plotting
plot width 17.00 in
plot height 11.00 in
traceback (most recent call last):
 file "seisplot.py", line 442, in <module>
 main(t, cfg)
 file "seisplot.py", line 214, in main
 cfg)
 file "d:\desktop\python可視化\seisplot\plotter.py", line 123, in plot_histogram
 y, x, _ = ax.hist(np.ravel(data), bins=int(100.0 / (clip_val / largest)),
overflowerror: cannot convert float infinity to integer

解決辦法:將數(shù)據(jù)做歸一化處理

問(wèn)題2)數(shù)據(jù)文件的卷頭異常

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
filename data2/marmousi_vel.segy.hdrs.sgy.cdp.sgy
seismic.py:104:dt=10000
seismic.py:104:ns=350
seismic.py:144:header=b'\xc3@\xf1@\xc3\xd3\xc9\xc5\xd5\xe3'
traceback (most recent call last):
 file "seisplot.py", line 442, in <module>
 main(t, cfg)
 file "seisplot.py", line 40, in main
 s = seismic.from_segy(target, params={'ndim': cfg['ndim']})
 file "d:\desktop\python可視化\seisplot\seismic.py", line 164, in from_segy
 return cls.from_obspy(stream, params=params)
 file "d:\desktop\python可視化\seisplot\seismic.py", line 147, in from_obspy
 x =np.array(list(stream.textual_file_header.decode()))
unicodedecodeerror: 'utf-8' codec can't decode byte 0xc3 in position 0: invalid continuation byte

解決辦法:重寫3200字節(jié)的segy卷頭

marmousi相關(guān)數(shù)據(jù)繪圖

速度模型繪圖結(jié)果如下:

python地震數(shù)據(jù)可視化詳解

marmousi模型正演的炮集數(shù)據(jù)繪圖結(jié)果如下:

python地震數(shù)據(jù)可視化詳解

測(cè)試備忘

1

cygwin執(zhí)行指令,可以看到反饋信息為彩色,分析信息很方便。

相比之下,cmd終端執(zhí)行指令后的反饋信息可讀性較差。

2

本地?cái)?shù)據(jù)出現(xiàn)異常后,通過(guò)cwp中的segyread, sushw, sugain, segywrite等程序進(jìn)行修改,滿足繪圖程序要求。

1)3200字節(jié)的卷頭必須規(guī)范

2)道頭字中的cdpt取值必須規(guī)范(xline)

3)道采樣值最好歸一化處理。

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持服務(wù)器之家。

原文鏈接:https://blog.csdn.net/sinat_27917465/article/details/86517738

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: japanese hot milf free av| 国产久草视频在线 | 在线免费观看精品 | 中文字幕精品一区久久久久 | 一边吃奶一边插下面 | 国内精品久久久久久久影视红豆 | va视频在线| lutube成人福利在线观看污 | 久久久久亚洲精品国产 | 欧美一级黄色免费 | 精品爱爱 | 在线天堂资源 | 欧美精品一区二区三区久久久 | 成年人免费黄色片 | 国产免费视频一区二区裸体 | 国产外围在线 | 一区二区免费看 | 日韩视频精品 | 精品91av| 一级性生活视频 | 99影视在线视频免费观看 | 天天都色视频 | 亚欧在线免费观看 | 国产精品一区二区三区在线 | 国产一区成人 | 久久国产一二区 | 一级在线 | 一级一级一级一级毛片 | 精品黑人一区二区三区国语馆 | 色交视频 | 国产色视频在线观看免费 | 欧美成人黄色小视频 | 欧洲精品久久久久69精品 | 久久精品亚洲一区二区 | 九九热视频在线免费观看 | 欧美国产一区二区三区 | 久久精品视频在线免费观看 | 一级免费在线 | 欧美精品一区二区久久 | 露脸各种姿势啪啪的清纯美女 | 在线观看av国产一区二区 |