Using xcap3d¶
Given an SCEDC event ID, xcap3d returns the moment tensor, the depth and a report. This page shows the steps one by one, the files they write, the main options, and how to look at many events.
The examples write DB for the Green’s-function database and ~/xcap3d_out
for the output directory, where every event
gets a folder <id>/.
The Green’s-function database¶
xcap3d does not compute Green’s functions during a run; it reads them from a
database of strain Green’s tensor stores, one HDF5 file per station, each from three SPECFEM3D simulations with a unit force at the
station. By reciprocity they give the seismogram at the station of a source
anywhere in a box around it. The database is provided by the operator: point --gf at its directory. Its
release.json lists the stores; a run checks every store it opens against it
and names the release in result.json.
One command¶
xcap3d run 38695658 --gf DB --mt full --refine --out ~/xcap3d_out --report
run downloads the data, removes the instrument responses, inverts the data (depth scan with a
grid search over strike, dip and rake at each depth, then the station
jackknife) and, with --report, writes the report. The last line printed is
the answer:
38695658 production: depth 15.5 km FM 263/43/92 Mw 4.56 VR 67.8
FM is strike/dip/rake in degrees, VR the variance reduction in percent.
Step by step¶
The same work, one step at a time, e.g. to download many events before inverting them, or to invert again with other options without downloading:
xcap3d download 38695658 --out ~/xcap3d_out
xcap3d process 38695658 --out ~/xcap3d_out
xcap3d invert 38695658 --gf DB --mt full --refine --out ~/xcap3d_out
xcap3d report 38695658 --out ~/xcap3d_out
step |
what it does |
writes in |
|---|---|---|
|
fetches from the SCEDC FDSN service the event (origin, magnitude, phase picks), the station metadata with instrument responses and the raw seismograms of the CI stations within 100 km, 300 s before to 300 s after the origin |
|
|
removes the instrument response, rotates to Z, R, T, low-passes, resamples to 20 samples/s and sets the time windows from the picks |
|
|
the inversion of |
|
|
the report of a finished inversion |
|
A step whose output is already there does nothing; move that folder away to
repeat it: to download an event again, delete <out>/<id>/raw (there is no
--refresh option). A download in which no channel returned data writes
nothing. run writes the same files and also skips what is there, so run
after process inverts the processed data, and the files are the same as
those of the three steps.
From Python, xcap3d.run_event takes the settings of run by name and
returns the record, an xcap3d.Result (a dict that prints the solution); download_event, process_event and invert_event are
the three steps (API page). The example runs run_event.
Options¶
run and invert share these options; --help lists the rest.
option |
default |
meaning |
|---|---|---|
|
required |
the database directory |
|
|
the database’s release file |
|
|
where |
|
off |
also write |
|
|
|
|
jackknife on |
skip the station jackknife (faster); |
|
|
the directory holding the reference catalog files (below) |
|
|
|
|
off |
after the double-couple search at each depth, also search 1-deg nodes within 8 deg (Kagan) of up to 3 coarse minima and keep the lowest misfit; |
|
|
the strike/dip/rake spacing, more than 0 and at most 30 deg. On event 41249496 (64 stations, 18 depths, GPU) a 2-deg grid took 2.5 times as long and 33 against 12.7 GiB of GPU memory; 1 deg would not fit a 46 GiB GPU. |
|
|
the spacing of the |
A CPU run of the example event needed 15 GB of memory: plan 16 GB per CPU run. Use a GPU
(--device cuda:N) for production runs.
Outputs¶
file in |
what it is |
|---|---|
|
the raw download: |
|
the processed data: per station |
|
the record of the inversion (below) |
|
observed and synthetic waveforms in every time window of every station at every scanned depth |
|
the report and its figures (below) |
A data-full/ made by an older xcap3d is refused: move it away and run xcap3d process again.
The main keys of result.json:
key |
contents |
|---|---|
|
depth, strike, dip, rake, Mw, M0 (N m), VR, stations and components used, the tensor |
|
the best mechanism, Mw, misfit and VR at each depth |
|
the depths within 10 % of the best misfit, and whether the best depth is at the edge of the scan |
|
the station jackknife: each station left out in turn; the median and 90th percentile Kagan angle and the standard error of the depth |
|
a one-line assessment, e.g. “well constrained”, with caveats |
|
per station: distance, azimuth, component weights, cross-correlation, time shifts, |
|
published mechanisms of the event in the reference catalogs; |
|
the release used, and the sha256 of every input file |
|
every setting as run, the passbands and windows, the software versions and the device |
|
|
Known issue, the QC weights: the Huber weights act on the absolute component residual, so a large, well-fit component can be down-weighted while a small, poorly correlated one keeps full weight. The 2021 code also removed components with CC below 40-65 %. A combined rule is being studied.
A run without a solution (no station or depth left, a store that differs from
the release, an incomplete download) still writes result.json, with
status no_solution and the reason, and prints the reason. A run that
crashes writes status error with the exception’s type (error) and
message (reason), then stops with the exception, so no earlier record is
left standing. report refuses both kinds of record and catalog lists those
events in one line.
Reference catalogs¶
The record and the report compare the solution with published solutions of
the same event, read from these files in the directory --catalogs DIR
(default XCAP3D_CATALOGS). None ships with xcap3d; a missing file is not an
error, references_missing names it. A row that cannot be read is skipped,
with one warning per file.
file in DIR |
source |
|---|---|
|
the published 2021 catalog: gCAP3D, Wang & Zhan (2020) |
|
SCEDC moment tensors (SCSN) |
|
SCEDC HASH first-motion mechanisms |
Many events: the catalog¶
Loop over the events in the shell, then put them on one page:
for id in 38695658 39322287 40735352; do
xcap3d run $id --gf DB --out ~/xcap3d_out --report
done
xcap3d catalog ~/xcap3d_out
catalog writes catalog.html and catalog_map.png in that
folder: one row per event that has a report, linked to it.
Visualizing¶
report.html shows the solution, the verdict and the published mechanisms of
the event; the misfit and mechanism against depth (depth.png); the station
map (map.png); observed and synthetic waveforms of every
station at the chosen depth (fits.png, nearest first, each station with its
VR and its rank); the station table, best VR first; and the
settings, the database release and the software versions. xcap3d report EVENT_ID writes it again from result.json and fits.h5 without inverting
again.
The station map shows four groups, with their counts in the key: used (filled, the area by the summed weight of the station’s components), deselected by the QC or the source margin (filled gray, the reason in the station table), not in the database (open circles) and without data (gray crosses).
The maps draw the Natural Earth 10m land, coastline and populated places.
The first report without them downloads them (9 MB, 60 MB on disk) into
cartopy’s data folder, once; offline, or when the download fails, it says no map
and leaves the maps out.
xcap3d viz wavefield draws a store’s wavefield, a frame strip (PNG) and an
animation (mp4, or GIF without imageio-ffmpeg; install the wavefield
extra) of the strain at the nodes of one slice for one force:
xcap3d viz wavefield STA --gf DB --force fz --slice depth=15 --out wavefield
Other commands¶
compare, replay, db release, db check, build model and build sgt
serve the operator, who builds and checks the database and compares
databases; each has --help. Adding stations means building them and running
xcap3d db release DB, which writes the next version and keeps the previous one.