pygmt.Figure.sac

Figure.sac(data, pen=None, time_window=False, offset=None, profile=None, preprocess=None, fill=False, amplitude_scale=None, vertical=False, time_scale=None, reduction_velocity=None, time_shift=None, time_reference=None, projection=None, region=None, frame=False, verbose=False, panel=False, perspective=False, transparency=None, **kwargs)

Plot seismograms in SAC format.

Reads SAC waveform files and plots seismic traces. Only evenly spaced SAC data is supported.

Full GMT docs at https://docs.generic-mapping-tools.org/6.7/supplements/seis/sac.html.

Aliases:

  • B = frame

  • C = time_window

  • D = offset

  • E = profile

  • F = preprocess

  • G = fill

  • J = projection

  • M = amplitude_scale

  • Q = vertical

  • R = region

  • S = time_scale

  • T = +r: reduction_velocity, +s: time_shift, +t: time_reference

  • V = verbose

  • W = pen

  • c = panel

  • p = perspective

  • t = transparency

Parameters:
  • data (str | PathLike | Sequence[str | PathLike]) – The SAC waveform file(s) to plot.

  • pen (str | None, default: None) – Set pen attributes for all traces [Default is "0.25p,black,solid"].

  • time_window (Sequence[float] | bool, default: False) – Read and plot seismograms in the time window between t0 and t1 only, where t0 and t1 are relative to the reference time (see time_reference). If no reference time is set, the reference time in the SAC header is used. Set to True to determine t0/t1 from the xmin/xmax of the region parameter.

  • offset (float | Sequence[float] | None, default: None) – Offset the seismogram positions by the given amounts dx*[/ *dy] [Default is no offset]. If dy is not given, it is set equal to dx.

  • profile (str | None, default: None) – Choose the profile type, i.e., the type of the y axis. Use a for azimuth, b for back-azimuth, k for epicentral distance in km, d for epicentral distance in degrees, n for trace number (the first trace is numbered n, e.g., n0), and u for user-defined profile (the y positions are determined by the SAC header variable usern, e.g., u0).

  • preprocess (str | None, default: None) – Preprocess the data before plotting. Use i for integral, q for square, and r for removing the mean value. The letters can repeat multiple times, and the order controls the processing order, e.g., "rii" converts acceleration to displacement.

  • fill (str | Sequence[str] | bool, default: False) – Paint the positive or negative portion of the traces. Use p/n to paint the positive/negative portion [Default paints the positive portion], +g fill to set the fill color [Default is "black"], +z zero to define the zero line, and +t t0/t1 to paint a time window only. Can be repeated to paint the positive and negative portions separately, e.g., ["p+gblack", "n+gred"]. Set to True to paint the positive portion with the default fill.

  • amplitude_scale (float | str | Sequence[float | str] | None, default: None) –

    Set the vertical scaling of the traces.

    • If only size is given (optionally with a unit), all traces are scaled to the given height on the map.

    • If size/alpha is given with a negative alpha, all traces use the same scaling factor determined by the first trace, which is scaled to size.

    • If alpha is 0, all traces are multiplied by size [no unit is allowed].

    • If alpha is positive, all traces are multiplied by size times the epicentral distance (in km) raised to the power alpha.

  • vertical (bool, default: False) – Plot traces vertically, i.e., the y axis is time and the x axis is amplitude.

  • time_scale (float | str | None, default: None) – Set the time scale in seconds per unit while plotting on geographic plots. Append a unit (c, i, or p); if omitted, the unit is controlled by PROJ_LENGTH_UNIT. Use the i prefix to give the reciprocal scale, i.e., unit per second.

  • reduction_velocity (float | None, default: None) – Set the reduction velocity in km/s. The trace times are reduced by distance/reduction_velocity, where distance is the epicentral distance in the SAC header.

  • time_shift (float | None, default: None) – Shift all traces by the given number of seconds.

  • time_reference (Literal['b', 'e', 'o', 'a', 't0', 't1', 't2', 't3', 't4', 't5', 't6', 't7', 't8', 't9'] | None, default: None) – Align all traces along the given time mark. Choose from "b", "e", "o", "a", or "t0" to "t9".

  • projection (str | None, default: None) – projcode[projparams/]width|scale. Select map projection.

  • region (Sequence[float | str] | str | None, default: None) – [xmin, xmax, ymin, ymax] or xmin/xmax/ymin/ymax[+r][+uunit]. Specify the region of interest.

  • frame (Frame | Axis | Literal['none'] | str | Sequence[str] | bool, default: False) – Set frame and axes attributes for the plot. It can be a bool, "none", a pygmt.params.Frame or pygmt.params.Axis object. Raw GMT strings or sequences of strings are also supported for backward compatibility. If frame=True, the frame will be drawn with the default attributes. If frame="none", no frame will be drawn. Use a pygmt.params.Frame or pygmt.params.Axis object for more control over the attributes of the frame and axes. A tutorial is available at frame and axes attributes. Full documentation is at https://docs.generic-mapping-tools.org/6.7/gmt.html#b-full.

  • verbose (Literal['quiet', 'error', 'warning', 'timing', 'info', 'compat', 'debug'] | bool, default: False) – Select verbosity level [Full usage].

  • panel (int | Sequence[int] | bool, default: False) –

    Select a specific subplot panel. Only allowed when used in Figure.subplot mode.

    • True to advance to the next panel in the selected order.

    • index to specify the index of the desired panel.

    • (row, col) to specify the row and column of the desired panel.

    The panel order is determined by the Figure.subplot method. row, col and index all start at 0.

  • perspective (float | Sequence[float] | str | bool, default: False) –

    Select perspective view and set the azimuth and elevation of the viewpoint.

    Accepts a single value or a sequence of two or three values: azimuth, (azimuth, elevation), or (azimuth, elevation, zlevel).

    • azimuth: Azimuth angle of the viewpoint in degrees [Default is 180, i.e., looking from south to north].

    • elevation: Elevation angle of the viewpoint above the horizon [Default is 90, i.e., looking straight down at nadir].

    • zlevel: Z-level at which 2-D elements (e.g., the plot frame) are drawn. Only applied when used together with zsize or zscale. [Default is at the bottom of the z-axis].

    Alternatively, set perspective=True to reuse the perspective setting from the previous plotting method, or pass a string following the full GMT syntax for finer control (e.g., adding +w or +v modifiers to select an axis location other than the plot origin). See https://docs.generic-mapping-tools.org/6.7/gmt.html#perspective-full for details.

  • transparency (float | None, default: None) – Set transparency level, in [0-100] percent range [Default is 0, i.e., opaque]. Only visible when PDF or raster format output is selected. Only the PNG format selection adds a transparency layer in the image (for further processing).