欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

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

 更新時(shí)間:2019年06月18日 14:12:58   作者:幻影03  
這篇文章主要為大家詳細(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

問題1)缺少依賴包

 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:

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

問題2)配置文件的編碼異常

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ù)傳遞情況:

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é)果如下:

<_io.TextIOWrapper name='config.yml' mode='r' encoding='cp936'>

編碼不對(duì)?

65001  :UTF-8代碼頁

936 :默認(rèn)的GBK

437 :是美國(guó)英語

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

問題3)python調(diào)試打印語句

print ("value=%d"%value)

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

如下:

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

應(yīng)用指令

cmd > python seisplot.py data/my.sgy

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

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ù)做歸一化處理

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

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é)果如下:

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

測(cè)試備忘

1

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

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

2

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

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

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

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

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

相關(guān)文章

  • python格式化字符串實(shí)例總結(jié)

    python格式化字符串實(shí)例總結(jié)

    這篇文章主要介紹了python格式化字符串的方法,實(shí)例展示了常見的幾類Python針對(duì)字符串的格式方法,非常實(shí)用,需要的朋友可以參考下
    2014-09-09
  • 在pytorch中對(duì)非葉節(jié)點(diǎn)的變量計(jì)算梯度實(shí)例

    在pytorch中對(duì)非葉節(jié)點(diǎn)的變量計(jì)算梯度實(shí)例

    今天小編就為大家分享一篇在pytorch中對(duì)非葉節(jié)點(diǎn)的變量計(jì)算梯度實(shí)例,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2020-01-01
  • 深入理解python中的select模塊

    深入理解python中的select模塊

    這篇文章主要介紹了python中select模塊的相關(guān)資料,Python中的select模塊專注于I/O多路復(fù)用,提供了select、poll和epoll三個(gè)方法,文中還詳細(xì)的介紹了select和poll,因?yàn)閜oll與select相差不大,所以本文不作介紹,需要的朋友們下面來一起看看吧。
    2017-04-04
  • 跟老齊學(xué)Python之有容乃大的list(3)

    跟老齊學(xué)Python之有容乃大的list(3)

    現(xiàn)在是講lis的第三章了。俗話說,事不過三,不知道在開頭,我也不知道這一講是不是能夠把基礎(chǔ)的list知識(shí)講完呢。哈哈。其實(shí)如果真正寫文章,會(huì)在寫完之后把這句話刪掉的。而我則是完全像跟看官聊天一樣,就不刪除了。
    2014-09-09
  • python多線程操作實(shí)例

    python多線程操作實(shí)例

    這篇文章主要介紹了python多線程操作實(shí)例,本文先是講解了python多線程的相關(guān)知識(shí)、python多線程使用的兩種方法等內(nèi)容,需要的朋友可以參考下
    2014-11-11
  • Python使用conda如何安裝requirement.txt的擴(kuò)展包

    Python使用conda如何安裝requirement.txt的擴(kuò)展包

    這篇文章主要介紹了Python使用conda如何安裝requirement.txt的擴(kuò)展包問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-02-02
  • 什么是Python變量作用域

    什么是Python變量作用域

    在本篇文章里小編給大家整理的是關(guān)于Python變量作用域的相關(guān)知識(shí)點(diǎn)內(nèi)容,需要的朋友們可以學(xué)習(xí)下。
    2020-06-06
  • python中input()的用法及擴(kuò)展

    python中input()的用法及擴(kuò)展

    這篇文章主要介紹了python中input()的用法及擴(kuò)展,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-05-05
  • 用pip給python安裝matplotlib庫的詳細(xì)教程

    用pip給python安裝matplotlib庫的詳細(xì)教程

    這篇文章主要介紹了用pip給python安裝matplotlib庫的詳細(xì)教程,本文通過圖文并茂的形式給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2021-02-02
  • python整小時(shí) 整天時(shí)間戳獲取算法示例

    python整小時(shí) 整天時(shí)間戳獲取算法示例

    今天小編就為大家分享一篇python整小時(shí) 整天時(shí)間戳獲取算法示例,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2019-02-02

最新評(píng)論