pygrt.pymod
- file:
pymod.py
- author:
Zhu Dengda (zhudengda@mail.iggcas.ac.cn)
- date:
2024-07-24
该文件包括 Python端使用的模型 pygrt.c_structures.c_PyModel1D
- class pygrt.pymod.PyModel1D(modarr0: ndarray, depsrc: float, deprcv: float, allowLiquid: bool = True, topbound: Literal['free', 'rigid', 'halfspace'] = 'free', botbound: Literal['free', 'rigid', 'halfspace'] = 'halfspace')[源代码]
基类:
object- __init__(modarr0: ndarray, depsrc: float, deprcv: float, allowLiquid: bool = True, topbound: Literal['free', 'rigid', 'halfspace'] = 'free', botbound: Literal['free', 'rigid', 'halfspace'] = 'halfspace')[源代码]
Create 1D model instance, and insert the imaginary layer of source and receiver.
- 参数:
modarr0 – model array, in the format of [thickness(km), Vp(km/s), Vs(km/s), Rho(g/cm^3), Qp, Qs]
depsrc – source depth (km)
deprcv – receiver depth (km)
allowLiquid – (deprecated) unused argument
topbound – boundary condition of the top layer
botbound – boundary condition of the bottom layer
- compute_travt1d(dist: float)[源代码]
Call the C function to calculate the travel time of the first P-wave and S-wave
- 参数:
dist – epicentral distance (km)
- 返回:
travtP - first P-wave arrival (s)
travtS - first S-wave arrival (s)
- compute_grn(distarr: ndarray | List[float] | float, nt: int, dt: float, upsampling_n: int = 1, freqband: ndarray | List[float] = [-1, -1], zeta: float = 0.8, keepAllFreq: bool = False, vmin_ref: float = 0.0, keps: float = -1.0, ampk: float = 1.15, k0: float = 5.0, Length: float = 0.0, filonLength: float = 0.0, safilonTol: float = 0.0, filonCut: float = 0.0, converg_method: str | None = None, delayT0: float = 0.0, delayV0: float = 0.0, skipImagComps: bool = False, calc_upar: bool = False, gf_source=['EX', 'VF', 'HF', 'DC'], statsfile: str | None = None, statsidxs: ndarray | List[int] | None = None, print_runtime: bool = True)[源代码]
Call the C function to calculate the Green’s functions at multiple distances and return them in a list, where each element is in the form of :class: ‘obspy.Stream’ type.
- 参数:
distarr – array of epicentral distances (km), or a single float
nt – number of time points. with the help of SciPy, nt no longer needs to be a power of 2
dt – time interval (s)
upsampling_n – upsampling factor
freqband – frequency range (Hz)
zeta – zeta is used to define the imaginary angular frequency, \(\tilde{\omega} = \omega - j*w_I, w_I = \zeta*\pi/T, T=nt*dt\) . see Bouchon (1981) and 张海明 (2021) for more details and tests.
keepAllFreq – calculate all frequency points, no matter how low the frequency is
vmin_ref – minimum reference velocity (km/s). the default vmin=max(minimum velocity, 0.1), used to define the upper limit of k integral
keps – automatic convergence condition, see Yao and Harkrider (1983) for more details. negative value denotes not use.
ampk – The factor that affect the upper limit of the k integral, see below.
k0 – k0 used to define the upper limit \(\tilde{k_{max}}=\sqrt{(k_{0}*\pi/hs)^2 + (ampk*w/vmin_{ref})^2}\) , hs=max(abs(depsrc-deprcv),1.0)
Length – integration step dk=2pi / (L*rmax), see Bouchon (1981) and 张海明 (2021) for the criterion, default set automatically.
filonLength – integration step of Fixed-Interval Filon’s Integration Method
safilonTol – precision of Self-Adaptive Filon’s Integration Method
filonCut – The splitting point of DWM and (SA)FIM, k*=<filonCut>/rmax, default is 0
converg_method – The method of explicit convergence, you can set “DCM”, “PTAM” or “none”. Default use “DCM” when abs(depsrc-deprcv) <= 1.0 km
skipImagComps – skip the amplitude compensation from imaginary frequency.
calc_upar – whether calculate the spatial derivatives of displacements.
gf_source – The source type to be calculated
statsfile – directory path for saving the statsfile during k integral, used to debug or observe the variations of \(F(k,\omega)\) and \(F(k,\omega)J_m(kr)k\)
statsidxs – only output the statsfile at specific frequency indexes. It is recommended to specify the indexes; otherwise, by default, statsfiles of all frequency will be output, which probably occupy a lot of disk space
print_runtime – whether print runtime and some other infomation.
- 返回:
dataLst - Green’s Functions at multiple distances, in a list of
obspy.Stream
- compute_static_grn(xarr: ndarray | List[float] | float | None = None, yarr: ndarray | List[float] | float | None = None, distarr: ndarray | List[float] | float | None = None, keps: float = -1.0, k0: float = 5.0, Length: float = 15.0, filonLength: float = 0.0, safilonTol: float = 0.0, filonCut: float = 0.0, converg_method: str | None = None, calc_upar: bool = False, statsfile: str | None = None)[源代码]
Call the C function to calculate the static Green’s functions and return them in a dict. There’re two ways to define the “epicentral distances”: 1. set both “xarr” and “yarr” to define a XY grid in advance. 2. simply set “distarr”, which equal to “xarr=[0.0], yarr=distarr”.
- 参数:
xarr – coordinate array in the north direction (km), or a single float.
yarr – coordinate array in the east direction (km), or a single float.
distarr – equal to “xarr=[0.0], yarr=distarr”
keps – automatic convergence condition, see (Yao and Harkrider (1983) for more details. negative value denotes not use.
k0 – k0 used to define the upper limit \(\tilde{k_{max}}=(k_{0}*\pi/hs)^2\), hs=max(abs(depsrc-deprcv),1.0)
Length – integration step dk=2pi / (L*rmax), default L=15
filonLength – integration step of Fixed-Interval Filon’s Integration Method
safilonTol – precision of Self-Adaptive Filon’s Integration Method
filonCut – The splitting point of DWM and (SA)FIM, k*=<filonCut>/rmax, default is 0
converg_method – The method of explicit convergence, you can set “DCM”, “PTAM” or “none”. Default use “DCM” when abs(depsrc-deprcv) <= 1.0 km
calc_upar – whether calculate the spatial derivatives of displacements.
statsfile – directory path for saving the statsfile during k integral, used to debug or observe the variations of \(F(k,\omega)\) and \(F(k,\omega)J_m(kr)k\)
- 返回:
dataDct - static Green’s function in a dict