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')[源代码]

基类:object

File-based 1D layered model for GRT calculations.

Typical workflow:

  1. Create PyModel1D with the Green’s function path(s) actually needed (grn and/or stgrn) and optional modelpath.

  2. Compute modal dispersion, receiver functions and Green’s functions with eigenv(), eigenfn(), modsum(), rcvfn(), greenfn() or static_greenfn() (the required paths depend on the method).

  3. Synthesize waveforms or static fields with syn() or static_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 / modelpath are 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() and static_greenfn(). Travel-time calculations also need it, unless a per-call modelpath is passed to travt().

  • topbound – Top boundary condition. One of free, rigid and halfspace.

  • botbound – Bottom boundary condition. One of free, rigid and halfspace.

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 and self.modelpath is not changed. Required when self.modelpath is 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 modelpath in the constructor and writes a NetCDF dispersion file to phase_path. Set secular_freq to use the C module’s debug mode, which prints the secular function instead and does not require freqs / periods or phase_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 with periods.

  • periods – One period, or (T1, T2, dT) in s. Mutually exclusive with freqs.

  • phase_path – Output NetCDF dispersion path. It is not used in secular-function debug mode.

  • max_order – Maximum mode order. None leaves -N unspecified and computes the fundamental mode.

  • all_modes – If true, pass bare -N and compute as many modes as possible. Mutually exclusive with max_order.

  • secular_freq – Debug frequency in Hz. When set, pass -X instead of -F and -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 are tol, cgap, thrd, vgap and dc. tol, cgap, thrd and vgap are decimal exponents of the CLI thresholds (tol=3 means \(10^{-3}\)), while dc is a uniform search interval in km/s.

  • nthreads – Number of OpenMP threads. None uses all cores (CLI -P).

  • print_log – If false, suppress command output and capture it on failure. Warnings and diagnostics from grt are still printed.

返回:

None. The dispersion file is written to phase_path in 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 with modes.

  • eigenfn_path – Output NetCDF eigenfunction path.

  • depths – Optional one- or three-value depth selection for eigenfn_path in 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_path must be a dispersion file generated by eigenv() 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 to output_path or, when it is omitted, to the grn root 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 with modes.

  • upsampling_n – Frequency-domain zero-padding factor.

  • delayT0 – Time delay at zero distance in s. Supplying this, delayV0 or ref_first_p enables -E.

  • delayV0 – Reference velocity for the time delay in km/s. Used only when ref_first_p is 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, HF and DC. None means all types.

  • calc_upar – If true, also compute spatial displacement derivatives.

  • nthreads – Number of OpenMP threads. None uses all cores (CLI -P).

  • print_log – If false, suppress command output and capture it on failure. Warnings and diagnostics from grt are 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 modelpath with a free surface and half-space bottom. See synnoise for the source and receiver file formats. Saves Rayleigh and Love phase/group dispersion as phaseR.nc, phaseL.nc, groupR.nc and groupL.nc in output_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]); None selects all modes.

  • nthreads – Positive parallel worker count; None uses 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 greenfn command.

Requires grn and modelpath in the constructor. Results are written as SAC files under {grn}/{model}_{depsrc}_{deprcv}_{distance}. The model file is also copied into the grn root 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.0 means 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.0 means the value is selected automatically.

  • filonLength – Integration step of fixed-interval Filon integration at large distances, but not at zero distance. 0.0 disables this method. Near-field terms are included. Do not set together with safilonTol.

  • safilonTol – Precision of self-adaptive Filon integration at large distances, but not at zero distance. 0.0 disables this method. Near-field terms are included. Do not set together with filonLength.

  • filonCut – Splitting point between DWM and Filon integration, \(k^*=\mathrm{filonCut}/r_{\max}\).

  • converg_method – Explicit convergence method. One of AUTO, NONE, DCM and PTAM.

  • delayT0 – Time delay at zero distance in s.

  • delayV0 – Reference velocity for the time delay in km/s. Used only when ref_first_p is 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, HF and DC. None means all available source types.

  • statsidxs – Frequency indexes for optional statistics output. None means no statistics files. An empty list means all frequency indexes (CLI bare -S).

  • nthreads – Number of OpenMP threads. None uses all cores (CLI -P).

  • print_log – Whether to print calculation logs. Warnings and diagnostics from grt are 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 rcvfn command. The incident wave is specified by either a horizontal ray parameter rayp or an upward incidence angle inca at the selected reverse-indexed model layer. Results are written as P_rcvfn.sac or S_rcvfn.sac below output_path; write_components=True also writes the corresponding Z and R response 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 +a to -N.

  • skipImagComps – If true, append +f to -N and 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 grt output while preserving warnings and diagnostics.

返回:

None. SAC files are written below output_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_greenfn command.

Requires stgrn and modelpath in 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 / deprcv may 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, dists is the usual choice: it computes a one-dimensional distance list and stores it as north=0 and east=dists. This is also the most convenient format for static_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:

  1. 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.

  2. norths and easts, 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 with norths / easts.

  • norths – Three values defining the north-coordinate option -Xstart/stop/step in km.

  • easts – Three values defining the east-coordinate option -Ystart/stop/step in 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.0 disables this method. Near-field terms are included. Do not set together with safilonTol.

  • safilonTol – Tolerance for self-adaptive Filon integration at large distances. 0.0 disables this method. Near-field terms are included. Do not set together with filonLength.

  • filonCut – Splitting point between DWM and Filon integration.

  • converg_method – Explicit convergence method. One of AUTO, NONE, DCM and PTAM.

  • 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 grn on PyModel1D and compute them with greenfn(), or use an existing library.

  • Source location: a point source is at the horizontal origin, with depth depsrc. src_fault supplies 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. Choose strike/dip/rake for a double-couple, omit rake for a tensile crack, or use force or moment_tensor instead. Leaving all mechanism parameters unset selects an explosion. src_fault supplies both location and mechanism/strength; omit depsrc, scale and all point-source mechanism parameters in this mode.

  • Output: output_path sets the SAC directory; zne selects ZNE and calc_upar adds spatial derivatives. Finite sources always output ZNE.

With a library root, point-source depsrc and polar-receiver dist/deprcv can be inferred when the corresponding library dimension has one value; azimuth is still required for polar receivers. With a single GF node directory, omit depsrc, deprcv and dist and supply azimuth and 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, interpolate is 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/azimuth locate the receiver relative to that origin. src_fault_size and rcv_fault_size control fault subdivision.

Optional time_function, integrate_order and differentiate_order control the time dependence. interpolate controls library interpolation and nthreads sets 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-source sig.sac stores the total scalar moment rate only when a row or global time function is explicitly specified. A global time_function ignores all row-end contents in the source fault file. Results are written to files; read SAC waveforms explicitly with obspy.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_mu is true, scale is treated as area × slip in cm³ and multiplied by the source-layer shear modulus \(\mu\).

  • scale_with_mu – If true, multiply scale by the source-layer shear modulus \(\mu\) (CLI -Su).

  • strike – Fault strike in deg, in [0, 360]. North is 0°, clockwise positive. Set together with dip for TS or with dip and rake for DC.

  • dip – Fault dip in deg, in [0, 90]. Required for TS and DC when the corresponding source geometry is selected.

  • rake – Slip rake in deg, in [-180, 180], counterclockwise positive on the fault plane. Supplying it with strike and dip selects DC; omit it for TS.

  • force – Single-force coefficients (fN, fE, fZ) for the SF source. Directions are north, east and downward. Each coefficient is multiplied by scale.

  • moment_tensor – Six independent moment-tensor coefficients (Mxx, Mxy, Mxz, Myy, Myz, Mzz) for the MT source. Subscripts x/y/z denote north/east/down.

  • src_fault – sCoulomb source file supplying source positions, mechanisms and slip/potency. Append a complete -D option 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 rake header 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 grn points directly to a node directory.

  • nthreads – Positive OpenMP source-subfault thread count.

  • time_function – Time-function parameters without the -D prefix. Supported forms are i (impulse), p/t0 (parabola), t/t1/t2/t3 (trapezoid), c/t1/t2 (asymmetric cosine), and 0/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 function dt. Custom time functions are automatically area-normalized. For t/t1/t2/t3, the parameters are nonnegative rise, plateau and fall durations, with a positive total duration. For c/t1/t2, t1 and t2 are positive rise and fall durations. Times are in seconds. r/f0 additionally accepts a Ricker convolution wavelet, with f0 in 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, 1 yields step-like displacement.

  • differentiate_order – Number of time differentiations. For example, 1 yields 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) or z/n/e (ZNE). Set this when strain, stress or rotation will be computed later.

compute_syn(*args, **kwargs)[源代码]

Legacy interface renamed to syn(); calling it raises an error.

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 stgrn on PyModel1D and compute them with static_greenfn(), or use an existing NetCDF library.

  • Source location: a point source is at the horizontal origin, with depth depsrc. src_fault supplies the locations of finite sources.

  • Receiver locations: reuse the library horizontal grid or redefine it with norths/easts and a shared deprcv; alternatively use rcv_points or rcv_fault. Receiver files supply their own depths and replace the grid parameters.

  • Source mechanism and strength: a point source requires scale. Choose strike/dip/rake for a double-couple, omit rake for a tensile crack, or use force or moment_tensor instead. Leaving all mechanism parameters unset selects an explosion. src_fault supplies both location and mechanism/strength; omit depsrc, scale and all point-source mechanism parameters in this mode.

  • Output: output_path sets the NetCDF file; zne selects ZNE and calc_upar adds spatial derivatives. Finite sources always output ZNE.

Point-source depsrc and grid-receiver deprcv can 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_size does not bypass this restriction.

src_fault_size and rcv_fault_size control fault subdivision; nthreads sets 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 with easts. Mutually exclusive with rcv_points.

  • easts – Optional new east grid as three values (start, stop, step) in km. Must be set together with norths. Mutually exclusive with rcv_points.

  • rcv_points – ASCII file of arbitrary receivers (north east depth in km, optionally followed by strike dip rake in degrees; # comments). All data rows must use the same 3- or 6-column format. Mutually exclusive with norths/easts and deprcv.

  • rcv_fault – sCoulomb-format finite receiver-fault file with 11 data columns and Kode=100; an exact rake token in the seventh header column supplies the rake even at zero slip; otherwise the slip columns define direction. Slip magnitude is ignored (CLI -U). Without rcv_fault_size, use one center per fault. With that argument, each fault contributes multiple subfault centers. Mutually exclusive with rcv_points, norths/easts and deprcv.

  • 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_mu is true, scale is treated as area × slip in cm³ and multiplied by the source-layer shear modulus \(\mu\). Required for point sources; omit with src_fault.

  • scale_with_mu – If true, multiply scale by the source-layer shear modulus \(\mu\) (CLI -Su).

  • strike – Fault strike in deg, in [0, 360]. North is 0°, clockwise positive. Set together with dip for TS or with dip and rake for DC.

  • dip – Fault dip in deg, in [0, 90]. Required for TS and DC when the corresponding source geometry is selected.

  • rake – Slip rake in deg, in [-180, 180], counterclockwise positive on the fault plane. Supplying it with strike and dip selects DC; omit it for TS.

  • force – Single-force coefficients (fN, fE, fZ) for the SF source. Directions are north, east and downward. Each coefficient is multiplied by scale.

  • moment_tensor – Six independent moment-tensor coefficients (Mxx, Mxy, Mxz, Myy, Myz, Mzz) for the MT source. 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 rake token 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 cause ValueError.

  • 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) or z/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.