SLBM: slbm::Uncertainty Class Reference

SLBM 3.0 Regional Seismic Travel Time

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
slbm::Uncertainty Class Reference

A Uncertainty object contains the raw data to calculate a modeling error in seconds as a function of distance in radians. More...

`#include <Uncertainty.h>`

## Public Member Functions
| Uncertainty ()
| Default constructor. More...
| Uncertainty (const int &phase, const int &attribute)
| Parameterized constructor that loads model error from a specified file. More...
| Uncertainty (const string &phase, const string &attribute)
| Parameterized constructor that loads model error from a specified file. More...
| Uncertainty (string modelPath, const string &phase, int phasenum)
| Uncertainty (string modelPath, const int &phase, const int &attribute)
| Parameterized constructor that loads model error from a specified file. More...
| Uncertainty (util::DataBuffer &buffer)
| Parameterized constructor that loads uncertainty data from the input DataBuffer. More...
| Uncertainty (const Uncertainty &u)
| Copy constructor. More...
| ~Uncertainty ()
| Destructor. More...
Uncertainty & | operator= (const Uncertainty &u)
| Assignment operator. More...
bool | operator== (const Uncertainty &other)
bool | operator!= (const Uncertainty &other)
void | readFile (ifstream &fin)
void | readFile (geotess::IFStreamAscii &fin)
void | readFile (geotess::IFStreamBinary &fin)
void | writeFile (geotess::IFStreamBinary &fout)
int | getPhase ()
| A public convenience accessor used to verify the error data for the correct model phase is loaded in memory. More...
string | getPhaseStr ()
| A public convenience accessor used to verify the error data for the correct model phase is loaded in memory. More...
int | getAttribute ()
| A public convenience accessor used to verify the error data for the correct model phase is loaded in memory. More...
string | getAttributeStr ()
| A public convenience accessor used to verify the error data for the correct model phase is loaded in memory. More...
double | getUncertainty (const double &distance, double depth=0.0)
| Returns the model uncertainty as a function of angular distance (radians) and depth. More...
double | getVariance (const double &distance, double depth=0.0)
| Returns the model variance as a function of angular distance (radians) and depth. More...
vector< double > & | getDistances ()
| A vector of doubles representing the angular distances (in degrees) More...
vector< double > & | getDepths ()
| A vector of doubles representing the depths. More...
vector< vector< double > > & | getValues ()
| A vector of doubles representing the model errors (in seconds) More...
void | writeFile (const string &directoryName)
string | toStringTable ()
string | toStringFile ()
int | getBufferSize ()
| Returns the model uncertainty DataBuffer size storage requirement. More...
void | serialize (util::DataBuffer &buffer)
| Writes the uncertainty object into the input DataBuffer. More...
void | deserialize (util::DataBuffer &buffer)
| Reads the uncertainty object from the input DataBuffer. More...

## Static Public Member Functions
static Uncertainty * | getUncertainty (ifstream &input, const int &phase, const int &attribute)
static Uncertainty * | getUncertainty (ifstream &input, const string &phase, const string &attribute)
static Uncertainty * | getUncertainty (geotess::IFStreamAscii &input, const int &phase, const int &attribute)
static Uncertainty * | getUncertainty (geotess::IFStreamAscii &input, const string &phase, const string &attribute)
static Uncertainty * | getUncertainty (geotess::IFStreamBinary &input, const int &phase, const int &attribute)
static Uncertainty * | getUncertainty (geotess::IFStreamBinary &input, const string &phase, const string &attribute)
static Uncertainty * | getUncertainty (util::DataBuffer &input, const int &phase, const int &attribute)
static Uncertainty * | getUncertainty (util::DataBuffer &input, const string &phase, const string &attribute)
static Uncertainty * | getUncertainty (const string &directoryName, const int &phase, const int &attribute)
static string | getPhase (const int &phaseIndex)
static string | getAttribute (const int &attributeIndex)
static int | getPhase (const string &phase)
static int | getAttribute (const string &attribute)

## Private Member Functions
double | getUncertainty (double f, int idist, int idepth)
| Returns the distance interpolated uncertainty at depth, idepth, and fraction f between distance indices idist and idist+1. More...
double | getVariance (double f, int idist, int idepth)
| Returns the distance interpolated variance at depth, idepth, and fraction f between distance indices idist and idist+1. More...
void | getIndex (double x, const vector< double > &v, int &index, double &w)
| Private function used to find the bracketing index for performing uncertainty / variance distance interpolation. More...
void | readFile (const string &filename)
| A function called by the constructor to read model error data from an ASCII text file. More...

## Private Attributes
string | fname
| The path and filename for the currently loaded seismic phase modeling error file. More...
int | phaseNum
| The seismic phase for which modeling error data was loaded. More...
int | attributeNum
| The attribute (TT, Sh or Az) for which modeling error data was loaded. More...
vector< double > | errDistances
| A vector of doubles representing the angular distances (in degrees) More...
vector< double > | errDepths
| A vector of doubles representing the depths. More...
vector< vector< double > > | errVal
| A vector of doubles representing the model errors (in seconds) More...

## Detailed Description

A Uncertainty object contains the raw data to calculate a modeling error in seconds as a function of distance in radians.

Code includes functionality to store and compute uncertainty for 2D uncertainty tables (distance and depth). But all the tables included with SLBM versions up to and including version 3.0 do not have any depth information. All uncertainties are a function of distance only. Therefore, functionality to handle 2D uncertainty has not been tested and it is considered unlikely that it will work as currently coded.

## Constructor & Destructor Documentation

slbm::Uncertainty::Uncertainty | ( |  | ) |

Default constructor.

slbm::Uncertainty::Uncertainty | ( | const int & | phase,
|  | const int & | attribute
| ) |  |

Parameterized constructor that loads model error data from a file. Uses an SLBM specific phase ordering index.

slbm::Uncertainty::Uncertainty | ( | const string & | phase,
|  | const string & | attribute
| ) |  |

Parameterized constructor that loads model error data from a file. Uses an SLBM specific phase ordering index.

slbm::Uncertainty::Uncertainty | ( | string | modelPath,
|  | const string & | phase,
|  | int | phasenum
| ) |  |

from a specified file.

Parameterized constructor that loads model error data from a file. Uses the input phase string to find the uncertainty data file and assigns a phase ordering index.

slbm::Uncertainty::Uncertainty | ( | string | modelPath,
|  | const int & | phase,
|  | const int & | attribute
| ) |  |

Parameterized constructor that loads model error data from a file. Uses an SLBM specific phase ordering index.

slbm::Uncertainty::Uncertainty | ( | util::DataBuffer & | buffer | ) |

Parameterized constructor that loads model error data from a file.

slbm::Uncertainty::Uncertainty | ( | const Uncertainty & | u | ) |

Copy constructor.

slbm::Uncertainty::~Uncertainty | ( |  | ) |

Destructor.

## Member Function Documentation

void slbm::Uncertainty::deserialize | ( | util::DataBuffer & | buffer | ) |

Reads the uncertainty object from the input DataBuffer.

int slbm::Uncertainty::getAttribute | ( |  | ) |
| inline

A public convenience accessor used to verify the error data for the correct model phase is loaded in memory.

static string slbm::Uncertainty::getAttribute | ( | const int & | attributeIndex | ) |
| inlinestatic

static int slbm::Uncertainty::getAttribute | ( | const string & | attribute | ) |
| inlinestatic

string slbm::Uncertainty::getAttributeStr | ( |  | ) |
| inline

A public convenience accessor used to verify the error data for the correct model phase is loaded in memory.

int slbm::Uncertainty::getBufferSize | ( |  | ) |

Returns the model uncertainty DataBuffer size storage requirement.

vector<double>& slbm::Uncertainty::getDepths | ( |  | ) |
| inline

A vector of doubles representing the depths

vector<double>& slbm::Uncertainty::getDistances | ( |  | ) |
| inline

A vector of doubles representing the angular distances (in degrees)

void slbm::Uncertainty::getIndex | ( | double | x,
|  | const vector< double > & | v,
|  | int & | index,
|  | double & | w
| ) |  |
| private

Private function used to find the bracketing index for performing uncertainty / variance distance interpolation. The bracketing index is found in vector v such that v[index] <= x <= v[index+1]. The weight w is calculated as w = (x - v[index]) / (v[index+1] - v[index]);

int slbm::Uncertainty::getPhase | ( |  | ) |
| inline

A public convenience accessor used to verify the error data for the correct model phase is loaded in memory.

static string slbm::Uncertainty::getPhase | ( | const int & | phaseIndex | ) |
| inlinestatic

static int slbm::Uncertainty::getPhase | ( | const string & | phase | ) |
| inlinestatic

string slbm::Uncertainty::getPhaseStr | ( |  | ) |
| inline

A public convenience accessor used to verify the error data for the correct model phase is loaded in memory.

static Uncertainty* slbm::Uncertainty::getUncertainty | ( | ifstream & | input,
|  | const int & | phase,
|  | const int & | attribute
| ) |  |
| static

Retrieve a new Uncertainty object for the specified phase and attribute, loaded from specified input source.

Parameters

  input | data source
  phase | 0:Pn, 1:Sn, 2:Pg, 3:Lg
  attribute | 0:TT, 1:SH, 2:AZ

Returns
  pointer to an Uncertainty object. Will return null if the number of distances in the file is zero.

static Uncertainty* slbm::Uncertainty::getUncertainty | ( | ifstream & | input,
|  | const string & | phase,
|  | const string & | attribute
| ) |  |
| static

Retrieve a new Uncertainty object for the specified phase and attribute, loaded from specified input source.

Parameters

  input | data source
  phase | 0:Pn, 1:Sn, 2:Pg, 3:Lg
  attribute | 0:TT, 1:SH, 2:AZ

Returns
  pointer to an Uncertainty object. Will return null if the number of distances in the file is zero.

static Uncertainty* slbm::Uncertainty::getUncertainty | ( | geotess::IFStreamAscii & | input,
|  | const int & | phase,
|  | const int & | attribute
| ) |  |
| static

Retrieve a new Uncertainty object for the specified phase and attribute, loaded from specified input source.

Parameters

  input | data source
  phase | 0:Pn, 1:Sn, 2:Pg, 3:Lg
  attribute | 0:TT, 1:SH, 2:AZ

Returns
  pointer to an Uncertainty object. Will return null if the number of distances in the file is zero.

static Uncertainty* slbm::Uncertainty::getUncertainty | ( | geotess::IFStreamAscii & | input,
|  | const string & | phase,
|  | const string & | attribute
| ) |  |
| static

Retrieve a new Uncertainty object for the specified phase and attribute, loaded from specified input source.

Parameters

  input | data source
  phase | 0:Pn, 1:Sn, 2:Pg, 3:Lg
  attribute | 0:TT, 1:SH, 2:AZ

Returns
  pointer to an Uncertainty object. Will return null if the number of distances in the file is zero.

static Uncertainty* slbm::Uncertainty::getUncertainty | ( | geotess::IFStreamBinary & | input,
|  | const int & | phase,
|  | const int & | attribute
| ) |  |
| static

Retrieve a new Uncertainty object for the specified phase and attribute, loaded from specified input source.

Parameters

  input | data source
  phase | 0:Pn, 1:Sn, 2:Pg, 3:Lg
  attribute | 0:TT, 1:SH, 2:AZ

Returns
  pointer to an Uncertainty object. Will return null if the number of distances in the file is zero.

static Uncertainty* slbm::Uncertainty::getUncertainty | ( | geotess::IFStreamBinary & | input,
|  | const string & | phase,
|  | const string & | attribute
| ) |  |
| static

Retrieve a new Uncertainty object for the specified phase and attribute, loaded from specified input source.

Parameters

  input | data source
  phase | 0:Pn, 1:Sn, 2:Pg, 3:Lg
  attribute | 0:TT, 1:SH, 2:AZ

Returns
  pointer to an Uncertainty object. Will return null if the number of distances in the file is zero.

static Uncertainty* slbm::Uncertainty::getUncertainty | ( | util::DataBuffer & | input,
|  | const int & | phase,
|  | const int & | attribute
| ) |  |
| static

Retrieve a new Uncertainty object for the specified phase and attribute, loaded from specified input source.

Parameters

  input | data source
  phase | 0:Pn, 1:Sn, 2:Pg, 3:Lg
  attribute | 0:TT, 1:SH, 2:AZ

Returns
  pointer to an Uncertainty object. Will return null if the number of distances in the file is zero.

static Uncertainty* slbm::Uncertainty::getUncertainty | ( | util::DataBuffer & | input,
|  | const string & | phase,
|  | const string & | attribute
| ) |  |
| static

Retrieve a new Uncertainty object for the specified phase and attribute, loaded from specified input source.

Parameters

  input | data source
  phase | 0:Pn, 1:Sn, 2:Pg, 3:Lg
  attribute | 0:TT, 1:SH, 2:AZ

Returns
  pointer to an Uncertainty object. Will return null if the number of distances in the file is zero.

static Uncertainty* slbm::Uncertainty::getUncertainty | ( | const string & | directoryName,
|  | const int & | phase,
|  | const int & | attribute
| ) |  |
| static

Retrieve a new Uncertainty object for the specified phase and attribute, loaded from specified input source.

Parameters

  directoryName | data source
  phase | 0:Pn, 1:Sn, 2:Pg, 3:Lg
  attribute | 0:TT, 1:SH, 2:AZ

Returns
  pointer to an Uncertainty object. Will return null if the number of distances in the file is zero.

double slbm::Uncertainty::getUncertainty | ( | const double & | distance,
|  | double | depth = `0.0`
| ) |  |

Returns the model uncertainty as a function of angular distance (radians) and depth. Depth defaults to the surface (0.0).

double slbm::Uncertainty::getUncertainty | ( | double | f,
|  | int | idist,
|  | int | idepth
| ) |  |
| inlineprivate

Retrieve reference count; Add reference count; Remove reference count.

Returns
  the reference count after decrement. Returns true if reference count is zero.Returns the distance interpolated uncertainty at depth, idepth, and fraction f between distance indices idist and idist+1. For f = 0 errVal[idepth][idist] is returned. For f = 1 errVal[idepth][idist+1] is returned

vector<vector<double> >& slbm::Uncertainty::getValues | ( |  | ) |
| inline

A vector of doubles representing the model errors (in seconds)

double slbm::Uncertainty::getVariance | ( | const double & | distance,
|  | double | depth = `0.0`
| ) |  |

Returns the model variance as a function of angular distance (radians) and depth. Depth defaults to the surface (0.0).

double slbm::Uncertainty::getVariance | ( | double | f,
|  | int | idist,
|  | int | idepth
| ) |  |
| inlineprivate

Returns the distance interpolated variance at depth, idepth, and fraction f between distance indices idist and idist+1. For f = 0 errVal[idepth][idist]^2 is returned. For f = 1 errVal[idepth][idist+1]^2 is returned

bool slbm::Uncertainty::operator!= | ( | const Uncertainty & | other | ) |
| inline

Overloaded inequality operator

Parameters

  other | reference to the other Uncertainty object to which this Uncertainty object is to be compared

Returns
  true if this and other are not equal.

Uncertainty& slbm::Uncertainty::operator= | ( | const Uncertainty & | u | ) |

Assignment operator.

bool slbm::Uncertainty::operator== | ( | const Uncertainty & | other | ) |

Overloaded equality operator

Parameters

  other | reference to the other Uncertainty object to which this Uncertainty object is to be compared

Returns
  true if this and other are equal.

void slbm::Uncertainty::readFile | ( | ifstream & | fin | ) |

void slbm::Uncertainty::readFile | ( | geotess::IFStreamAscii & | fin | ) |

void slbm::Uncertainty::readFile | ( | geotess::IFStreamBinary & | fin | ) |

void slbm::Uncertainty::readFile | ( | const string & | filename | ) |
| private

A function called by the constructor to read model error data from an ASCII text file.

void slbm::Uncertainty::serialize | ( | util::DataBuffer & | buffer | ) |

Writes the uncertainty object into the input DataBuffer.

string slbm::Uncertainty::toStringFile | ( |  | ) |

string slbm::Uncertainty::toStringTable | ( |  | ) |

void slbm::Uncertainty::writeFile | ( | geotess::IFStreamBinary & | fout | ) |

void slbm::Uncertainty::writeFile | ( | const string & | directoryName | ) |

## Member Data Documentation

int slbm::Uncertainty::attributeNum
| private

The attribute (TT, Sh or Az) for which modeling error data was loaded.

vector<double> slbm::Uncertainty::errDepths
| private

A vector of doubles representing the depths

vector<double> slbm::Uncertainty::errDistances
| private

A vector of doubles representing the angular distances (in degrees)

vector<vector<double> > slbm::Uncertainty::errVal
| private

A vector of doubles representing the model errors (in seconds)

string slbm::Uncertainty::fname
| private

The path and filename for the currently loaded seismic phase modeling error file.

int slbm::Uncertainty::phaseNum
| private

The seismic phase for which modeling error data was loaded.

The documentation for this class was generated from the following file:

- /nfs/tonto2/devlpool/sballar/RSTT/SLBM_Root.3.0.5/install/SLBM_Root.3.0.5.Linux/SLBM/include/Uncertainty.h