pygrt.pymod
- file:
pymod.py
- author:
Zhu Dengda (zhudengda@mail.iggcas.ac.cn)
- date:
2024-07-24
该文件包括 Python 端使用的基于文件的模型 PyModel1D
- class pygrt.pymod.PyModel1D(*, grn: str | PathLike | None = None, stgrn: str | PathLike | None = None, modelpath: str | PathLike | None = None, topbound: str = 'free', botbound: str = 'halfspace')[源代码]
基类:
objectFile-based 1D layered model for GRT calculations.
Typical workflow:
Create
PyModel1Dwith the Green’s function path(s) actually needed (grnand/orstgrn) and optionalmodelpath.Compute modal dispersion, receiver functions and Green’s functions with
eigenv(),eigenfn(),modsum(),rcvfn(),greenfn()orstatic_greenfn()(the required paths depend on the method).Synthesize waveforms or static fields with
syn()orstatic_syn()(only the corresponding GF path is required).
- __init__(*, grn: str | PathLike | None = None, stgrn: str | PathLike | None = None, modelpath: str | PathLike | None = None, topbound: str = 'free', botbound: str = 'halfspace')[源代码]
Create a file-based 1D layered model handle.
The model file is a plain text table. Each row is one layer in the form
thickness(km) Vp(km/s) Vs(km/s) Rho(g/cm^3) [Qp Qs]. A zero thickness marks a half-space bottom layer.All arguments must be passed by keyword.
grn/stgrn/modelpathare optional at construction; methods that need them raise if missing.- 参数:
grn – Root directory for dynamic Green’s functions.
stgrn – NetCDF file path for static Green’s functions.
modelpath – Path to the layered model file. Required by
eigenv(),greenfn(),synnoise()andstatic_greenfn(). Travel-time calculations also need it, unless a per-callmodelpathis passed totravt().topbound – Top boundary condition. One of
free,rigidandhalfspace.botbound – Bottom boundary condition. One of
free,rigidandhalfspace.
- travt(*, depsrc: float, deprcv: float, dists: float | Sequence[float] | ndarray[tuple[int, ...], dtype[floating[Any]]], modelpath: str | PathLike | None = None)[源代码]
Compute first-arrival P- and S-wave travel times.
Calls the C routine
grt_compute_travt1d_from_file, which reads the layered model and evaluates travel times at the given source/receiver depths and epicentral distances. All arguments must be passed by keyword.- 参数:
depsrc – Source depth in km.
deprcv – Receiver depth in km.
dists – Epicentral distance(s) in km. A scalar or a strictly ascending sequence of distances.
modelpath – Model file for this call only. If omitted, uses
self.modelpath. If both are set and differ, a warning is issued andself.modelpathis not changed. Required whenself.modelpathis unset.
- 返回:
(travtP, travtS)in s. For a scalar distance both are floats; for multiple distances both are NumPy arrays of shape(n,).
- compute_travt1d(*args, **kwargs)[源代码]
Legacy interface renamed to
travt(); calling it raises an error.
- eigenv(*, wtype: str, freqs: float | Sequence[float] | ndarray[tuple[int, ...], dtype[floating[Any]]] | None = None, periods: float | Sequence[float] | ndarray[tuple[int, ...], dtype[floating[Any]]] | None = None, phase_path: str | PathLike | None = None, max_order: int | None = None, all_modes: bool = False, secular_freq: float | None = None, cmin: float | None = None, cmax: float | None = None, iref: int | None = None, ctrl_kw: Dict[str, float] | None = None, nthreads: int | None = None, print_log: bool = True)[源代码]
Compute surface-wave phase-velocity dispersion with
grt eigenv.The ordinary workflow requires
modelpathin the constructor and writes a NetCDF dispersion file tophase_path. Setsecular_freqto use the C module’s debug mode, which prints the secular function instead and does not requirefreqs/periodsorphase_path. All arguments must be passed by keyword.- 参数:
wtype – Surface-wave type,
"R"for Rayleigh or"L"for Love.freqs – One frequency, or
(f1, f2, df)in Hz. Mutually exclusive withperiods.periods – One period, or
(T1, T2, dT)in s. Mutually exclusive withfreqs.phase_path – Output NetCDF dispersion path. It is not used in secular-function debug mode.
max_order – Maximum mode order.
Noneleaves-Nunspecified and computes the fundamental mode.all_modes – If true, pass bare
-Nand compute as many modes as possible. Mutually exclusive withmax_order.secular_freq – Debug frequency in Hz. When set, pass
-Xinstead of-Fand-C.cmin – Lower phase-velocity bound in km/s for debug secular-function output.
cmax – Upper phase-velocity bound in km/s for debug secular-function output.
iref – Layer index for debug secular-function output.
ctrl_kw – Optional dict of search-control parameters for
-T. Allowed keys aretol,cgap,thrd,vgapanddc.tol,cgap,thrdandvgapare decimal exponents of the CLI thresholds (tol=3means \(10^{-3}\)), whiledcis a uniform search interval in km/s.nthreads – Number of OpenMP threads.
Noneuses all cores (CLI-P).print_log – If false, suppress command output and capture it on failure. Warnings and diagnostics from
grtare still printed.
- 返回:
None. The dispersion file is written tophase_pathin ordinary mode.
- eigenfn(*, phase_path: str | PathLike, freqs: float | Sequence[float] | ndarray[tuple[int, ...], dtype[floating[Any]]] | None = None, periods: float | Sequence[float] | ndarray[tuple[int, ...], dtype[floating[Any]]] | None = None, modes: int | Sequence[int] | ndarray[tuple[int, ...], dtype[integer[Any]]] | None = None, all_modes: bool = False, eigenfn_path: str | PathLike | None = None, depths: float | Sequence[float] | ndarray[tuple[int, ...], dtype[floating[Any]]] | None = None, group_path: str | PathLike | None = None, csens_path: str | PathLike | None = None, usens_path: str | PathLike | None = None, egy_path: str | PathLike | None = None, sensitivity_dz: float | None = None, print_log: bool = True)[源代码]
Compute modal eigenfunctions and derived quantities with
grt eigenfn.The model path is read from the NetCDF dispersion file generated by
eigenv(). Set one or more output paths to request eigenfunctions, group velocity, energy integrals, or phase/group-velocity sensitivity kernels. All arguments must be passed by keyword.- 参数:
phase_path – Input NetCDF phase-velocity dispersion path.
freqs – Optional one-, two- or three-value frequency selection in Hz. Mutually exclusive with
periods.periods – Optional one-, two- or three-value period selection in s. Mutually exclusive with
freqs.modes – Optional one-, two- or three-value mode selection
(n1[, n2[, dn]]).all_modes – If true, pass bare
-N. Mutually exclusive withmodes.eigenfn_path – Output NetCDF eigenfunction path.
depths – Optional one- or three-value depth selection for
eigenfn_pathin km.group_path – Output NetCDF group-velocity dispersion path.
csens_path – Output phase-velocity sensitivity path.
usens_path – Output group-velocity sensitivity path.
egy_path – Output energy-integral path.
sensitivity_dz – Depth interval in km for sensitivity and energy-integral calculations.
print_log – If false, suppress command output and capture it on failure.
- 返回:
None. Requested NetCDF files are written to their output paths.
- modsum(*, phase_path: str | PathLike, depsrc: float | Sequence[float] | ndarray[tuple[int, ...], dtype[floating[Any]]], deprcv: float | Sequence[float] | ndarray[tuple[int, ...], dtype[floating[Any]]], dists: float | Sequence[float] | ndarray[tuple[int, ...], dtype[floating[Any]]], output_path: str | PathLike | None = None, freqband: float | Sequence[float] | ndarray[tuple[int, ...], dtype[floating[Any]]] | None = None, modes: int | Sequence[int] | ndarray[tuple[int, ...], dtype[integer[Any]]] | None = None, all_modes: bool = False, upsampling_n: int = 1, delayT0: float | None = None, delayV0: float | None = None, ref_first_p: bool = False, gf_source: Iterable[str] | None = None, calc_upar: bool = False, nthreads: int | None = None, print_log: bool = True)[源代码]
Compute surface-wave Green’s functions with
grt modsum.phase_pathmust be a dispersion file generated byeigenv()with an equally spaced frequency grid. Source and receiver depths may be scalars or strictly ascending sequences; all depth combinations are computed when sequences are supplied. Results are written tooutput_pathor, when it is omitted, to thegrnroot configured in the constructor. All arguments must be passed by keyword.- 参数:
phase_path – Input NetCDF phase-velocity dispersion path.
depsrc – Source depth or strictly ascending source-depth sequence in km.
deprcv – Receiver depth or strictly ascending receiver-depth sequence in km.
dists – Epicentral distance or strictly ascending distance sequence in km.
output_path – Output Green’s-function root. If omitted, use
self.grn.freqband – Optional
(f1, f2)frequency range in Hz.modes – Optional one-, two- or three-value mode selection
(n1[, n2[, dn]]).all_modes – If true, pass bare
-N. Mutually exclusive withmodes.upsampling_n – Frequency-domain zero-padding factor.
delayT0 – Time delay at zero distance in s. Supplying this,
delayV0orref_first_penables-E.delayV0 – Reference velocity for the time delay in km/s. Used only when
ref_first_pis false.ref_first_p – Whether to use the first P-wave arrival as the reference for the time delay (CLI
-Ep).gf_source – Source types to calculate from
EX,VF,HFandDC.Nonemeans all types.calc_upar – If true, also compute spatial displacement derivatives.
nthreads – Number of OpenMP threads.
Noneuses all cores (CLI-P).print_log – If false, suppress command output and capture it on failure. Warnings and diagnostics from
grtare still printed.
- 返回:
None. Green’s-function SAC files are written below the output root.
- synnoise(*, source_file: str | PathLike, receiver_file: str | PathLike, output_path: str | PathLike, modes: int | Sequence[int] | ndarray[tuple[int, ...], dtype[integer[Any]]] | None = 0, nthreads: int | None = None, print_log: bool = True) None[源代码]
Simulate ZNE ambient-noise velocity records (cm/s) with
grt synnoise.Requires
modelpathwith a free surface and half-space bottom. See synnoise for the source and receiver file formats. Saves Rayleigh and Love phase/group dispersion asphaseR.nc,phaseL.nc,groupR.ncandgroupL.ncinoutput_path.- 参数:
source_file – Source coordinates and random sampling parameters.
receiver_file – Sampling interval, record length and receiver coordinates.
output_path – New or empty output directory.
modes – Mode index or
(n1, n2[, dn]);Noneselects all modes.nthreads – Positive parallel worker count;
Noneuses all available cores.print_log – Whether to print regular progress messages.
- greenfn(*, depsrc: float | Sequence[float] | ndarray[tuple[int, ...], dtype[floating[Any]]], deprcv: float | Sequence[float] | ndarray[tuple[int, ...], dtype[floating[Any]]], dists: float | Sequence[float] | ndarray[tuple[int, ...], dtype[floating[Any]]], nt: int, dt: float, upsampling_n: int = 1, freqband: Sequence[float] = (-1.0, -1.0), zeta: float = 0.8, keepAllFreq: bool = False, vmin_ref: float = 0.0, keps: float = -1.0, ampk: float = 2.0, k0: float = 50.0, use_kmax_ref: bool = False, Length: float = 0.0, filonLength: float = 0.0, safilonTol: float = 0.0, filonCut: float = 0.0, converg_method: str = 'AUTO', delayT0: float = 0.0, delayV0: float = 0.0, ref_first_p: bool = False, skipImagComps: bool = False, calc_upar: bool = False, gf_source: Iterable[str] | None = None, statsidxs: Sequence[int] | None = None, nthreads: int | None = None, print_log: bool = True)[源代码]
Compute dynamic Green’s functions with the
grt greenfncommand.Requires
grnandmodelpathin the constructor. Results are written as SAC files under{grn}/{model}_{depsrc}_{deprcv}_{distance}. The model file is also copied into thegrnroot directory by the C module. All arguments must be passed by keyword.- 参数:
depsrc – Source depth or strictly ascending source-depth sequence in km.
deprcv – Receiver depth or strictly ascending receiver-depth sequence in km.
dists – Array of strictly ascending epicentral distances in km, or a single distance.
nt – Number of time points; it need not be a power of 2.
dt – Time interval in s.
upsampling_n – Upsampling factor applied after inverse FFT.
freqband – Frequency range
(f1, f2)in Hz. Negative values mean that the corresponding bound is determined automatically.zeta – Coefficient defining the imaginary angular frequency, \(\tilde{\omega} = \omega - j w_I\), where \(w_I = \zeta\pi/T\) and \(T=nt\,dt\).
keepAllFreq – Whether to calculate all frequency points, regardless of how low the frequency is.
vmin_ref – Minimum reference velocity in km/s.
0.0means the minimum model velocity, limited to 0.1 km/s.keps – Automatic convergence condition. See Yao and Harkrider (1983) for more details. A negative value disables this condition.
ampk – Amplification factor in the reference maximum wavenumber.
k0 – Coefficient in the reference maximum wavenumber, \(k_{\mathrm{max,ref}} = \sqrt{(k_0\pi/h_s)^2 + (ampk\,\omega/v_{\mathrm{min,ref}})^2}\). Here \(h_s=\max(|depsrc-deprcv|,0.1)\).
use_kmax_ref – Whether to use the reference maximum wavenumber directly, without amplitude searching.
Length – Integration step \(dk=2\pi/(Lr_{\max})\).
0.0means the value is selected automatically.filonLength – Integration step of fixed-interval Filon integration at large distances, but not at zero distance.
0.0disables this method. Near-field terms are included. Do not set together withsafilonTol.safilonTol – Precision of self-adaptive Filon integration at large distances, but not at zero distance.
0.0disables this method. Near-field terms are included. Do not set together withfilonLength.filonCut – Splitting point between DWM and Filon integration, \(k^*=\mathrm{filonCut}/r_{\max}\).
converg_method – Explicit convergence method. One of
AUTO,NONE,DCMandPTAM.delayT0 – Time delay at zero distance in s.
delayV0 – Reference velocity for the time delay in km/s. Used only when
ref_first_pis false.ref_first_p – Whether to use the first P-wave arrival as the reference for the time delay (CLI
-Ep).skipImagComps – Whether to skip the amplitude compensation from the imaginary frequency.
calc_upar – Whether to calculate spatial derivatives of displacement. Required later if strain, stress or rotation will be computed.
gf_source – Source types to calculate. Choose from
EX,VF,HFandDC.Nonemeans all available source types.statsidxs – Frequency indexes for optional statistics output.
Nonemeans no statistics files. An empty list means all frequency indexes (CLI bare-S).nthreads – Number of OpenMP threads.
Noneuses all cores (CLI-P).print_log – Whether to print calculation logs. Warnings and diagnostics from
grtare always printed.
- 返回:
None. Results are written to disk.
- compute_grn(*args, **kwargs)[源代码]
Legacy interface renamed to
greenfn(); calling it raises an error.
- rcvfn(*, wtype: str, nt: int, dt: float, output_path: str | PathLike, rayp: float | None = None, inca: float | None = None, idx: int | None = None, zeta: float = 0.8, upsampling_n: int = 1, keepAllFreq: bool = False, skipImagComps: bool = False, alp: float = 1.0, delay: float = 0.0, write_components: bool = False, print_log: bool = True)[源代码]
Compute receiver functions for a plane incident P or SV wave.
This method wraps the
grt rcvfncommand. The incident wave is specified by either a horizontal ray parameterraypor an upward incidence angleincaat the selected reverse-indexed model layer. Results are written asP_rcvfn.sacorS_rcvfn.sacbelowoutput_path;write_components=Truealso writes the correspondingZandRresponse files. All arguments must be passed by keyword.- 参数:
wtype – Incident wave type,
"P"or"S".nt – Number of time samples.
dt – Time-sample interval in s.
output_path – Output directory for SAC files.
rayp – Horizontal ray parameter in s/km. Mutually exclusive with
inca.inca – Upgoing incidence angle in degrees in the selected reverse-indexed layer. Mutually exclusive with
rayp.idx – Optional nonnegative reverse layer index used with
inca; zero denotes the halfspace.zeta – Virtual-frequency coefficient in
-N.upsampling_n – Time-domain upsampling factor in
-N.keepAllFreq – If true, append
+ato-N.skipImagComps – If true, append
+fto-Nand skip virtual-frequency compensation.alp – Gaussian low-pass filter parameter.
delay – Additional delay before the P arrival in s. The program already applies an internal delay; set this only when more delay is needed.
write_components – If true, also write absolute Z and R response time series.
print_log – If false, suppress regular
grtoutput while preserving warnings and diagnostics.
- 返回:
None. SAC files are written belowoutput_path.
- static_greenfn(*, depsrc: float | Sequence[float] | ndarray[tuple[int, ...], dtype[floating[Any]]], deprcv: float | Sequence[float] | ndarray[tuple[int, ...], dtype[floating[Any]]], dists: float | Sequence[float] | ndarray[tuple[int, ...], dtype[floating[Any]]] | None = None, norths: Sequence[float] | None = None, easts: Sequence[float] | None = None, keps: float = -1.0, k0: float = 50.0, use_kmax_ref: bool = False, Length: float = 15.0, filonLength: float = 0.0, safilonTol: float = 0.0, filonCut: float = 0.0, converg_method: str = 'AUTO', calc_upar: bool = False, stats: bool = False)[源代码]
Compute static Green’s functions with the
grt static_greenfncommand.Requires
stgrnandmodelpathin the constructor. Results are written to the configured NetCDF file (4D STGRNLIB layout[depsrc][deprcv][north][east]) and currently overwrite any existing content. All arguments must be passed by keyword.depsrc/deprcvmay be a scalar or a 1-D sequence:Single depth pair: CLI
-Ddepsrc/deprcv.Multiple depths: CLI
-Ds.../-Dr...(automatic temporary files).
For an ordinary Green’s-function library,
distsis the usual choice: it computes a one-dimensional distance list and stores it asnorth=0andeast=dists. This is also the most convenient format forstatic_syn(), which synthesizes results at surrounding distance samples and combines those results with distance-based weights. Receiver locations can be specified in either of two ways:dists, a scalar or sequence of epicentral distances in km. This is equivalent to placing receivers along the east axis with north = 0 and is the recommended way to build a reusable library.northsandeasts, each a three-value sequence(start, stop, step)in km, mapped to CLI-X/-Y. This form is mainly useful for accuracy tests or when a later synthesis should reuse the same grid without distance-based combination of multiple synthesized results.
- 参数:
depsrc – Source depth(s) in km. Multiple values must be strictly ascending.
deprcv – Receiver depth(s) in km. Multiple values must be strictly ascending.
dists – Epicentral distance(s) in km. A scalar or strictly ascending sequence, equivalent to receivers with north = 0 and east =
dists. Mutually exclusive withnorths/easts.norths – Three values defining the north-coordinate option
-Xstart/stop/stepin km.easts – Three values defining the east-coordinate option
-Ystart/stop/stepin km.keps – Automatic convergence condition. See Yao and Harkrider (1983) for more details. A negative value disables this condition.
k0 – Coefficient in the reference maximum wavenumber, where \(h_s=\max(|depsrc-deprcv|,0.1)\). The actual maximum wavenumber is searched based on the kernel amplitude.
use_kmax_ref – Whether to use the reference maximum wavenumber directly, without amplitude searching.
Length – Integration step \(dk=2\pi/(Lr_{\max})\). The default is 15.
filonLength – Step parameter for fixed-interval Filon integration at large distances.
0.0disables this method. Near-field terms are included. Do not set together withsafilonTol.safilonTol – Tolerance for self-adaptive Filon integration at large distances.
0.0disables this method. Near-field terms are included. Do not set together withfilonLength.filonCut – Splitting point between DWM and Filon integration.
converg_method – Explicit convergence method. One of
AUTO,NONE,DCMandPTAM.calc_upar – Whether to calculate spatial derivatives of displacement. Required later if strain, stress or rotation will be computed.
stats – Whether to write integration statistics. Only available for a single source/receiver depth; ignored with a warning for multi-depth runs.
- 返回:
None. Results are written to the configured NetCDF file.
- compute_static_grn(*args, **kwargs)[源代码]
Legacy interface renamed to
static_greenfn(); calling it raises an error.
- syn(*, depsrc: float | None = None, deprcv: float | None = None, dist: float | None = None, azimuth: float | None = None, output_path: str | PathLike, scale: float | None = None, scale_with_mu: bool = False, strike: float | None = None, dip: float | None = None, rake: float | None = None, force: Sequence[float] | None = None, moment_tensor: Sequence[float] | None = None, src_fault: str | PathLike | None = None, src_fault_size: Sequence[float] | None = None, rcv_fault: str | PathLike | None = None, rcv_fault_size: Sequence[float] | None = None, rcv_points: str | PathLike | None = None, interpolate: bool = True, nthreads: int | None = None, time_function: str | None = None, integrate_order: int | None = None, differentiate_order: int | None = None, zne: bool | None = None, calc_upar: bool = False) None[源代码]
Synthesize dynamic three-component displacement with
grt syn.A call defines five groups of information:
Green functions: configure
grnonPyModel1Dand compute them withgreenfn(), or use an existing library.Source location: a point source is at the horizontal origin, with depth
depsrc.src_faultsupplies the locations of finite sources.Receiver locations: choose polar coordinates (
dist,azimuth,deprcv), a point file (rcv_points), or receiver faults (rcv_fault). Use one receiver mode per call; files supply their own depths.Source mechanism and strength: a point source requires
scale. Choosestrike/dip/rakefor a double-couple, omitrakefor a tensile crack, or useforceormoment_tensorinstead. Leaving all mechanism parameters unset selects an explosion.src_faultsupplies both location and mechanism/strength; omitdepsrc,scaleand all point-source mechanism parameters in this mode.Output:
output_pathsets the SAC directory;zneselects ZNE andcalc_uparadds spatial derivatives. Finite sources always output ZNE.
With a library root, point-source
depsrcand polar-receiverdist/deprcvcan be inferred when the corresponding library dimension has one value;azimuthis still required for polar receivers. With a single GF node directory, omitdepsrc,deprcvanddistand supplyazimuthand the source mechanism. Finite sources and receiver files require a library root. Finite sources additionally require at least two GF nodes, including source files containing only point-source Kode records; explicit subdivision sizes do not waive this rule. With a node directory,interpolateis ignored and the node is used directly. A library root must contain every combination of source depth, receiver depth and distance. Each axis may be nonuniform; incomplete or duplicate geometry raises an error before synthesis. All coordinates share one horizontal origin; for finite sources,dist/azimuthlocate the receiver relative to that origin.src_fault_sizeandrcv_fault_sizecontrol fault subdivision.Optional
time_function,integrate_orderanddifferentiate_ordercontrol the time dependence.interpolatecontrols library interpolation andnthreadssets the source thread count. All arguments are keyword-only. The output sample count is the maximum of the Green-function length and the longest source time function including rupture delay, shared by all receivers. Convolution is circular in the time domain with shorter inputs zero-padded to the output length; imaginary-frequency compensation is applied per GF node. Results are displacements in cm with Z upward, R radial outward and T clockwise from R by default. Polar receivers write directly under the output path; receiver files always use indexed subdirectories, even for one point; finite-sourcesig.sacstores the total scalar moment rate only when a row or global time function is explicitly specified. A globaltime_functionignores all row-end contents in the source fault file. Results are written to files; read SAC waveforms explicitly withobspy.read().- 参数:
depsrc – Point-source depth in km (CLI -Ds). Required for multiple library source depths; inferred for one. Omit for source faults or a GF subdirectory.
deprcv – Polar receiver depth in km (CLI -Dr). Required for multiple library receiver depths; inferred for one. Omit for receiver files or a GF subdirectory.
dist – Polar receiver distance from the horizontal origin in km (CLI -R). Required for multiple library distances; inferred for one. Omit for receiver files or a GF subdirectory.
azimuth – Polar receiver azimuth in degrees clockwise from north. Required for the polar receiver mode.
output_path – Output directory for SAC files
{output_path}/{ch}.sac.scale – Source scaling factor. For explosion, double-couple, tensile-crack and moment-tensor sources, the unit is dyne·cm. It is the scalar moment for a double-couple; moment-tensor coefficients are multiplied by it without normalization. For an explosion it scales each diagonal tensor entry, and for a tensile crack it represents \(\mu\Sigma D\). For a single force, the unit is dyne. If
scale_with_muis true,scaleis treated as area × slip in cm³ and multiplied by the source-layer shear modulus \(\mu\).scale_with_mu – If true, multiply
scaleby the source-layer shear modulus \(\mu\) (CLI-Su).strike – Fault strike in deg, in [0, 360]. North is 0°, clockwise positive. Set together with
dipforTSor withdipandrakeforDC.dip – Fault dip in deg, in [0, 90]. Required for
TSandDCwhen the corresponding source geometry is selected.rake – Slip rake in deg, in [-180, 180], counterclockwise positive on the fault plane. Supplying it with
strikeanddipselectsDC; omit it forTS.force – Single-force coefficients
(fN, fE, fZ)for theSFsource. Directions are north, east and downward. Each coefficient is multiplied byscale.moment_tensor – Six independent moment-tensor coefficients
(Mxx, Mxy, Mxz, Myy, Myz, Mzz)for theMTsource. Subscripts x/y/z denote north/east/down.src_fault – sCoulomb source file supplying source positions, mechanisms and slip/potency. Append a complete
-Doption to each row to specify its rupture process.src_fault_size – Along-strike/dip subdivision sizes (dL, dW) in km. Omit to use the smallest positive library sampling interval. Both values must be positive or zero;
(0, 0)uses one center point source weighted by the whole fault area. Point Kode records remain single points.rcv_points – ASCII receiver file: north east depth in km, optionally followed by strike dip rake in degrees.
rcv_fault – sCoulomb receiver file; only Kode=100 is supported and slip magnitude is ignored. An exact
rakeheader preserves the angle even at zero slip; otherwise the slip columns define direction.rcv_fault_size – Along-strike/dip receiver subdivision sizes (dL, dW) in km. Both values must be positive or zero. Omit or set
(0, 0)to use one center point per fault.interpolate – Library-root query method: True (default, CLI -i1) linearly combines synthesized corner results after aligning their P arrivals to the actual P arrival with integer sample shifts; False (CLI -i0) uses nearest nodes, for both point sources and source faults. Ignored when
grnpoints directly to a node directory.nthreads – Positive OpenMP source-subfault thread count.
time_function – Time-function parameters without the
-Dprefix. Supported forms arei(impulse),p/t0(parabola),t/t1/t2/t3(trapezoid),c/t1/t2(asymmetric cosine), and0/file(custom), with area normalization. Custom files support one amplitude column or two columns: time (s) and amplitude. Two-column data are linearly interpolated to the Green’s functiondt. Custom time functions are automatically area-normalized. Fort/t1/t2/t3, the parameters are nonnegative rise, plateau and fall durations, with a positive total duration. Forc/t1/t2,t1andt2are positive rise and fall durations. Times are in seconds.r/f0additionally accepts a Ricker convolution wavelet, withf0in Hz and analytic peak amplitude 1. This signed wavelet is not an area-normalized unit-slip source process. Append+d<delay>for a delay in seconds, e.g.p/1.3+d0.4.integrate_order – Number of time integrations. For example,
1yields step-like displacement.differentiate_order – Number of time differentiations. For example,
1yields velocity.zne – If true, output ZNE instead of ZRT. Finite sources always use ZNE.
calc_upar – If true, also synthesize spatial derivatives of displacement. Derivative channel names are prefixed with
z/r/t(ZRT) orz/n/e(ZNE). Set this when strain, stress or rotation will be computed later.
- static_syn(*, depsrc: float | None = None, deprcv: float | None = None, norths: Sequence[float] | None = None, easts: Sequence[float] | None = None, rcv_points: str | PathLike | None = None, rcv_fault: str | PathLike | None = None, rcv_fault_size: Sequence[float] | None = None, output_path: str | PathLike, scale: float | None = None, scale_with_mu: bool = False, strike: float | None = None, dip: float | None = None, rake: float | None = None, force: Sequence[float] | None = None, moment_tensor: Sequence[float] | None = None, src_fault: str | PathLike | None = None, src_fault_size: Sequence[float] | None = None, zne: bool | None = None, nthreads: int | None = None, calc_upar: bool = False, **kwargs) None[源代码]
Synthesize static three-component displacement with
grt static_syn.A call defines five groups of information:
Green functions: configure
stgrnonPyModel1Dand compute them withstatic_greenfn(), or use an existing NetCDF library.Source location: a point source is at the horizontal origin, with depth
depsrc.src_faultsupplies the locations of finite sources.Receiver locations: reuse the library horizontal grid or redefine it with
norths/eastsand a shareddeprcv; alternatively usercv_pointsorrcv_fault. Receiver files supply their own depths and replace the grid parameters.Source mechanism and strength: a point source requires
scale. Choosestrike/dip/rakefor a double-couple, omitrakefor a tensile crack, or useforceormoment_tensorinstead. Leaving all mechanism parameters unset selects an explosion.src_faultsupplies both location and mechanism/strength; omitdepsrc,scaleand all point-source mechanism parameters in this mode.Output:
output_pathsets the NetCDF file;zneselects ZNE andcalc_uparadds spatial derivatives. Finite sources always output ZNE.
Point-source
depsrcand grid-receiverdeprcvcan be inferred when the corresponding library depth dimension has one value. All coordinates share one horizontal origin and must lie within the library range. Finite sources require at least two library nodes, including source files containing only Kode 400/500 point records;src_fault_sizedoes not bypass this restriction.src_fault_sizeandrcv_fault_sizecontrol fault subdivision;nthreadssets the source thread count. All arguments are keyword-only. Interpolation combines the results synthesized at surrounding library samples. Displacements are in cm with Z upward, R radial outward and T clockwise from R by default.- 参数:
depsrc – Point-source depth in km (CLI -Ds). Required for multiple library source depths; inferred for one. Must lie within the library range. Omit for source faults.
deprcv – Uniform grid receiver depth in km (CLI -Dr). Required for multiple library receiver depths; inferred for one. Must lie within the library range. Omit for receiver files.
norths – Optional new north grid as three values
(start, stop, step)in km. Must be set together witheasts. Mutually exclusive withrcv_points.easts – Optional new east grid as three values
(start, stop, step)in km. Must be set together withnorths. Mutually exclusive withrcv_points.rcv_points – ASCII file of arbitrary receivers (
north east depthin km, optionally followed bystrike dip rakein degrees;#comments). All data rows must use the same 3- or 6-column format. Mutually exclusive withnorths/eastsanddeprcv.rcv_fault – sCoulomb-format finite receiver-fault file with 11 data columns and Kode=100; an exact
raketoken in the seventh header column supplies the rake even at zero slip; otherwise the slip columns define direction. Slip magnitude is ignored (CLI-U). Withoutrcv_fault_size, use one center per fault. With that argument, each fault contributes multiple subfault centers. Mutually exclusive withrcv_points,norths/eastsanddeprcv.rcv_fault_size – Optional
(dL, dW)in km for receiver-fault subdivision along strike / dip; both values must be positive or zero. Omit or set(0, 0)to use one center point per fault.output_path – Output NetCDF file path.
scale – Point-source scaling factor. For explosion, double-couple, tensile-crack and moment-tensor sources, the unit is dyne·cm. It is the scalar moment for a double-couple; moment-tensor coefficients are multiplied by it without normalization. For an explosion it scales each diagonal tensor entry, and for a tensile crack it represents \(\mu\Sigma D\). For a single force, the unit is dyne. If
scale_with_muis true,scaleis treated as area × slip in cm³ and multiplied by the source-layer shear modulus \(\mu\). Required for point sources; omit withsrc_fault.scale_with_mu – If true, multiply
scaleby the source-layer shear modulus \(\mu\) (CLI-Su).strike – Fault strike in deg, in [0, 360]. North is 0°, clockwise positive. Set together with
dipforTSor withdipandrakeforDC.dip – Fault dip in deg, in [0, 90]. Required for
TSandDCwhen the corresponding source geometry is selected.rake – Slip rake in deg, in [-180, 180], counterclockwise positive on the fault plane. Supplying it with
strikeanddipselectsDC; omit it forTS.force – Single-force coefficients
(fN, fE, fZ)for theSFsource. Directions are north, east and downward. Each coefficient is multiplied byscale.moment_tensor – Six independent moment-tensor coefficients
(Mxx, Mxy, Mxz, Myy, Myz, Mzz)for theMTsource. Subscripts x/y/z denote north/east/down.src_fault – sCoulomb-format finite-fault file with 11 data columns (Kode 100/200/300/400/500). An exact
raketoken in the seventh header column selects Kode 100 rake/net-slip interpretation; the filename suffix is not used. Mutually exclusive with point-source options; point-source arguments causeValueError.src_fault_size – Optional
(dL, dW)in km for finite-fault subdivision along strike / dip. If omitted, the C code uses the smallest positive interval among epicentral distance, source depth and receiver depth in the library. Both values must be positive or zero;(0, 0)uses one center point source weighted by the whole fault area.nthreads – Positive OpenMP source-subfault thread count.
zne – If true, output ZNE instead of ZRT. Finite sources always use ZNE.
calc_upar – If true, also synthesize spatial derivatives of displacement. Derivative variable names use prefixes
z/r/t(ZRT) orz/n/e(ZNE). Set this when strain, stress or rotation will be computed later.
- compute_static_syn(*args, **kwargs)[源代码]
Legacy interface renamed to
static_syn(); calling it raises an error.