neic-glass3  1.4.6
Public Member Functions | List of all members
glasscore::CSite Class Reference

glasscore site (station) class More...

#include <Site.h>

Collaboration diagram for glasscore::CSite:
Collaboration graph

Public Member Functions

 CSite ()
 CSite default constructor. More...
 
 CSite (std::string sta, std::string comp, std::string net, std::string loc, double lat, double lon, double elv, double qual, bool enable, bool useTele)
 CSite advanced constructor. More...
 
 CSite (std::shared_ptr< json::Object > site)
 CSite advanced constructor. More...
 
 ~CSite ()
 CSite destructor. More...
 
void clear ()
 CSite clear function. More...
 
void update (CSite *site)
 CSite update function. More...
 
bool initialize (std::string sta, std::string comp, std::string net, std::string loc, double lat, double lon, double elv, double qual, bool enable, bool use, bool useTele)
 CSite initialization function. More...
 
void setLocation (double lat, double lon, double z)
 Set the site's location This function sets the geographic location of the site to the provided latitude, longitude, and depth. More...
 
double getDelta (glass3::util::Geo *geo2)
 Get the distance to the site This function calculates the distance between this site and the given geographic location in radians. More...
 
double getDistance (std::shared_ptr< CSite > site)
 Get the distance between this site and another in km. More...
 
void addPick (std::shared_ptr< CPick > pck)
 Add pick to this site This function adds the given pick to the list of picks made at this site. More...
 
void removePick (std::shared_ptr< CPick > pck)
 Remove pick from this site This function removes the given pick from the list of picks made at this site. More...
 
std::vector< std::shared_ptr< CPick > > getPicks (double t1, double t2)
 Get a vector of picks that fall within a time window. More...
 
void addNode (std::shared_ptr< CNode > node, double distDeg, double travelTime1, std::string phase1, double travelTime2=-1, std::string phase2="")
 Add node to this site This function adds the given pick to the list of nodes serviced by this site. More...
 
void removeNode (std::string nodeID)
 Remove pick from this site This function removes the given node from the list of nodes linked to this. More...
 
std::vector< std::shared_ptr< CTrigger > > nucleate (double tpick, CPickList *parentThread)
 Try to nucleate a new event at nodes linked to site This function cycles through each node linked to this site, computes the PDF at each node, and identifies the node with the best PDF. More...
 
void addTriggerToList (std::vector< std::shared_ptr< CTrigger >> *vTrigger, std::shared_ptr< CTrigger > trigger)
 Add triggering node to triggered node list if value exceeds current value of if named node's web is not yet present. More...
 
int getNodeLinksCount () const
 Gets the number of nodes linked to this site. More...
 
bool getEnable () const
 Gets whether this site is enabled. Enable represents whether this site should be used according to sources outside glasscore. More...
 
void setEnable (bool enable)
 Sets whether this site is enabled. Enable represents whether this site should be used according to sources outside glasscore. More...
 
bool getIsUsed () const
 Gets whether this site should be used for picks and nucleation. (m_bUse && m_bEnable) Use represents whether the site should be used according to glasscore's internal metrics. More...
 
bool getUse () const
 Gets whether this site is used. More...
 
void setUse (bool use)
 Sets whether this site should be used for picks and nucleation. Use represents whether the site should be used according to glasscore's internal metrics. More...
 
bool getUseForTeleseismic () const
 Gets whether this site should be used for nucleation web generation where UseOnlyTeleseismicStations is set for a web. More...
 
void setUseForTeleseismic (bool useForTele)
 Sets whether this site should be used for nucleation web generation where UseOnlyTeleseismicStations is set for a web. More...
 
double getQuality () const
 Get the station quality metric. More...
 
void setQuality (double qual)
 Set the station quality metric. More...
 
double getRawLatitude () const
 Get the station raw latitude. More...
 
double getRawLongitude () const
 Get the station raw longitude. More...
 
double getRawElevation () const
 Get the station raw elevation. More...
 
glass3::util::GeogetGeo ()
 Get the combined site location (latitude, longitude, elevation) as a CGeo object. More...
 
const std::string & getSCNL () const
 Get the SCNL identifier for this site. More...
 
const std::string & getSite () const
 Get the Site (station) name for this site. More...
 
const std::string & getComponent () const
 Get the component code for this site. More...
 
const std::string & getNetwork () const
 Get the network code for this site. More...
 
const std::string & getLocation () const
 Get the location code for this site. More...
 
time_t getTLastPickAdded () const
 Get the time the last pick was added to this site. More...
 
double * getUnitVectors (double *vec)
 Get the location unit vectors. More...
 
int getPickCountSinceCheck () const
 Get the count of picks added to this site since the last check. More...
 
void setPickCountSinceCheck (int count)
 Set the count of picks added to this site since the last check. More...
 
int getPickCount () const
 Gets the number of picks made at this site. More...
 
std::multiset< std::shared_ptr< CPick >, SitePickCompare >::iterator getLower (double min)
 Gets the lower bound of the pick multiset at the provided time. More...
 
std::multiset< std::shared_ptr< CPick >, SitePickCompare >::iterator getUpper (double max)
 Gets the upper bound of the pick multiset at the provided time. More...
 
std::multiset< std::shared_ptr< CPick >, SitePickCompare >::iterator getEnd ()
 Gets the end iterator of the pick multiset. More...
 
std::mutex & getPickMutex ()
 Gets pick multiset mutex. More...
 
void updatePosition (std::shared_ptr< CPick > pick)
 A PickList function that updates the position of the given pick in the multiset. More...
 

Detailed Description

glasscore site (station) class

The CSite class is the class that encapsulates everything necessary to represent a seismic station (site), including geographic location identifier (SCNL), and use/nouse flag. The CSite class is also a node in the detection graph database.

CSite maintains graph database links between it and one or more detection nodes

CSite maintains a list of picks made at the site

CSite contains function to support nucleation of a new event based on a potential origin time and each of the detection nodes linked to the site.

CPick also maintains a vector of CHypo objects represent the graph database links between this pick and various hypocenters. A single pick may be linked to multiple hypocenters

CSite uses smart pointers (std::shared_ptr).

Constructor & Destructor Documentation

glasscore::CSite::CSite ( )

CSite default constructor.

The default constructor for the CSite class. Initializes members to default values.

glasscore::CSite::CSite ( std::string  sta,
std::string  comp,
std::string  net,
std::string  loc,
double  lat,
double  lon,
double  elv,
double  qual,
bool  enable,
bool  useTele 
)

CSite advanced constructor.

An advanced constructor for the CSite class. This function initializes members to the provided SCNL, Lat/Lon/elv, qual, and use-flags values

Parameters
sta- A string containing the station name for this site.
comp- A string containing the component code for this site.
net- A string containing the network code for this site.
loc- A string containing the location code for this site.
lat- A double value containing the geographic latitude of this site in degrees
lon- A double value containing the geographic longitude of this site in degrees
elv- A double value containing the geographic elevation of this site in meters
qual- A double value containing a station quality estimate
enable- A boolean flag indicating whether the site is to be enabled or not
useTele- A boolean flag indicating whether the site is to be used for teleseismic or not
glasscore::CSite::CSite ( std::shared_ptr< json::Object >  site)
explicit

CSite advanced constructor.

An advanced constructor for the CSite class. This function initializing members to the values parsed from the provided json object.

Parameters
site- A shared_ptr to a json::Object to construct the site from
glasscore::CSite::~CSite ( )

CSite destructor.

Member Function Documentation

void glasscore::CSite::addNode ( std::shared_ptr< CNode node,
double  distDeg,
double  travelTime1,
std::string  phase1,
double  travelTime2 = -1,
std::string  phase2 = "" 
)

Add node to this site This function adds the given pick to the list of nodes serviced by this site.

Parameters
node- A shared_ptr to a CNode object containing the node to add
distDeg- A double value containing the distance between the node and this site in degrees
travelTime1- A double value containing the first travel time to use
phase1- A std::string containing the first travel time phase code
travelTime2- A double value containing the optional second travel
phase2- A std::string containing the second travel time phase code, defaults to "" (no travel time) time to use for the link, defaults to -1 (no travel time)
void glasscore::CSite::addPick ( std::shared_ptr< CPick pck)

Add pick to this site This function adds the given pick to the list of picks made at this site.

Parameters
pck- A shared_ptr to a CPick object containing the pick to add
void glasscore::CSite::addTriggerToList ( std::vector< std::shared_ptr< CTrigger >> *  vTrigger,
std::shared_ptr< CTrigger trigger 
)

Add triggering node to triggered node list if value exceeds current value of if named node's web is not yet present.

Parameters
vTrigger- a pointer to a vector of shared_ptr's containing the current list of triggers
trigger- a shared_ptr to the new CTrigger to add to the list
void glasscore::CSite::clear ( )

CSite clear function.

const std::string & glasscore::CSite::getComponent ( ) const

Get the component code for this site.

Returns
Returns a std::string containing the component code for this site
double glasscore::CSite::getDelta ( glass3::util::Geo geo2)

Get the distance to the site This function calculates the distance between this site and the given geographic location in radians.

Parameters
geo2- A pointer to a CGeo object containing the geographic location
Returns
Returns a double value containing the distance in radians
double glasscore::CSite::getDistance ( std::shared_ptr< CSite site)

Get the distance between this site and another in km.

Parameters
site- A pointer to another site
Returns
Returns a double value containing the distance in km
bool glasscore::CSite::getEnable ( ) const

Gets whether this site is enabled. Enable represents whether this site should be used according to sources outside glasscore.

Returns
Returns a boolean flag indicating whether the site is enabled, true if enabled, false otherwise
std::multiset< std::shared_ptr< CPick >, SitePickCompare >::iterator glasscore::CSite::getEnd ( )

Gets the end iterator of the pick multiset.

Returns
Returns an interator pointing to end of the multiset i.e. end()
glass3::util::Geo & glasscore::CSite::getGeo ( )

Get the combined site location (latitude, longitude, elevation) as a CGeo object.

Returns
Returns a glass3::util::Geo object containing the combined location.
bool glasscore::CSite::getIsUsed ( ) const

Gets whether this site should be used for picks and nucleation. (m_bUse && m_bEnable) Use represents whether the site should be used according to glasscore's internal metrics.

Returns
Returns a boolean flag indicating whether the site should be used, true if yes, false otherwise
const std::string & glasscore::CSite::getLocation ( ) const

Get the location code for this site.

Returns
Returns a std::string containing the location code for this site
std::multiset< std::shared_ptr< CPick >, SitePickCompare >::iterator glasscore::CSite::getLower ( double  min)

Gets the lower bound of the pick multiset at the provided time.

Parameters
min- a double value containing the desired time to generate the lower value at in Gregorian seconds
Returns
Returns an interator pointing to the first pick in the multiset greater than the provided time
const std::string & glasscore::CSite::getNetwork ( ) const

Get the network code for this site.

Returns
Returns a std::string containing the network code for this site
int glasscore::CSite::getNodeLinksCount ( ) const

Gets the number of nodes linked to this site.

Returns
Returns an integer containing the number of nodes linked to this site
int glasscore::CSite::getPickCount ( ) const

Gets the number of picks made at this site.

Returns
Returns an integer containing the number of picks made at this site
int glasscore::CSite::getPickCountSinceCheck ( ) const

Get the count of picks added to this site since the last check.

Returns
Returns an integer containing the count of picks added to this site since the last check
std::mutex & glasscore::CSite::getPickMutex ( )

Gets pick multiset mutex.

Returns
Returns the std::mutex protecting the pick multiset
std::vector< std::shared_ptr< CPick > > glasscore::CSite::getPicks ( double  t1,
double  t2 
)

Get a vector of picks that fall within a time window.

Get a vector of picks that fall within the provided time window from t1 to t2

Parameters
t1- A double value containing the beginning of the time window in Gregorian seconds
t2- A double value containing the end of the time window in Gregorian seconds
Returns
Return a std::vector of std::weak_ptrs to the picks within the time window
double glasscore::CSite::getQuality ( ) const

Get the station quality metric.

Returns
Returns a double value containing the station quality metric
double glasscore::CSite::getRawElevation ( ) const

Get the station raw elevation.

Returns
Returns a double value containing the raw (original) elevation for the station
double glasscore::CSite::getRawLatitude ( ) const

Get the station raw latitude.

Returns
Returns a double value containing the raw (original) latitude for the station
double glasscore::CSite::getRawLongitude ( ) const

Get the station raw longitude.

Returns
Returns a double value containing the raw (original) longitude for the station
const std::string & glasscore::CSite::getSCNL ( ) const

Get the SCNL identifier for this site.

Returns
Returns a std::string containing the SCNL identifier for this site
const std::string & glasscore::CSite::getSite ( ) const

Get the Site (station) name for this site.

Returns
Returns a std::string containing the station name for this site
time_t glasscore::CSite::getTLastPickAdded ( ) const

Get the time the last pick was added to this site.

Returns
Returns a time_t containing the time that the last pick was added to this site in epoch seconds
double * glasscore::CSite::getUnitVectors ( double *  vec)

Get the location unit vectors.

Returns
Returns a double pointer containing the location unit vectors in Cartesian earth coordinates
std::multiset< std::shared_ptr< CPick >, SitePickCompare >::iterator glasscore::CSite::getUpper ( double  max)

Gets the upper bound of the pick multiset at the provided time.

Parameters
max- a double value containing the desired time to generate the upper value at in Gregorian seconds
Returns
Returns an interator pointing to the first pick in the multiset less than the provided time
bool glasscore::CSite::getUse ( ) const

Gets whether this site is used.

Returns
Returns a boolean flag indicating whether the site is used, true if so, false otherwise
bool glasscore::CSite::getUseForTeleseismic ( ) const

Gets whether this site should be used for nucleation web generation where UseOnlyTeleseismicStations is set for a web.

Returns
Returns a boolean flag indicating whether the site is used for nucleation web generation, true if enabled, false otherwise
bool glasscore::CSite::initialize ( std::string  sta,
std::string  comp,
std::string  net,
std::string  loc,
double  lat,
double  lon,
double  elv,
double  qual,
bool  enable,
bool  use,
bool  useTele 
)

CSite initialization function.

Initializes site class to provided values.

Parameters
sta- A string containing the station code for this site.
comp- A string containing the component code for this site.
net- A string containing the network code for this site.
loc- A string containing the location code for this site.
lat- A double value containing the geographic latitude of this site in degrees
lon- A double value containing the geographic longitude of this site in degrees
elv- A double value containing the geographic elevation of this site in meters
qual- A double value containing a station quality estimate
enable- A boolean flag indicating whether the site is to be enabled or not
use- A boolean flag indicating whether the site is to be used (internally) or not
useTele- A boolean flag indicating whether the site is to be used for teleseismic or not
Returns
Returns true if successful, false otherwise
std::vector< std::shared_ptr< CTrigger > > glasscore::CSite::nucleate ( double  tpick,
CPickList parentThread 
)

Try to nucleate a new event at nodes linked to site This function cycles through each node linked to this site, computes the PDF at each node, and identifies the node with the best PDF.

The function uses addTrigger to keep track of triggering nodes

Parameters
tpick- A double value containing the pick time to nucleate with in Gregorian seconds
parentThread- A pointer to the parent CPickList thread to allow nucleate to call the CPickList thread status update function, the owner of this pointer is the CPickList object
Returns
Returns a vector of shared_ptrs to the CTriggers generated by nucleate.
void glasscore::CSite::removeNode ( std::string  nodeID)

Remove pick from this site This function removes the given node from the list of nodes linked to this.

Parameters
nodeID- A string with the id of the node to remove
void glasscore::CSite::removePick ( std::shared_ptr< CPick pck)

Remove pick from this site This function removes the given pick from the list of picks made at this site.

Parameters
pck- A shared_ptr to a CPick object containing the pick to remove
void glasscore::CSite::setEnable ( bool  enable)

Sets whether this site is enabled. Enable represents whether this site should be used according to sources outside glasscore.

Parameters
enable- A boolean flag indicating whether the site is enabled, true if enabled, false otherwise
void glasscore::CSite::setLocation ( double  lat,
double  lon,
double  z 
)

Set the site's location This function sets the geographic location of the site to the provided latitude, longitude, and depth.

Parameters
lat- A double value containing the latitude in degrees to use.
lon- A double value containing the longitude in degrees to use.
z- A double value containing the surface depth in km to use.
void glasscore::CSite::setPickCountSinceCheck ( int  count)

Set the count of picks added to this site since the last check.

Parameters
count- an integer containing the count of picks added to this site since the last check
void glasscore::CSite::setQuality ( double  qual)

Set the station quality metric.

Parameters
qual- a double value containing the station quality metric
void glasscore::CSite::setUse ( bool  use)

Sets whether this site should be used for picks and nucleation. Use represents whether the site should be used according to glasscore's internal metrics.

Parameters
use- a boolean flag indicating whether the site is used, true if enabled, false otherwise
void glasscore::CSite::setUseForTeleseismic ( bool  useForTele)

Sets whether this site should be used for nucleation web generation where UseOnlyTeleseismicStations is set for a web.

Parameters
useForTele- a boolean flag indicating whether the site is used for nucleation web generation, true if enabled, false otherwiseg
void glasscore::CSite::update ( CSite site)

CSite update function.

This function updates the CSite with the data contained in the provided CSite, while not modifying the data list

Parameters
site- A pointer to a CSite object containing the site to update from.
void glasscore::CSite::updatePosition ( std::shared_ptr< CPick pick)

A PickList function that updates the position of the given pick in the multiset.

Parameters
pick- A shared_ptr to the pick that needs a position update

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