Stream.rotate(method, back_azimuth=None, inclination=None, inventory=None, **kwargs)[source]

Rotate stream objects.

  • method (str)

    Determines the rotation method.

    '->ZNE': Rotates data from three components into Z, North- and
    East-components based on the station metadata (e.g. borehole stations). Uses mandatory inventory parameter (provide either an Inventory or Parser object) and ignores back_azimuth and inclination parameters. Additional kwargs will be passed on to _rotate_to_zne() (use if other components than ["Z", "1", "2"] and ["1", "2", "3"] need to be rotated). Trims common channels used in rotation to time spans that are available for all three channels (i.e. cuts away parts for which one or two channels used in rotation do not have data).
    'NE->RT': Rotates the North- and East-components of a
    seismogram to radial and transverse components.
    'RT->NE': Rotates the radial and transverse components of a
    seismogram to North- and East-components.
    'ZNE->LQT': Rotates from left-handed Z, North, and East system
    to LQT, e.g. right-handed ray coordinate system.
    'LQT->ZNE': Rotates from LQT, e.g. right-handed ray coordinate
    system to left handed Z, North, and East system.
  • back_azimuth (float, optional) Depends on the chosen method. A single float, the back azimuth from station to source in degrees. If not given, stats.back_azimuth will be used. It will also be written after the rotation is done.
  • inclination (float, optional) Inclination of the ray at the station in degrees. Only necessary for three component rotations. If not given, stats.inclination will be used. It will also be written after the rotation is done.
  • inventory (Inventory or Parser) Inventory or SEED Parser with metadata of channels.

Example to rotate unaligned borehole instrument data based on station inventory (a dataless SEED Parser can also be provided, see details for option inventory):

>>> from obspy import read, read_inventory
>>> st = read("/path/to/ffbx_unrotated_gaps.mseed")
>>> inv = read_inventory("/path/to/ffbx.stationxml")
>>> st.rotate(method="->ZNE", inventory=inv)  
<obspy.core.stream.Stream object at 0x...>