GithubHelp home page GithubHelp logo

xumi1993 / seispy Goto Github PK

View Code? Open in Web Editor NEW
86.0 7.0 28.0 20.6 MB

Python module of seismology and receiver functions

Home Page: https://seispy.xumijian.me

License: GNU General Public License v3.0

Python 100.00%
python receiver-functions seismology geophysics

seispy's Introduction

License GitHub code size in bytes GitHub repo size Static Badge

CRV test codecov Upload Python Package Seispy docs

Anaconda-Server Badge Conda Version Anaconda-Server Badge

PyPI PyPI - Python Version

GitHub stars

Seispy is a Python module for processing seismological data and calculating Receiver Functions. The advanced functions are available to improve the Obspy.

Acknowledgements

For the use of the Seispy package, please cite as:

  • Xu, M. & He, J. (2023). Seispy: Python Module for Batch Calculation and Postprocessing of Receiver Functions. Seismological Research Letters, 94 (2A): 935–943. Static Badge

For 3D time-difference correction, please also consider citing:

  • Xu, M., Huang, H., Huang, Z., Wang, P., Wang, L., Xu, M., ... & Yuan, X. (2018). Insight into the subducted Indian slab and origin of the Tengchong volcano in SE Tibet from receiver function analysis. Earth and Planetary Science Letters, 482, 567-579. Static Badge

  • Xu, M., Huang, Z., Wang, L., Xu, M., Mi, N., & Yu, D. (2020). Lateral variation of the mantle transition zone beneath the Tibetan plateau: Insight into thermal processes during Indian–Asian collision. Physics of the Earth and Planetary Interiors, 301, 106452. Static Badge

For 2D and 3D CCP stacking, please also consider citing:

  • Xu, M., Huang, Z., Wang, L., Xu, M., Zhang, Y., Mi, N., ... & Yuan, X. (2020). Sharp lateral Moho variations across the SE Tibetan margin and their implications for plateau growth. Journal of Geophysical Research: Solid Earth, 125(5), e2019JB018117. Static Badge

Installation

See Seispy documentation in detail.

Libraries

  • seispy.distaz: Calculate distance and azimuth credited by the lithospheric seismology program at USC, but numpy.ndarray operations are supported.
  • seispy.geo: Tiny codes of geophysics.
  • seispy.decon: Functions of deconvolution transferred from iwbailey/processRFmatlab including
    • Iterative time domain deconvolution method (Ligorría and Ammon 1999 BSSA).
    • Water level frequency domain deconvolution method (CJ. Ammon 1991 BSSA)
  • seispy.rf: Procedure for RF calculation. The functions of match_eq, search_eq invoked obspy.core.UTCDateTime and obspy.clients from the Obspy.
  • seispy.eq: RF processing for each event, which invoked obspy.io.sac, obspy.signal, obspy.taup and obspy.core.Stream from the Obspy.
  • seispy.hk: H-k stacking for single station (Zhu and Kanamori 2000 JGR).
  • seispy.rfani: A joint method for crustal anisotropic calculation (Liu and Niu 2011 GJI).
  • seispy.slantstack: Slant stacking for single station (Tauzin et al., 2008)
  • seispy.rfcorrect: Subsequent process of RFs including moveout correction and time to depth conversion (1D and 3D) (see Xu et al., 2018 EPSL)
  • seispy.ccpprofile: CCP stacking along a profile.
  • seispy.ccp3d: 3-D CCP stacking with extracting depth D410 and D660.

Commands

Receiver Functions

  • prf: Calculate PRFs for a station.
  • pickrf: Pick PRFs with virtual quality control after the calculation.
  • plotrt: Plot PRFs with R and T components order by back-azimuth.
  • plotr: Plot PRFs with R component order by back-azimuth.
  • hk: H-Kappa stacking for estimating Moho depth and crustal Vp/Vs.
  • rf2depth: Convert PRFs to depth axis.
  • ccp_profile: Stack PRFs along a profile with a CCP stacking method.
  • ccp3d: Stack PRFs with spaced bins.
  • rfani: Estimating crustal anisotropy with a joint method.
  • rfharmo: Harmonic decomposition to extract constant component of RF and plot dip/anisotropic components.
  • pickdepth: Pick depth of stacked PRFs following ccp3d

Others

  • veltxt2mod: Create 3D velocity model with numpy.lib.npyio.NpzFile format from a ASCII table file.
  • downlod_catalog: Download catalogs from FDSN web-service.
  • gen_rayp_lib: Generate a rap-parameter library with depth of source and epicentral distance.
  • setpar: Set up the values in configure files.

seispy's People

Contributors

jousf-1409 avatar xumi1993 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

seispy's Issues

more than 3 components, please select to delete redundant seismic components

Hi all,
I have been encountering an issue while downloading data from a server for the selected channel 'HH?' using the configuration below. The error message suggests that some events have more than 3 components, prompting the need to delete redundant seismic components.

Here is the output of the run:

2024-01-28 16:13:12,512 [RF] INFO: Fetch waveforms of (160/451) event 2010.357.14.00.32 from KOERI
2024-01-28 16:13:12,928 [RF] INFO: Fetch waveforms of (161/451) event 2011.012.21.32.53 from KOERI
2024-01-28 16:13:13,390 [RF] INFO: Fetch waveforms of (162/451) event 2011.018.20.23.23 from KOERI
2024-01-28 16:13:13,833 [RF] INFO: Fetch waveforms of (163/451) event 2011.041.14.39.27 from KOERI
2024-01-28 16:13:14,189 [RF] ERROR: 2011.041.14.49.50 has more than 3 components, please select to delete redundant seismic components
2024-01-28 16:13:14,231 [RF] INFO: Fetch waveforms of (164/451) event 2011.041.14.41.58 from KOERI
2024-01-28 16:13:14,575 [RF] ERROR: 2011.041.14.52.21 has more than 3 components, please select to delete redundant seismic components
2024-01-28 16:13:14,582 [RF] INFO: Fetch waveforms of (165/451) event 2011.068.02.45.20 from KOERI
2024-01-28 16:13:14,935 [RF] INFO: Fetch waveforms of (166/451) event 2011.068.21.24.01 from KOERI
2024-01-28 16:13:15,238 [RF] INFO: Fetch waveforms of (167/451) event 2011.070.05.46.24 from KOERI

I copied the config file below:

query = Query(server='KOERI') 
query.get_stations(network='KO', station=station_name, level='channel', 'channel=HH?')
print(query.stations)
rf = RF()
rf.para.data_server = 'KOERI'
rf.para.cata_server = 'IRIS'
rf.para.stainfo.network = 'KO'
rf.para.stainfo.station = station_name
rf.para.stainfo.channel = 'HH?'
rf.para.stainfo.location = '*'
rf.para.datapath = './Data/{}.{}'.format(rf.para.stainfo.network, rf.para.stainfo.station)
rf.para.use_remote_data = True
rf.para.ref_comp ='HHZ'
rf.para.phase = 'P'
rf.para.noisegate = 1
rf.para.magmin = 6.3
rf.para.gauss = [1.0,1.5,2.0,2.5] ##RF with different Gauss factor will be calculated simultaneously.
rf.para.rmsgate = 0.4
rf.para.freqmin = 0.05
rf.para.freqmax = 2.0
rf.para.comp = 'RTZ'
rf.para.date_begin = UTCDateTime('20000101')
rf.para.date_end = UTCDateTime('20231231')

Additionally, I often have data from both BH and HH components for the same station, and it would be helpful to prioritize one over the other.

Can someone help me understand why this error is occurring, and how I can address it? Also, any suggestions on giving priority to either BH or HH components for the same station would be appreciated.

Thank you!

Error calling psrf2depth function

#Error calling psrf2depth function


TypeError   Traceback (most recent call last)
TypeError: psrf2depth() got an unexpected keyword argument 'sampling'

Circle shape bin not working

Hello, I was trying to do some tests with the ccp_profile function and I can't make the circle shape bin to work because it shows the error:

Traceback (most recent call last):
File "/home/felipe/.local/bin/ccp_profile", line 8, in
sys.exit(ccp_profile())
File "/home/felipe/.local/lib/python3.8/site-packages/seispy/scripts.py", line 94, in ccp_profile
ccp.stack()
File "/home/felipe/.local/lib/python3.8/site-packages/seispy/ccpprofile.py", line 228, in stack
for k in idxs:
TypeError: 'int' object is not iterable

Matter-of-factly I looked in the ccpprofile.py routine and I didn't get how it would interate with the idxs bin a number because in the function "stack(self)" we get :

...
 if self.cpara.width is None and self.cpara.shape == 'circle':
                idxs = self.idxs[i]
 else:
                idxs = self.idxs
 for j, dep in enumerate(self.cpara.stack_range):
                idx = int(j * self.stack_mul + self.cpara.stack_range[0]/self.cpara.dep_val)
                bin_dep_amp = np.array([])
                for k in idxs:
                         stop_idx = np.where(self.rfdep[k]['stopindex'] >= idx)[0]
                          fall_idx = np.where(distaz(self.rfdep[k][field_lat][stop_idx, idx], self.rfdep[k][field_lon][stop_idx, idx],
                                        bin_info[0], bin_info[1]).delta < self.fzone[j])[0]

meaning that, if we choose a circle we only get a int that is not interable. So, I commonly don't see something here, so can someone help what I didn't get right, please?

Matching problem in rf.cfg configuration file

#Several earthquake events like those in the example folder were applied for in IRIS, but the earthquake events were not matched when the command was executed. Is this related to the header information of the applied earthquake events?


  1. The error content is as follows:
2022-07-29 11:40:38,587 [RF] INFO: Load station info from ./NJ
2022-07-29 11:40:38,609 [RF] INFO: Searching earthquakes from IRIS
2022-07-29 11:40:43,914 [RF] INFO: 33 earthquakes are found
2022-07-29 11:40:43,943 [RF] INFO: Match SAC files
2022-07-29 11:40:43,987 [RF] ERROR: 
2022-07-29 11:40:43,991 [RF] ERROR: 
2022-07-29 11:40:43,994 [RF] ERROR:
2022-07-29 11:40:43,997 [RF] ERROR: 
2022-07-29 11:40:44,000 [RF] ERROR:
2022-07-29 11:40:44,001 [RF] WARNING: No earthquakes matched, please check configurations.

2.The following is my script for applying for earthquake events on IRIS

import os
import obspy
import numpy as np
from obspy import UTCDateTime
from matplotlib import pyplot as plt
##from obspy.clients.fdsn import Client
from obspy.clients.fdsn import Client
from obspy.clients.fdsn.mass_downloader import RectangularDomain, \
    Restrictions, MassDownloader

client = Client('IRIS')
time = UTCDateTime('2014-02-02T09:26:41') 
starttime = time + 00 
endtime = starttime + 1000
 
net = 'CB' 
sta = 'NJ2' 
loc = '00' 
chan = 'BHZ' 
Format = "SAC"
 
st = client.get_waveforms(net,sta,loc,chan,starttime,endtime)#,attach_response = True) 
st.plot()

time_name = obspy.UTCDateTime.strftime(time, '%Y.%j.%H%M%S')
dir_name = 'D:\\EVENTS\\NJ2\\'
if not os.path.exists(dir_name):
    os.mkdir(dir_name)

Filename_path = os.path.join(dir_name, net + '.' + sta + '.' + loc + '.' + chan + '.' + 'M' + '.' + time_name + '.' + 'SAC')
st.write(filename=Filename_path, formate=Format)
print("%s写入完成!" % Filename_path)

The data of Nanjing station applied with this script cannot match.The applied sac documents are CB.NJ2.00.BHZ.M.2014.001.160334.SAC, CB.NJ2.00.BHZ.M.2014.020.025250.SAC, CB.NJ2.00.BHZ.M.2014.021.012920.SAC, CB.NJ2.00.BHZ.M.2014.025.051422.SAC and CB.NJ2.00.BHZ.M.2014.033.092641.SAC respectively

[seispy srf] Inquiry for configuration template file for SRF

Hello~ I'm a user of seispy. Recently I tried to use seispy to calculate SRF. Unfortunately, I didn't find the configuration template file for SRF (hope I didn't miss it by negligence?) on the documentation website.
Although a template file for PRF is available, the differences may still be hard to tackle for beginners like me :)

For example, I just realized that I need to put phase = S in the configuration if the srf command is used, instead of not putting it in, or taking it for phase = 'S'. Later I tried to retrieve Q component SRF, but this time I can't find the suitable settings for that :(

So I'm here to ask if a configuration template file for SRF is/will be available. Really appreciate it if letting me know~

Encountered "[RF] ERROR: unconverted data remains: 5", what cause this?

Hi seispy developer,
I tried to use prf rf.cfg to calculate RFs of a single station and encountered the following errors:
Here is command log:
2022-07-13 15:28:36,837 [RF] INFO: Load station info from ./rawdata/1001 2022-07-13 15:28:36,838 [RF] INFO: Searching earthquakes from IRIS 2022-07-13 15:28:38,722 [RF] INFO: 22 earthquakes are found 2022-07-13 15:28:38,722 [RF] INFO: Match SAC files 2022-07-13 15:28:38,724 [RF] ERROR: unconverted data remains: 5

Improvement with class RFStation

I'm trying to modify class RFStation from 3 aspect.

a obspy.core.trace.add_processing_info like decorator. Introduce a compatible and easier way to add processing info to given logger (almost done)

RMS and other method for quality control before stacking.( optional )

simplify init and introduce more magic method to support future development.

Mutitheard downloading waveforms

Is your feature request related to a problem? Please describe.
Mutitheard downloading waveforms.

Describe the solution you'd like

  • Define a function like star_download
  • Open a ThreadPool and throw arguments of star_download into the ThreadPool.
  • Following mass_download in obspy
def star_download_mseed(args):
    """
    Star maps the arguments to the
    utils.download_and_split_mseed_bulk() function.

    :param args: The arguments to be passed.
    """
    try:
        ret_val = utils.download_and_split_mseed_bulk(
            *args, logger=self.logger)
    except utils.ERRORS as e:
        msg = ("Client '%s' - " % args[1]) + str(e)
        if "no data available" in msg.lower():
            self.logger.info(msg.split("Detailed response")[0].strip())
        else:
            self.logger.error(msg)
        return []
    return ret_val

pool = ThreadPool(min(threads_per_client, len(chunks)))

pool.map(
      star_download_mseed,
      [(self.client, self.client_name, chunk) for chunk in chunks])
pool.close()

倾斜叠加self.ref_dis = 65单位和self.dis = dis不一致

Describe the bug
A clear and concise description of what the bug is.

Expected behavior
A clear and concise description of what you expected to happen.

Error raised
If applicable, add screenshots to help explain your problem.

Platform (please complete the following information):

  • OS: [e.g. MacOS]
  • Version [e.g. 1.2.14]

Additional context
Add any other context about the problem here.

When selecting QRF, there is no file matching the file pattern

Describe the bug
A clear and concise description of what the bug is.
When BEZ rotate to QRT and QRF is selected, the terminal will prompt an exception 'No file matching file pattern: .//_ L.sac’. Then I found that in the rpickfigure.py script, the '*P_Q.sac' on lines 49 and 50 corresponds to the 'self.comp = 'L'' on line 51.
Expected behavior
A clear and concise description of what you expected to happen.
Replace "L" with "Q" in line 51.
Error raised
If applicable, add screenshots to help explain your problem.
Screenshot from 2022-03-30 10-37-27
Screenshot from 2022-03-30 10-38-10
Screenshot from 2022-03-30 10-39-17

Platform (please complete the following information):

  • OS: [e.g. MacOS] Linux
  • Version [e.g. 1.2.14] Ubuntu 20.04

Additional context
Add any other context about the problem here.

Test post-processing of SRF

Post-processing of SRF is a new feature for the next version. Following cases need to be tested and compared with other RF code

  • Moveout correction with specified ray-parameter.
  • Time-to-depth conversion
  • 3D time difference correction
  • CCP stacking

Consult the seispy library for problems related to calculating a seismic event receiving function separately

#Consult the seispy library for problems related to calculating a seismic event receiving function separately


  1. Calculate PRF.Use example failed.The error content is as follows:
File f:\Python\Python309\lib\site-packages\obspy\core\stream.py:643, in Stream.__getitem__(self, index)
    641     return self.__class__(traces=self.traces.__getitem__(index))
    642 else:
--> 643     return self.traces.__getitem__(index)

IndexError: list index out of range

Windows 10
Python 3.10.2
pip install python-seispy

Encounter "No earthquakes matched, please check configurations." with different location code

Hello, seispy developer, when I ran the script,I found that the 28th line of the 'eq.py' script indicated that the seismic event must have three components. However, when matching seismic events, the number of components of seismic events due to different location codes will be multiples of three.
For example, if there are six or nine components, it will prompt "No earthquakes matched, please check configurations." , but it is difficult for user to know what caused it.
I think it is possible to add a judgment statement after line 28 in the 'eq.py' script whether each earthquakes event has only three components. If not, you can prompt "Each earthquake event in the file has more than three components, please select to delete redundant seismic components" .

Download remote data issue

Describe the bug
when i try to download XR.ST39, there are 2 erros:
2024-03-05 22:29:34,225 [RF] INFO: Load station info of XR.ST39 from IRIS web-service
2024-03-05 22:29:34,749 [RF] INFO: XR.ST39, latitude: 33.764, longitude: 88.400
2024-03-05 22:29:34,749 [RF] INFO: Searching earthquakes from IRIS
2024-03-05 22:29:41,680 [RF] INFO: 156 earthquakes are found
2024-03-05 22:29:41,681 [RF] INFO: Fetch seismic data from IRIS
2024-03-05 22:29:41,701 [RF] ERROR: More than one phase were calculated with source depth of 33.0 and distance of 14.551067692913245
2024-03-05 22:29:41,701 [RF] ERROR: cannot access local variable 'arr_time' where it is not associated with a value
date evla evlo evdp mag magtype
0 1998-07-12T07:16:16.640000Z 47.722 82.882 33.0 5.2 mwc
1 1998-07-15T04:36:01.080000Z 29.576 81.466 33.0 4.7 mb
2 1998-07-18T01:40:30.210000Z 35.303 81.560 33.0 4.6 mb
3 1998-07-18T06:21:17.010000Z 35.357 78.378 33.0 4.8 mb
4 1998-07-19T16:56:46.190000Z 35.517 78.286 33.0 4.8 mb
.. ... ... ... ... ... ...
151 1999-11-30T10:08:08.100000Z 36.306 81.273 33.0 4.9 mb
152 1999-12-01T13:56:43.750000Z 30.024 81.444 33.0 4.5 mb
153 1999-12-06T07:33:11.160000Z 42.629 76.322 20.9 5.2 mwc
154 1999-12-17T10:15:02.200000Z 40.759 77.272 33.0 4.5 mb
155 1999-12-20T11:46:54.290000Z 24.517 97.774 52.1 4.6 mb

[156 rows x 6 columns]
an error occurred: cannot access local variable 'arr_time' where it is not associated with a value

Additional context
while other stations like XR.ST00-XR.ST10 works well,here is my code:
rf = RF()
rf.para.data_server = 'IRIS'
rf.para.cata_server = 'IRIS'
rf.para.stainfo.network = 'XR'
rf.para.stainfo.station = 'ST39'
rf.para.stainfo.channel = 'BH?'
rf.para.stainfo.location = '01'
rf.para.datapath = './Data_INDEPTH3/{}.{}'.format(rf.para.stainfo.network, rf.para.stainfo.station)
rf.para.use_remote_data = True

rf.para.ref_comp ='BHZ'
rf.para.phase = 'P'
rf.para.noisegate = 1
rf.para.magmin = 4.5
rf.para.dismin = 5
rf.para.dismax = 15
rf.para.depthmax = 80
rf.para.gauss = [0.5, 1.0, 1.5, 2.0] ##RF with different Gauss factor will be calculated simultaneously.
rf.para.rmsgate = 0.4
rf.para.freqmin = 0.05
rf.para.freqmax = 2.0
rf.para.comp = 'RTZ'

rf.para.date_begin = UTCDateTime('19970711')
rf.para.date_end = UTCDateTime('19991231')

rf.load_stainfo()
rf.search_eq(catalog='NEIC PDE')
print(rf.eq_lst) ##The matched event lists are listed
rf.match_eq()
rf.save_raw_data()
rf.eqs.to_csv('{}/eqs.csv'.format(rf.para.datapath))

Error raised when executing `pickrf`

Following errors were raised when executing pickrf ./CB.NJ2 in the examples :

时间 [RF] INFO: Reading PRFs from ./CB.NJ2
时间 [RF] INFO: A total of 86 PRFs loaded
Tracceback (most recent call list):
  File "seispy库的路径\pickrf-script.py", line 33,in <module>
    sys.exit(load_entry_point('python-seispy==1.2.14','console_scripts','pickrf')())
  File "seispy库的路径\pickui.py", line 191,in main
    ui = MatplotlibWidget(rfpath, only_r=only_r, xlim=[-2, xlim],order=arg.order)
  File "seispy库的路径\pickui.py", line 46,in __init__
    self.initUi(rfpath, only_r, xlim, order=order)
  File "seispy库的路径\pickui.py", line 69,in initUi
    self._set_geom_center()
  File "seispy库的路径\pickui.py", line 129, in _set_geom_r
    self.move((screen_width / 2) - (self.frameSize().width() / 2),
TypeError: arguments did not match any overloaded call:
  move(self, QPoint): argument 1 has unexpected type 'float'
  move(self, int, int): argument 1 has unexpected type 'float'

Plantform:Windows 10
Python version:Python 3.10.2
How to install seispy:pip install python-seispy

Water level deconvolution bug

Describe the bug
I was trying to use water lever deconvolution method, but it raises the following error:

rf=RFTrace.deconvolute(st.select(component="R"), st.select(component="Z"), method='water', tshift=shift, f0=f, wlevel=0.01)
File "/home/felipe/.local/lib/python3.9/site-packages/seispy/decon.py", line 232, in deconvolute
header = utr.stats.getstate()
AttributeError: 'Stream' object has no attribute 'stats'`

as if it calls not the trace, the obspy stream to it, but I don't know how to fix it. I think it's a general bug, but I am using a Linux mint 20.2.

gen psrayp_like_file for SRF

在将psrayp迁移到SRF以及其他震相上,有几个东西不是很理解:

  1. taup_time, 自己测试了下转换波的taup_time。taup -ph P40s,P60s -deg 60 -h 10这样的结果,实际上只是得到了35km处间断面Ps波的信息。是否需要根据layers的划分单独生成一个model来做()。
  2. 从taup获取的layer数组与深度关系。 psrayp.py line 21用的是np.where所以 fake_layers应该是浅于11km的层,我们不单独计算他们的rayp。但是在line 48里直接 在数组切片里layer -11,有点不太理解。

第一个问题很好解决。
这个我们可以使用DepModel和layers做插值后,生成tvel格式的速度文件给taup算。
但是还是得明确与深度的明确关系,以及怎么生成格式正确的rayplib。

SRF CCP stacking

因为始终叠加不到bin里,在为SRF CCP stacking写点东西。

先说下bug原因。之前用相同台站做过PRF CCP stacking,结果比较准确。然后把里面xps的功能拆出来写了个时深转换的功能,PRF与SRF的Moho深度还比较一致。所以这个问题比较奇怪。

rayp写的是s/deg,SRF是倒转了时间序列的,没有给rayp_lib,也就是采用平面波假设。
速度模型这边,尝试了原始速度模型和Vp,Vs调换的速度模型

有几件内容想不太明白,可能是几个公式,几个功能比较重叠,给整迷糊了

  1. 怎么计算SRF插值要用到的序列(之前写的时深转换只用到了一个速度(S for PRF, P for SRF)。如果考虑平面波假设的影响,现有的内容该怎么调整。)
  2. 计算时深转换的时候,interp1d里面 raylength是什么用的,
  3. 如果想写一个类似psrayp的 部件给SRF,在传给ccp部分的时候,要注意什么。

目前做完的一些简化的东西:

  1. DepMod 添加一个classmethod ccp_mod, 识别速度模型类型(3d/fold/1d)并切片,导出DepthMod类。这样不用反复检查类型
  2. 简化的RFStation类。RFSt,基于 collections的UserList,在操作上更接近于List,写了个生成头段的功能。

No earthquakes matched! please help

Please I have been stuck with this response error. I checked the configuration to see what could be wrong but I'm not so sure what else to check. The data set are raw data from station archives.
Here is the command and the response

khalix@Khalix-VirtualBox:~/Desktop/RF$ prf rf.cfg
2022-09-23 17:56:02,221 [RF] INFO: Load station info from ./Data.N1.NGSA1
2022-09-23 17:56:02,269 [RF] INFO: Searching earthquakes from IRIS
2022-09-23 17:56:21,072 [RF] INFO: 176 earthquakes are found
2022-09-23 17:56:21,073 [RF] INFO: Match SAC files
2022-09-23 17:56:21,280 [RF] WARNING: No earthquakes matched, please check configurations.

Thank you

Batch RF calculation issue

Describe the bug
when I run the command prf rf.cfg -l in ex-batrf folder there is a bug : ERROR: Could not parse './evts.dat' to an etree element.
it's ok to run prf rf.cfg, i guass the local catalog may have some problem

A suggestion to add the correction of Ps moveout before estimating crustal anisotropy

Dear Dr. Xu,

Thanks for your seispy code, it's a great work.

I have a suggestion about rfani function. Before using the joint analysis method from(Liu and Niu, 2012 GJI), the moveout caused by the difference between the ray parameters of P and Ps should better be computed and corrected. For example, Liu and Niu employed a revised IASP91 velocity model with a modified crust to correct the moveout in(Liu and Niu, 2012 GJI). (Sun et al., 2012) used the H-k results to compute the moveout, (Cai et al., 2016) did the same.

But in the current seispy, rfani doesn't include the correction of moveout yet. Could you fix this problem at your convenience?
Thanks for a lot!

Zekun Li

'RFTrace' not defined

hello developer,
I quite enjoy your code on rf analysis. following the example and the script, i got stuck during deconvolution processing.
here is my code
f0 = 2.0
itmax = 400
minderr = 0.001
rf = RFTrace.deconvolute(st_rot[1], st_rot[2],
method='iter',
tshift=shift,
f0=f0,
itmax=itmax,
minderr=minderr)
rf.plot(show = False, type = 'relative',
starttime = rf.stats.starttime + shift,
endtime = rf.stats.starttime + shift + 30)

And here is the response
NameError Traceback (most recent call last)
Input In [12], in
2 itmax = 400
3 minderr = 0.001
----> 4 rf = RFTrace.deconvolute(st_rot[1], st_rot[2],
5 method='iter',
6 tshift=shift,
7 f0=f0,
8 itmax=itmax,
9 minderr=minderr)
10 rf.plot(show = False, type = 'relative',
11 starttime = rf.stats.starttime + shift,
12 endtime = rf.stats.starttime + shift + 30)

NameError: name 'RFTrace' is not defined

Please help. I'm a new user
Thank you

Visual check PRFs with an user interface

Discussed in #37

Originally posted by tianjueli April 14, 2022
Hi Mijian,
I'm trying to use module pickrf to visually check RF waveforms, while encountered such error:

"(python3.8:2056688): Gtk-WARNING **: 11:29:47.848: Theme parsing error: gtk.css:8033:53: Invalid name of pseudo-class

(python3.8:2056688): Gtk-WARNING **: 11:29:47.848: Theme parsing error: gtk.css:8047:53: Invalid name of pseudo-class

(python3.8:2056688): Gtk-WARNING **: 11:29:47.848: Theme parsing error: gtk.css:8051:53: Invalid name of pseudo-class

(python3.8:2056688): Gtk-WARNING **: 11:29:47.848: Theme parsing error: gtk.css:8058:53: Invalid name of pseudo-class

(python3.8:2056688): Gtk-WARNING **: 11:29:47.848: Theme parsing error: gtk.css:8065:53: Invalid name of pseudo-class

(python3.8:2056688): Gtk-WARNING **: 11:29:47.848: Theme parsing error: gtk.css:8072:53: Invalid name of pseudo-class

(python3.8:2056688): Gtk-WARNING **: 11:29:47.848: Theme parsing error: gtk.css:8076:53: Invalid name of pseudo-class

(python3.8:2056688): Gtk-WARNING **: 11:29:47.849: Theme parsing error: gtk.css:8081:53: Invalid name of pseudo-class
2022-04-14 11:29:47,943 [RF] INFO: Reading PRFs from ./ZX.256
2022-04-14 11:29:48,610 [RF] INFO: A total of 123 PRFs loaded
Traceback (most recent call last):
File "/opt/anaconda3/lib/python3.8/site-packages/obspy/core/util/attribdict.py", line 142, in getattr
return self.getitem(name, default)
File "/opt/anaconda3/lib/python3.8/site-packages/obspy/core/util/attribdict.py", line 97, in getitem
return self.dict[name]
KeyError: 'ka'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/anaconda3/bin/pickrf", line 8, in
sys.exit(main())
File "/opt/anaconda3/lib/python3.8/site-packages/seispy/pickui.py", line 190, in main
ui = MatplotlibWidget(rfpath, only_r=only_r, xlim=[-2, xlim], order=arg.order)
File "/opt/anaconda3/lib/python3.8/site-packages/seispy/pickui.py", line 45, in init
self.initUi(rfpath, only_r, xlim, order=order)
File "/opt/anaconda3/lib/python3.8/site-packages/seispy/pickui.py", line 50, in initUi
self.mpl = MyMplCanvas(self, rfpath=rfpath, only_r=only_r, width=21, height=11,
File "/opt/anaconda3/lib/python3.8/site-packages/seispy/pickui.py", line 29, in init
self.rffig.init_canvas(order=order)
File "/opt/anaconda3/lib/python3.8/site-packages/seispy/pickfigure.py", line 56, in init_canvas
self.read_sac(order=order)
File "/opt/anaconda3/lib/python3.8/site-packages/seispy/pickfigure.py", line 151, in read_sac
self.phases = [tr.stats.sac.ka for tr in self.rrf]
File "/opt/anaconda3/lib/python3.8/site-packages/seispy/pickfigure.py", line 151, in
self.phases = [tr.stats.sac.ka for tr in self.rrf]
File "/opt/anaconda3/lib/python3.8/site-packages/obspy/core/util/attribdict.py", line 144, in getattr
raise AttributeError(e.args[0])
AttributeError: ka"

The command I used is "pickrf ./ZX.256", where ZX.256 is an example station provided by ex-ccp.tar.gz.

GUI for visual checking S wave didn't work

Describe the bug
wyb@Wufatian:/mnt/c/Users/22247/Desktop/littledata/ex-prf/ex-prf$ srf rf.cfg -p
2023-11-25 16:41:04,288 [RF] INFO: Load station info from ./Data.CB.NJ2
2023-11-25 16:41:04,292 [RF] INFO: CB.NJ2, latitude: 32.052, longitude: 118.854
2023-11-25 16:41:04,292 [RF] INFO: Searching earthquakes from IRIS
2023-11-25 16:41:11,969 [RF] INFO: 204 earthquakes are found
2023-11-25 16:41:11,970 [RF] INFO: Associating SAC files with earthquakes
2023-11-25 16:41:14,509 [RF] INFO: 52 earthquakes are associated
2023-11-25 16:41:14,509 [RF] INFO: Detrend all data
2023-11-25 16:41:14,829 [RF] INFO: Filter all data from 0.03 to 1.0
2023-11-25 16:41:15,133 [RF] INFO: Calculate P arrivals and ray parameters for all data
2023-11-25 16:41:15,571 [RF] INFO: Reject data record with SNR less than 3.0
2023-11-25 16:41:15,698 [RF] INFO: 47 events left after SNR calculation
2023-11-25 16:41:15,698 [RF] INFO: Rotate P phase to ZNE->LQT
2023-11-25 16:41:15,736 [RF] INFO: Pre-pick P arrival using STA/LTA method
Traceback (most recent call last):
File "/home/wyb/.local/bin/srf", line 8, in
sys.exit(srf())
File "/home/wyb/.local/lib/python3.8/site-packages/seispy/scripts.py", line 216, in srf
pjt.pick()
File "/home/wyb/.local/lib/python3.8/site-packages/seispy/rf.py", line 464, in pick
row['data'].phase_trigger(self.para.time_before, self.para.time_after,
File "/home/wyb/.local/lib/python3.8/site-packages/seispy/eq.py", line 282, in phase_trigger
tr = self.st_pick.select(channel='*Z')[0]
File "/home/wyb/.local/lib/python3.8/site-packages/obspy/core/stream.py", line 643, in getitem
return self.traces.getitem(index)
IndexError: list index out of range

Moveoutcorrect module

Hi!!! I've tried the example of "moveout correction" shown in the video at 01:30:30. But, there was an error of plotting.
Code
rf_corr = rfsta.moveoutcorrect(dep_range=np.arange(0,200),ref_rayp=0.06)
correct_stack = np.mean(rf_corr,axis=0)
plt.plot(rfsta.time_axis,raw_stack)
plt.plot(rfsta.time_axis,correct_stack)
plt.xlim([-1,25])
Error
ValueError: x and y must have same first dimension, but have shapes (13001,) and (99, 13001)

Then, I checked the shape of "rf_corr"
AttributeError: 'tuple' object has no attribute 'shape'

However, the shape of "correct_stack" is (99, 13001)!!! Why??
Shouldn't "correct_stack" be like (13001,) and "rf_corr" is (99, 13001)?

how to prepare offline station data for rf study

Hii seispy developer. How to prepare complete raw data collected from a offline station for receiver function processing.

  1. event search
  2. cutting waveform based on epicentral distance range etc...
  3. association of events

Does seispy support to calculate RFs using PP phase signals ?

I tried to use the earthquakes with epicental distance of 25°-150° to calculate RFs as the short-period seismic observation time is limited, but failed for ValueError: The phase of P is not exists. I have successfully calculated RFs using earthquakes with epicental distance of 30°-90° by seispy before. So I want to ask what could lead to this failure and whether seispy support to use PP phase signals.

2022-10-10 16:19:57,143 [RF] INFO: 160 earthquakes are found
2022-10-10 16:19:57,144 [RF] INFO: Match SAC files
2022-10-10 16:19:57,981 [RF] INFO: 73 earthquakes are matched
2022-10-10 16:19:57,981 [RF] INFO: Detrend all data
2022-10-10 16:19:59,682 [RF] INFO: Filter all data from 0.05 to 2.0
2022-10-10 16:20:00,284 [RF] INFO: Calculate P arrivals and ray parameters for all data
Traceback (most recent call last):
File "/raid/mengjie/SouthChina/RFs/run.py", line 46, in
pjt.cal_phase()
File "/raid/mengjie/anaconda3/envs/seis/lib/python3.10/site-packages/seispy/rf.py", line 354, in cal_phase
row['data'].get_arrival(self.model, row['evdp'], row['dis'], phase=self.para.phase)
File "/raid/mengjie/anaconda3/envs/seis/lib/python3.10/site-packages/seispy/eq.py", line 108, in get_arrival
raise ValueError('The phase of {} is not exists'.format(phase))
ValueError: The phase of P is not exists

Some bugs when running rf2depth.

Describe the bug

When running rf2depth ccp.cfg, some bugs happend:

  File "/home/dell/anaconda3/envs/seispy/bin/rf2depth", line 10, in <module>
    sys.exit(rf2depth())
  File "/home/dell/anaconda3/envs/seispy/lib/python3.8/site-packages/seispy/rf2depth_makedata.py", line 183, in rf2depth
    makedata(cpara)
  File "/home/dell/anaconda3/envs/seispy/lib/python3.8/site-packages/seispy/rf2depth_makedata.py", line 98, in makedata
    PS_RFdepth, end_index, x_s, _ = psrf2depth(stadatar, cpara.depth_axis,
  File "/home/anaconda3/envs/seispy/lib/python3.8/site-packages/seispy/rfcorrect.py", line 298, in psrf2depth
    tps[i], x_s[i], x_p[i] = xps_tps_map(dep_mod, rayp, stadatar.rayp[i])
  File "/home/dell/anaconda3/envs/seispy/lib/python3.8/site-packages/seispy/rfcorrect.py", line 335, in xps_tps_map
    x_s = np.cumsum((dep_mod.dz / dep_mod.R) / np.sqrt((1. / (srayp ** 2. * (dep_mod.R / dep_mod.vs) ** -2)) - 1))
ValueError: operands could not be broadcast together with shapes (801,) (803,)

I think there are some bugs about topographic correction. So I cancelled topographic correction for temporary use by adding elevation=0 in utils.py.

Now it works, but there are still some warnings in Seispy 1.2.15, these warnings disappear when changing to version 1.2.14.

/home/dell/anaconda3/envs/seispy/lib/python3.8/site-packages/python_seispy-1.2.15-py3.8.egg/seispy/rfcorrect.py:387: RuntimeWarning: invalid value encountered in sqrt
  x_p = np.cumsum((dep_mod.dz / dep_mod.R) / np.sqrt((1. / (prayp ** 2. * (dep_mod.R / dep_mod.vp) ** -2)) - 1))
/home/dell/anaconda3/envs/seispy/lib/python3.8/site-packages/python_seispy-1.2.15-py3.8.egg/seispy/utils.py:78: RuntimeWarning: invalid value encountered in sqrt
  return np.cumsum((np.sqrt((dep_mod.R / dep_mod.vs) ** 2 - rayps ** 2) - np.sqrt((dep_mod.R / dep_mod.vp) ** 2 - raypp ** 2)) * (dep_mod.dz / dep_mod.R))

Platform (please complete the following information):

  • OS: Ubuntu
  • Version 20.04

Additional context
Add any other context about the problem here.

prf rf.cfg returns syntax error

Please I'm still learning how to run PRF for a single station with multiple events with the example you provided in the script but each time i run the command 'prf rf.cfg'. I keep getting (invalid syntax)

Input In
prf rf.cfg
^
SyntaxError: invalid syntax

thank you for your help

SKS and SKKS RF need to be tested

Is your feature request related to a problem? Please describe.
SKS and SKKS phases can be used for SRF.

Describe the solution you'd like
Add support for SKS and SKKS in the para.phase.

Describe alternatives you've considered
Test it on real data.

Could you put example files in ?

Hi, very thank you to develop receiver function in python !
However, when I tried to use seispy, I confused what paraRF.cfg metioned.
Like as

data_path = /Users/xumj/Documents/sac/rftest/
out_path = /Users/xumj/Documents/sac/rftest/cut

What kind of data I should put data in ? Only put in data_path ? or both?

evt_list = ./EventCMT.dat
And what kind of catalog to use ?

It will be very useful to upload example files for people trying seispy !
Thank you again !

Restricted data access (username, password)

Is your feature request related to a problem? Please describe.
Username and Password protected federated data cannot be accessed in IRIS web service

error received:

2023-09-01 22:55:27,784 [RF] ERROR: Error in loading station info: No data available for request.
HTTP Status code: 204
Detailed response of server:

Describe the solution you'd like
Area to enter username and password as a variable in the parameter file

Describe alternatives you've considered
I tried to manually enter it into the code but was unsuccessful

Additional context
Add any other context or screenshots about the feature request here.
Thank you

prf -l 的本地目录遇到问题

当我使用download_catalog下载的地震目录去作为本地地震目录时,QUAKEML格式的目录可以顺利去做,但txt格式的就不可以顺利去做。
微信图片_20240228090724

微信图片_20240228090808

Azimuth Correction

I am using the RF package, and the data I am loading in from IRIS has EHZ,EH1,EH2 channels. The EH1 and EH2 channel azimuths need to be corrected by anywhere from -6 to +6 degrees, and EHZ dip needs to be changed from 90 to -90, depending on the station. It does not appear this package automatically corrects the azimuth. I see there is a baz_shift variable in rotate in RF and also seispy.eq.rotate_ZNE in the the seispy package.

Is the baz_shift what I need or do I need to use seispy.eq.rotate_ZNE? If I need to use seispy.eq.rotate_ZNE, how do I implement this in the RF package and data I am loading in through query.

Here is a snippet of the code I am using with rf.rotate(baz_shift=6)
rf.load_stainfo()
rf.search_eq(catalog='NEIC PDE')
print(rf.eq_lst) ##The matched event lists are listed.

rf.match_eq()

rf.detrend()
rf.filter()
rf.cal_phase()
rf.rotate(baz_shift=6) #Like this?
rf.drop_eq_snr()
rf.save_raw_data()
rf.trim()
rf.deconv()

how to write numpy.ndarray to a sacfile without missing required header info

Hii, seispy developer, I am running your example script https://seispy.xumijian.me/usage/calrf.html for gaining some knowledge regarding receiver functions.I have a very small querry, can the numpy.ndarray can be saved to the sac file after this step
PRF_R, RMS, it = seispy.decon.deconit(R, Z, dt, R.shape[0], shift, f0, tmax, minderr)
I want to write PRF_R to be saved in sac file by something PRF_R.write('outfile',format='SAC'), When i does it gives error AttributeError: 'numpy.ndarray' object has no attribute 'write'

I hope developers may help me overcoming my problem.Thanks in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.