pyadjoint.adjoint_source

Central interfaces for Pyadjoint, misfit measurement package.

copyright

adjTomo Dev Team (adjtomo@gmail.com), 2022 Lion Krischer (krischer@geophysik.uni-muenchen.de), 2015

license

BSD 3-Clause (“BSD New” or “BSD Simplified”)

Module Contents

Classes

AdjointSource

Adjoint Source class to hold calculated adjoint sources

class pyadjoint.adjoint_source.AdjointSource(adjsrc_type, misfit, dt, min_period, max_period, component, adjoint_source=None, windows=None, network=None, station=None, location=None, starttime=None, window_stats=None)[source]

Adjoint Source class to hold calculated adjoint sources

__str__()[source]

Return str(self).

write(filename, format, **kwargs)[source]

Write the adjoint source to a file.

Parameters
  • filename (str, open file, or file-like object) – Determines where the adjoint source is saved.

  • format (str) – The format of the adjoint source. Currently available are: "SPECFEM"

SPECFEM

SPECFEM requires one additional parameter: the temporal offset of the first sample in seconds. The following example sets the time of the first sample in the adjoint source to -10.

>>> adj_src.write("NET.STA.CHAN.adj", format="SPECFEM",
...               time_offset=-10)  

Adjoint sources can be written directly to an ASDFDataSet if provided. Optional coordinates parameter specifies the location of the station that generated the adjoint source

>>> adj_src.write(ds, format="ASDF", time_offset=-10,
...               coordinates={'latitude':19.2,
...                            'longitude':13.4,
...                            'elevation_in_m':2.0})
_write_specfem(filename, time_offset)[source]

Write the adjoint source for SPECFEM.

Parameters
  • filename (str) – name of file to write adjoint source to

  • time_offset (float) – time offset of the first time point in array

_write_asdf(ds, time_offset, coordinates=None, **kwargs)[source]

Writes the adjoint source to an ASDF file.

Parameters
  • ds (str) – The ASDF data structure read in using pyasdf.

  • time_offset (float) – The temporal offset of the first sample in seconds. This is required if using the adjoint source as input to SPECFEM.

  • coordinates (list) – If given, the coordinates of the adjoint source. The ‘latitude’, ‘longitude’, and ‘elevation_in_m’ of the adjoint source must be defined.