修改道数据为0
- 这里是将第100-200道的数据修改为0
import segyio import numpy as np path = '.\data\LX_SEGY005.segy' # Open the SEGY file for reading and writing with segyio.open(path, 'r+') as src: # Determine the start and end sample indices for your time window start_sample = 100 # Starting sample index end_sample = 200 # Ending sample index # Loop through traces and modify amplitudes within the time window for i, trace in enumerate(src.trace): if start_sample <= i <= end_sample: # Modify amplitude values here, for example, increase them by 10% src.trace[i] = trace * 0 # The modified SEGY data is saved in the same 'input.segy' file. print("SEGY file has been modified.")
查看
import segyio import numpy as np path = '.\data\LX_SEGY005.segy' with segyio.open(path, 'r+') as f: print(f.trace[101])
修改某个振幅值
segy这里如果使用
trace[i][j]=0
是不能保存的,需要整道数据一起保存才可以- 将改到数据放入列表,进行整到修改
- 修改第一道第十个采样的的振幅值
import segyio import numpy as np path = '.\data\LX_SEGY005.segy' # 打开SEGY文件以读取数据 with segyio.open(path, 'r+') as src: # 将所有道数据加载到列表中 traces = list(src.trace) # 确保第一道数据足够长以包含第10个振幅值 if len(traces[0]) > 9: # 修改第一道的第10个振幅值为0 traces[0][9] = 0.0 # 将修改后的道集写回SEGY文件 for i, trace in enumerate(traces): src.trace[i] = trace src.flush() print(traces[0]) print(traces[0][9]) print("第一道数据的第10个振幅值已修改为0,并已保存到SEGY文件中。")
sunmo < output225.su invert=1 \ cdp=225 \ tnmo=0.0572337,0.314785,0.505564,0.696343,0.939587,1.19237,1.34499,1.67886,1.97933,2.24165,2.56121,2.79014,2.90461 \ vnmo=5220.93,5662.79,6081.4,6779.07,7151.16,7476.74,7918.6,8872.09,9360.46,9848.84,10825.6,11104.7,11383.7 > outdata_225_cmp.su