version
0.0.1
Defines the C++ API for MsPASS
|
Vector (three-component) seismogram data object. More...
#include <CoreSeismogram.h>
Public Member Functions | |
CoreSeismogram () | |
CoreSeismogram (const size_t nsamples) | |
CoreSeismogram (const std::vector< mspass::seismic::CoreTimeSeries > &ts, const unsigned int component_to_clone=0) | |
CoreSeismogram (const mspass::utility::Metadata &md, const bool load_data=true) | |
Construct from Metadata definition that includes data path. More... | |
CoreSeismogram (const CoreSeismogram &) | |
void | set_dt (const double sample_interval) |
Set the sample interval. More... | |
void | set_npts (const size_t npts) |
Set the number of samples attribute for data. More... | |
void | sync_npts () |
Sync the number of samples attribute with actual data size. More... | |
void | set_t0 (const double t0in) |
Set the data start time. More... | |
CoreSeismogram & | operator= (const CoreSeismogram &) |
CoreSeismogram & | operator+= (const CoreSeismogram &d) |
Summation operator. More... | |
const CoreSeismogram | operator+ (const CoreSeismogram &other) const |
CoreSeismogram & | operator*= (const double) |
CoreSeismogram & | operator-= (const CoreSeismogram &d) |
Subtraction operator. More... | |
const CoreSeismogram | operator- (const CoreSeismogram &other) const |
std::vector< double > | operator[] (const int sample) const |
std::vector< double > | operator[] (const double time) const |
Overloaded version of operator[] for time. More... | |
virtual | ~CoreSeismogram () |
void | rotate_to_standard () |
void | rotate (mspass::utility::SphericalCoordinate &sc) |
void | rotate (const double nu[3]) |
void | rotate (const double phi) |
Rotate horizontals by a simple angle in degrees. More... | |
void | transform (const double a[3][3]) |
void | free_surface_transformation (const mspass::seismic::SlownessVector u, const double vp0, const double vs0) |
mspass::utility::dmatrix | get_transformation_matrix () const |
bool | set_transformation_matrix (const mspass::utility::dmatrix &A) |
Define the transformaton matrix. More... | |
bool | set_transformation_matrix (const double a[3][3]) |
Define the transformaton matrix with a C style 3x3 matrix. More... | |
bool | set_transformation_matrix (pybind11::object a) |
Define the transformaton matrix with a python object. More... | |
bool | cardinal () const |
bool | orthogonal () const |
double | endtime () const noexcept |
Public Member Functions inherited from mspass::seismic::BasicTimeSeries | |
BasicTimeSeries () | |
BasicTimeSeries (const BasicTimeSeries &) | |
virtual | ~BasicTimeSeries () |
Virtual destructor. More... | |
double | time (const int i) const |
int | sample_number (double t) const |
double | endtime () const noexcept |
bool | shifted () const |
double | time_reference () const |
void | force_t0_shift (const double t) |
Force a t0 shift value on data. More... | |
virtual void | ator (const double tshift) |
virtual void | rtoa () |
virtual void | shift (const double dt) |
bool | live () const |
bool | dead () const |
void | kill () |
void | set_live () |
double | dt () const |
bool | time_is_UTC () const |
bool | time_is_relative () const |
TimeReferenceType | timetype () const |
double | samprate () const |
size_t | npts () const |
double | t0 () const |
void | set_tref (const TimeReferenceType newtref) |
Force the time standard. More... | |
BasicTimeSeries & | operator= (const BasicTimeSeries &parent) |
Public Member Functions inherited from mspass::utility::Metadata | |
Metadata () | |
Metadata (std::ifstream &ifs, const std::string form=std::string("pf")) | |
Metadata (const Metadata &mdold) | |
virtual | ~Metadata () |
Metadata & | operator= (const Metadata &mdold) |
Metadata & | operator+= (const Metadata &rhs) noexcept |
const Metadata | operator+ (const Metadata &other) const |
double | get_double (const std::string key) const override |
int | get_int (const std::string key) const override |
long | get_long (const std::string key) const |
std::string | get_string (const std::string key) const override |
bool | get_bool (const std::string key) const override |
template<typename T > | |
T | get (const std::string key) const |
template<typename T > | |
T | get (const char *key) const |
Generic get interface for C char array. More... | |
boost::any | get_any (const std::string key) const |
std::string | type (const std::string key) const |
template<typename T > | |
void | put (const std::string key, T val) noexcept |
template<typename T > | |
void | put (const char *key, T val) noexcept |
void | put (const std::string key, const double val) override |
void | put (const std::string key, const int val) override |
void | put (const std::string key, const bool val) override |
void | put (const std::string key, const std::string val) override |
void | put (const char *key, const char *val) |
void | put (std::string key, const char *val) |
void | put_object (const std::string key, const pybind11::object val) |
void | put_int (const std::string key, const int val) |
void | put_string (const std::string key, const std::string val) |
void | put_bool (const std::string key, const bool val) |
void | put_double (const std::string key, const double val) |
void | put_long (const std::string key, const long val) |
void | append_chain (const std::string key, const std::string val, const std::string separator=std::string(":")) |
std::set< std::string > | modified () const |
void | clear_modified () |
Mark all data as unmodified. More... | |
std::set< std::string > | keys () const noexcept |
bool | is_defined (const std::string key) const noexcept |
void | erase (const std::string key) |
std::size_t | size () const noexcept |
std::map< std::string, boost::any >::const_iterator | begin () const noexcept |
std::map< std::string, boost::any >::const_iterator | end () const noexcept |
void | change_key (const std::string oldkey, const std::string newkey) |
Change the keyword to access an attribute. More... | |
Public Attributes | |
mspass::utility::dmatrix | u |
Protected Attributes | |
bool | components_are_orthogonal |
bool | components_are_cardinal |
double | tmatrix [3][3] |
Protected Attributes inherited from mspass::seismic::BasicTimeSeries | |
bool | mlive |
double | mdt |
double | mt0 |
size_t | nsamp |
TimeReferenceType | tref |
bool | t0shift_is_valid |
double | t0shift |
Protected Attributes inherited from mspass::utility::Metadata | |
std::map< std::string, boost::any > | md |
std::set< std::string > | changed_or_set |
Vector (three-component) seismogram data object.
A three-component seismogram is a common concept in seismology. The concept used here is that a three-component seismogram is a time series with a 3-vector as the data at each time step. As a result the data are stored internally as a matrix with row defining the component number (C indexing 0,1,2) and the column defining the time variable. The object inherits common concepts of a time series through the BasicTimeSeries object. Auxiliary parameters are defined for the object through inheritance of a Metadata object.
mspass::seismic::CoreSeismogram::CoreSeismogram | ( | ) |
Default constructor.
Sets ns to zero and builds an empty data matrix. The live variable in BasicTimeSeries is also set false.
References components_are_cardinal, components_are_orthogonal, set_dt(), set_npts(), set_t0(), and tmatrix.
mspass::seismic::CoreSeismogram::CoreSeismogram | ( | const size_t | nsamples | ) |
Simplest parameterized constructor.
Initializes data and sets aside memory for matrix of size 3xnsamples. The data matrix is not initialized and the object is marked as not live.
nsamples | number of samples expected for holding data. |
References components_are_cardinal, components_are_orthogonal, set_npts(), and tmatrix.
mspass::seismic::CoreSeismogram::CoreSeismogram | ( | const std::vector< mspass::seismic::CoreTimeSeries > & | ts, |
const unsigned int | component_to_clone = 0 |
||
) |
Construct a three component seismogram from three TimeSeries objects.
A three component seismogram is commonly assembled from individual single channel components. This constructor does the process taking reasonable care to deal with (potentially) irregular start and end times of the individual components. If the start and end times are all the same it uses a simple copy operation. Otherwise it runs a more complicated (read much slower) algorithm that handles the ragged start and stop times by adding a marked gap.
If start or end times are not constant the algorithm shortens the output to the latest start time and earliest end time respectively.
Note this constructor requires variables hang and vang, which are orientation angles defined in the CSS3.0 schema (NOT spherical coordinates by the way), by set for each component. This is used to construct the transformation matrix for the object that allows, for example, removing raw data orientation errors using rotate_to_standard. The constructor will throw an exception if any component does not have these attributes set in their Metadata area.
SeisppError | exception can be throw for a variety of serious problems. |
ts | vector of 3 TimeSeries objects to be used to assemble this Seismogram. Input vector order could be arbitrary because a transformation matrix is computed, but for efficiency standard order (E,N,Z) is advised. |
component_to_clone | the auxiliary parameters (Metadata and BasicTimeSeries common parameters) from one of the components is cloned to assure common required parameters are copied to this object. This argument controls which of the three components passed through ts is used. Default is 0. |
mspass::seismic::CoreSeismogram::CoreSeismogram | ( | const mspass::utility::Metadata & | md, |
const bool | load_data = true |
||
) |
Construct from Metadata definition that includes data path.
A Metadata object is sufficiently general that it can contain enough information to contruct an object from attributes contained in it. This constuctor uses that approach, with the actual loading of data being an option (on by default). In mspass this is constructor is used to load data with Metadata constructed from MongoDB and then using the path created from two parameters (dir and dfile used as in css3.0 wfdisc) to read data. The API is general but the implementation in mspass is very rigid. It blindly assumes the data being read are binary doubles in the right byte order and ordered in the native order for dmatrix (Fortran order). i.e. the constuctor does a raw fread of ns*3 doubles into the internal array used in the dmatrix implementation.
A second element of the Metadata that is special for MsPASS is the handling of the transformation matrix by this constructor. In MsPASS the transformation matrix is stored as a python object in MongoDB. This constructor aims to fetch that entity with the key 'tmatrix'. To be more robust and simpler to use with data not loaded from mongodb we default tmatrix to assume the data are in standard coordinates. That is, if the key tmatrix is not defined in Metadata passed as arg0, the constructor assumes it should set the transformation matrix to an identity. Use set_transformation_matrix if that assumption is wrong for your data.
md | is the Metadata used for the construction. |
load_data | if true (default) a file name is constructed from dir+"/"+dfile, the file is openned, fseek is called to foff, data are read with fread, and the file is closed. If false a dmatrix for u is still created of size 3xns, but the matrix is only initialized to all zeros. |
Will | throw a MsPASSError if required metadata are missing. |
References components_are_cardinal, components_are_orthogonal, mspass::seismic::BasicTimeSeries::force_t0_shift(), mspass::utility::Metadata::get_any(), mspass::utility::Metadata::get_double(), mspass::utility::Metadata::get_long(), mspass::utility::Metadata::get_string(), mspass::utility::Metadata::is_defined(), mspass::seismic::BasicTimeSeries::mdt, mspass::seismic::BasicTimeSeries::mlive, mspass::seismic::BasicTimeSeries::mt0, mspass::seismic::BasicTimeSeries::nsamp, mspass::seismic::Relative, mspass::seismic::SEISMICMD_dfile(), mspass::seismic::SEISMICMD_dir(), mspass::seismic::SEISMICMD_dt(), mspass::seismic::SEISMICMD_foff(), mspass::seismic::SEISMICMD_npts(), mspass::seismic::SEISMICMD_t0(), mspass::seismic::SEISMICMD_t0_shift(), mspass::seismic::SEISMICMD_time_standard(), set_npts(), set_transformation_matrix(), mspass::seismic::BasicTimeSeries::set_tref(), tmatrix, u, and mspass::seismic::UTC.
mspass::seismic::CoreSeismogram::CoreSeismogram | ( | const CoreSeismogram & | t3c | ) |
Standard copy constructor.
References components_are_cardinal, components_are_orthogonal, and tmatrix.
|
inlinevirtual |
|
inline |
|
inlinenoexcept |
Returns the end time (time associated with last data sample) of this data object.
References mspass::utility::dmatrix::columns(), mspass::seismic::BasicTimeSeries::mdt, mspass::seismic::BasicTimeSeries::mt0, and u.
void mspass::seismic::CoreSeismogram::free_surface_transformation | ( | const mspass::seismic::SlownessVector | u, |
const double | vp0, | ||
const double | vs0 | ||
) |
Computes and applies the Kennett [1991] free surface transformation matrix.
Kennett [1991] gives the form for a free surface transformation operator that reduces to a nonorthogonal transformation matrix when the wavefield is not evanescent. On output x1 will be transverse, x2 will be SV (radial), and x3 will be longitudinal.
u | slowness vector off the incident wavefield |
vp0 | Surface P wave velocity |
vs0 | Surface S wave velocity. |
References components_are_cardinal, components_are_orthogonal, mspass::seismic::BasicTimeSeries::dead(), mspass::seismic::SlownessVector::mag(), mspass::utility::SphericalCoordinate::phi, mspass::utility::SphericalCoordinate::radius, rotate(), mspass::utility::dmatrix::size(), mspass::utility::SphericalCoordinate::theta, transform(), u, mspass::seismic::SlownessVector::ux, and mspass::seismic::SlownessVector::uy.
|
inline |
Return current transformation matrix.
The transformation matrix is maintained internally in this object. Transformations like rotations and the transform method can change make this matrix not an identity matrix. It should always be an identity matrix when the coordinates are cardinal (i.e. ENZ).
References tmatrix.
CoreSeismogram & mspass::seismic::CoreSeismogram::operator*= | ( | const double | scale | ) |
Multiply data by a scalar.
References mspass::seismic::BasicTimeSeries::dead(), mspass::seismic::BasicTimeSeries::npts(), and u.
const CoreSeismogram mspass::seismic::CoreSeismogram::operator+ | ( | const CoreSeismogram & | other | ) | const |
Addition operator.
This operator is implemented in a standard way utilizing operator+=. For data with irregular start and end times that has an important consequence; the operator is not communative. i.e given x an y z=x+y will not yield the same result as z=y+x.
CoreSeismogram & mspass::seismic::CoreSeismogram::operator+= | ( | const CoreSeismogram & | d | ) |
Summation operator.
Summing data from signals of irregular length requires handling potential mismatches in size and overlap. This behaves the way a += operator should logically behave in that situation. That is, because the lhs is where the sum is being accumulated, the size is always controlled by the left hand side of the operator. Any portions of the right hand side that are outside the t0 to endtime() of the left hand side are silently discarded. If the start time of the right hand side is greater than t0 or the endtime is less than endtime of the lhs there will be discontinuties in the sum there the ends of the rhs are inside the range of the lhs.
d | is other signal to add to this. |
MsPASSError | can be thrown if lhs and rhs do not have matching time standards. |
References mspass::seismic::BasicTimeSeries::dead(), endtime(), mspass::seismic::BasicTimeSeries::mt0, mspass::seismic::BasicTimeSeries::npts(), mspass::seismic::BasicTimeSeries::sample_number(), mspass::seismic::BasicTimeSeries::t0(), mspass::seismic::BasicTimeSeries::tref, and u.
const CoreSeismogram mspass::seismic::CoreSeismogram::operator- | ( | const CoreSeismogram & | other | ) | const |
Subtraction operator.
This operator is implemented in a standard way utilizing operator-=. For data with irregular start and end times that has an important consequence; the operator is not communative. i.e given x an y z=x-y will not yield the same result as z=-(y-x).
CoreSeismogram & mspass::seismic::CoreSeismogram::operator-= | ( | const CoreSeismogram & | d | ) |
Subtraction operator.
Differencing data from signals of irregular length requires handling potential mismatches in size and overlap. This behaves the way a -= operator should logically behave in that situation. That is, because the lhs is where the sum is being accumulated, the size is always controlled by the left hand side of the operator. Any portions of the right hand side that are outside the t0 to endtime() of the left hand side are silently discarded. If the start time of the right hand side is greater than t0 or the endtime is less than endtime of the lhs there will be discontinuties in the sum there the ends of the rhs are inside the range of the lhs.
d | is other signal to subract from this. |
MsPASSError | can be thrown if lhs and rhs do not have matching time standards. |
References endtime(), mspass::seismic::BasicTimeSeries::mlive, mspass::seismic::BasicTimeSeries::mt0, mspass::seismic::BasicTimeSeries::npts(), mspass::seismic::BasicTimeSeries::sample_number(), mspass::seismic::BasicTimeSeries::t0(), mspass::seismic::BasicTimeSeries::tref, and u.
CoreSeismogram & mspass::seismic::CoreSeismogram::operator= | ( | const CoreSeismogram & | seisin | ) |
Standard assignment operator.
References components_are_cardinal, components_are_orthogonal, mspass::seismic::BasicTimeSeries::operator=(), mspass::utility::Metadata::operator=(), tmatrix, and u.
vector< double > mspass::seismic::CoreSeismogram::operator[] | ( | const double | time | ) | const |
Overloaded version of operator[] for time.
Sometimes it is useful to ask for data at a specified time without worrying about the time conversion. This simplifies that process. It is still subject to an exception if the the time requested is outside the data range.
time | is the time of the requested sample |
MsPASSError | will be thrown if the time is outside the data range. |
References mspass::seismic::BasicTimeSeries::sample_number().
vector< double > mspass::seismic::CoreSeismogram::operator[] | ( | const int | sample | ) | const |
Extract a sample from data vector.
A sample in this context means a three-vector at a requested sample index. Range checking is implicit because of the internal use of the dmatrix to store the samples of data. This operator is an alternative to extracting samples through indexing of the internal dmatrix u that holds the data.
sample | is the sample number requested (must be in range or an exception will be thrown) |
MsPASSError | if the requested sample is outside the range of the data. Note this includes an implicit "outside" defined when the contents are marked dead. Note the code does this by catching an error thrown by dmatrix in this situation, printing the error message from the dmatrix object, and then throwing a new SeisppError with a shorter message. |
sample | is the integer sample number of data desired. |
|
inline |
void mspass::seismic::CoreSeismogram::rotate | ( | const double | nu[3] | ) |
Rotate data using a P wave type coordinate definition.
In seismology the longitudinal motion direction of a P wave defines a direction in space. This method rotates the data into a coordinate system defined by a direction passed through the argument. The data are rotated such that x1 becomes the transverse component, x2 becomes radial, and x3 becomes longitudinal. In the special case for a vector pointing in the x3 direction the data are not altered.
This method effectively turns nu into a SphericalCoordinate object and calles the related rotate method that has a SphericalCoordinate object as an argument. The potential confusion of orientation is not as extreme here. After the transformation x3prime will point in the direction of nu, x2 will be in the x3-x3prime plane (rotation by theta) and orthogonal to x3prime, and x1 will be horizontal and perpendicular to x2prime and x3prime.
A VERY IMPORTANT thing to recognize about this tranformation is it will always yield a result relative to cardinal coordinates. i.e. if the data had been previously rotated or were not originally in ENZ form they will be first transformed to ENZ before actually performing this transformation. Use the transform or horizontal rotation method to
nu | defines direction of x3 direction (longitudinal) as a unit vector with three components. |
References rotate(), mspass::utility::dmatrix::size(), and u.
void mspass::seismic::CoreSeismogram::rotate | ( | const double | phi | ) |
Rotate horizontals by a simple angle in degrees.
A common transformation in 3C processing is a rotation of the horizontal components by an angle. This leaves the vertical (assumed here x3) unaltered. This routine rotates the horizontals by angle phi using with positive phi counterclockwise as in polar coordinates and the azimuth angle of spherical coordinates. Note this transformation is cummulative. i.e. this transformation is cumulative. The internal transformation matrix will be updated. This is a useful feature for things like incremental horizontal rotation in rotational angle grid searches. \param phi rotation angle around x3 axis in counterclockwise direction (in radians).
References components_are_cardinal, mspass::seismic::BasicTimeSeries::dead(), mspass::seismic::BasicTimeSeries::nsamp, mspass::utility::dmatrix::size(), tmatrix, and u.
void mspass::seismic::CoreSeismogram::rotate | ( | mspass::utility::SphericalCoordinate & | sc | ) |
Rotate data using a P wave type coordinate definition.
In seismology the longitudinal motion direction of a P wave defines a direction in space. This method rotates the data into a coordinate system defined by a direction passed through the argument. The data are rotated such that x1 becomes the transverse component, x2 becomes radial, and x3 becomes longitudinal. In the special case for a vector pointing in the x3 direction the data are not altered. The transformation matrix is effectively the matrix product of two coordinate rotations: (1) rotation around x3 by angle phi and (2) rotation around x1 by theta.
The sense of this transformation is confusing because of a difference in convention between spherical coordinates and standard earth coordinates. In particular, orientation on the earth uses a convention with x2 being the x2 axis and bearings are relative to that with a standard azimuth measured clockwise from north. Spherical coordinate angle phi (used here) is measured counterclockwise relative to the x1 axis, which is east in standard earth coordinates. This transformation is computed using a phi angle. To use this then to compute a transformation to standard ray coordinates with x2 pointing in the direction of wavefront advance, phi should be set to pi/2-azimuth which gives the phi angle needed to rotate x2 to radial. This is extremely confusing because in spherical coordinates it would be more intuitive to rotate x1 to radial, but this is NOT the convention used here. In general to use this feature the best way to avoid this confusion is to use the PMHalfSpaceModel procedure to compute a SphericalCoordinate object consistent with given propagation direction defined by a slowness vector. Alternatively, use the free_surface_transformation method defined below.
A VERY IMPORTANT thing to recognize about this tranformation is it will always yield a result relative to cardinal coordinates. i.e. if the data had been previously rotated or were not originally in ENZ form they will be first transformed to ENZ before actually performing this transformation. Use the transform or horizontal rotation method to create cummulative transformations.
sc | defines final x3 direction (longitudinal) in a spherical coordinate structure. |
References components_are_cardinal, mspass::seismic::BasicTimeSeries::dead(), mspass::seismic::BasicTimeSeries::nsamp, mspass::utility::SphericalCoordinate::phi, rotate_to_standard(), mspass::utility::dmatrix::size(), mspass::utility::SphericalCoordinate::theta, tmatrix, and u.
void mspass::seismic::CoreSeismogram::rotate_to_standard | ( | ) |
Apply inverse transformation matrix to return data to cardinal direction components.
It is frequently necessary to make certain a set of three component data are oriented to the standard reference frame (EW, NS, Vertical). This function does this. For efficiency it checks the components_are_cardinal variable and does nothing if it is set true. Otherwise, it applies the inverse transformation and then sets this variable true. Note even if the current transformation matrix is not orthogonal it will be put back into cardinal coordinates.
SeisppError | thrown if the an inversion of the transformation matrix is required and that matrix is singular. This can happen if the transformation matrix is incorrectly defined or the actual data are coplanar. |
References components_are_cardinal, components_are_orthogonal, mspass::seismic::BasicTimeSeries::nsamp, mspass::utility::dmatrix::size(), tmatrix, and u.
|
virtual |
Set the sample interval.
This method is complicated by the need to sync the changed value with Metadata. That is further complicated by the need to support aliases for the keys used to defined dt in Metadata. That is handled by first setting the internal dt value and then going through a fixed list of valid alias keys for dt. Any that exist are changed. If none were previously defined the unique name (see documentation) is added to Metadata.
sample_interval | is the new data sample interval to be used. |
Reimplemented from mspass::seismic::BasicTimeSeries.
References mspass::utility::Metadata::is_defined(), mspass::seismic::SEISMICMD_dt(), and mspass::seismic::BasicTimeSeries::set_dt().
|
virtual |
Set the number of samples attribute for data.
This method is complicated by the need to sync the changed value with Metadata. That is further complicated by the need to support aliases for the keys used to defined npts in Metadata. That is handled by first setting the internal npts value (actually ns) and then going through a fixed list of valid alias keys for npts. Any that exist are changed. If none were previously defined the unique name (see documentation) is added to Metadata.
This attribute has an additional complication compared to other setter that are overrides from BasicTimeSeries. That is, the number of points define the data buffer size to hold the sample data. To guarantee the buffer size and the internal remain consistent this method clears any existing content of the dmatrix u and initializes the 3xnpts matrix to 0s. Note this means if one is using this to assemble a data object in pieces you MUST call this method before loading any data or it will be cleared and you will mysteriously find the data are all zeros.
npts | is the new number of points to set. |
Reimplemented from mspass::seismic::BasicTimeSeries.
References mspass::utility::Metadata::is_defined(), mspass::seismic::BasicTimeSeries::npts(), mspass::seismic::SEISMICMD_npts(), mspass::seismic::BasicTimeSeries::set_npts(), u, and mspass::utility::dmatrix::zero().
|
virtual |
Set the data start time.
This method is complicated by the need to sync the changed value with Metadata. That is further complicated by the need to support aliases for the keys used to defined npts in Metadata. That is handled by first setting the internal t0 value and then going through a fixed list of valid alias keys for it. Any that exist are changed. If none were previously defined the unique name (see documentation) is added to Metadata.
This is a dangerous method to use on real data as it can mess up the time if not handled correctly. It should be used only when that sharp knife is needed such as in assembling data outside of constructors in a test program.
t0in | is the new data sample interval to be used. |
Reimplemented from mspass::seismic::BasicTimeSeries.
References mspass::utility::Metadata::is_defined(), mspass::seismic::SEISMICMD_t0(), and mspass::seismic::BasicTimeSeries::set_t0().
bool mspass::seismic::CoreSeismogram::set_transformation_matrix | ( | const double | a[3][3] | ) |
Define the transformaton matrix with a C style 3x3 matrix.
a | is a C style 3x3 matrix. |
Will | throw a MsPASSError if the input matrix is not 3x3. |
References cardinal(), components_are_cardinal, components_are_orthogonal, mspass::seismic::SEISMICMD_tmatrix(), and tmatrix.
bool mspass::seismic::CoreSeismogram::set_transformation_matrix | ( | const mspass::utility::dmatrix & | A | ) |
Define the transformaton matrix.
Occasionally we need to set the transformation matrix manually. The type example is input with a format where the component directions are embedded. We use a dmatrix as it is more easily wrapped for python than the raw C 2D array which really doesn't translate well between the languages.
A | is the 3X3 matrix copied to the internal transformation matrix array. |
Will | throw a MsPASSError if the input matrix is not 3x3. |
References cardinal(), components_are_cardinal, components_are_orthogonal, mspass::seismic::SEISMICMD_tmatrix(), and tmatrix.
bool mspass::seismic::CoreSeismogram::set_transformation_matrix | ( | pybind11::object | a | ) |
Define the transformaton matrix with a python object.
a | is a python object of 9 elements with types of dmatrix, numpy array, or list. |
Will | throw a MsPASSError if the input type or dimension is not recognized. |
void mspass::seismic::CoreSeismogram::sync_npts | ( | ) |
Sync the number of samples attribute with actual data size.
This method syncs the npts attribute with the actual size of the dmatrix u. It also syncs aliases in the same way as the set_npts method.
References mspass::utility::dmatrix::columns(), mspass::utility::Metadata::is_defined(), mspass::seismic::BasicTimeSeries::nsamp, mspass::seismic::SEISMICMD_npts(), mspass::seismic::BasicTimeSeries::set_npts(), and u.
void mspass::seismic::CoreSeismogram::transform | ( | const double | a[3][3] | ) |
Applies an arbitrary transformation matrix to the data. i.e. after calling this method the data will have been multiplied by the matrix a and the transformation matrix will be updated. The later allows cascaded transformations to data.
a | is a C style 3x3 matrix. |
References components_are_cardinal, components_are_orthogonal, mspass::seismic::BasicTimeSeries::dead(), mspass::seismic::BasicTimeSeries::nsamp, mspass::utility::dmatrix::size(), tmatrix, and u.
|
protected |
Defines of the contents of the object are in Earth cardinal coordinates.
Cardinal means the cardinal directions at a point on the earth. That is, x1 is positive east, x2 is positive north, and x3 is positive up. Like the components_are_orthogonal variable the purpose of this variable is to simplify common tests for properties of a given data series.
|
protected |
Defines if the contents of this object are components of an orthogonal basis.
Most raw 3c seismic data use orthogonal components, but this is not universal. Furthermore, some transformations (e.g. the free surface transformation operator) define transformations to basis sets that are not orthogonal. Because detecting orthogonality from a transformation is a nontrivial thing (rounding error is the complication) this is made a part of the object to simplify a number of algorithms.
|
protected |
Transformation matrix.
This is a 3x3 transformation that defines how the data in this object is produced from cardinal coordinates. That is, if u is the contents of this object the data in cardinal directions can be produced by tmatrix^-1 * u.
mspass::utility::dmatrix mspass::seismic::CoreSeismogram::u |
Holds the actual data.
Matrix is 3xns. Thus the rows are the component number and columns define time position. Note there is a redundancy in these definitions that must be watched if you manipulate the contents of this matrix. That is, BasicTimeSeries defines ns, but the u matrix has it's own internal size definitions. Currently no tests are done to validate this consistency. All constructors handle this, but again because u is public be very careful in altering u.