[seiscomp, scanloc] Install, add .gitignore
This commit is contained in:
109
include/seiscomp/seismology/locator/fixed-hypocenter.h
Normal file
109
include/seiscomp/seismology/locator/fixed-hypocenter.h
Normal file
@ -0,0 +1,109 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_SEISMOLOGY_FIXED_HYPOCENTER_H
|
||||
#define SEISCOMP_SEISMOLOGY_FIXED_HYPOCENTER_H
|
||||
|
||||
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
#include <seiscomp/datamodel/origin.h>
|
||||
#include <seiscomp/datamodel/arrival.h>
|
||||
#include <seiscomp/datamodel/pick.h>
|
||||
#include <seiscomp/datamodel/station.h>
|
||||
#include <seiscomp/seismology/locatorinterface.h>
|
||||
#include <seiscomp/seismology/ttt.h>
|
||||
#include <seiscomp/core.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace Seiscomp{
|
||||
namespace Seismology {
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API FixedHypocenter : public LocatorInterface {
|
||||
// ----------------------------------------------------------------------
|
||||
// X'truction
|
||||
// ----------------------------------------------------------------------
|
||||
public:
|
||||
FixedHypocenter() = default;
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Locator interface
|
||||
// ----------------------------------------------------------------------
|
||||
public:
|
||||
virtual bool init(const Config::Config &config) override;
|
||||
|
||||
//! Returns supported parameters to be changed.
|
||||
virtual IDList parameters() const override;
|
||||
|
||||
//! Returns the value of a parameter.
|
||||
virtual std::string parameter(const std::string &name) const override;
|
||||
|
||||
//! Sets the value of a parameter.
|
||||
virtual bool setParameter(const std::string &name,
|
||||
const std::string &value) override;
|
||||
|
||||
virtual IDList profiles() const override;
|
||||
virtual void setProfile(const std::string &name) override;
|
||||
|
||||
virtual int capabilities() const override;
|
||||
|
||||
virtual DataModel::Origin *locate(PickList& pickList) override;
|
||||
virtual DataModel::Origin *locate(PickList& pickList,
|
||||
double initLat, double initLon, double initDepth,
|
||||
const Seiscomp::Core::Time& initTime) override;
|
||||
|
||||
virtual DataModel::Origin *relocate(const DataModel::Origin* origin) override;
|
||||
|
||||
|
||||
private:
|
||||
enum Flag {
|
||||
UsePickUncertainties = 0x01,
|
||||
UseOriginUncertainties = 0x02
|
||||
};
|
||||
|
||||
// Configuration
|
||||
IDList _profiles;
|
||||
int _degreesOfFreedom{8};
|
||||
double _confidenceLevel{0.9};
|
||||
double _defaultTimeError{1.0};
|
||||
union {
|
||||
uint8_t _flags{UseOriginUncertainties};
|
||||
bool _legacyAndUnusedFlag;
|
||||
};
|
||||
bool _verbose{false};
|
||||
std::string _lastError;
|
||||
OPT(double) _initLat;
|
||||
OPT(double) _initLon;
|
||||
OPT(double) _initDepth;
|
||||
|
||||
// Runtime
|
||||
TravelTimeTableInterfacePtr _ttt;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
158
include/seiscomp/seismology/locator/locsat.h
Normal file
158
include/seiscomp/seismology/locator/locsat.h
Normal file
@ -0,0 +1,158 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_SEISMOLOGY_LOCSAT_H
|
||||
#define SEISCOMP_SEISMOLOGY_LOCSAT_H
|
||||
|
||||
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
#include <seiscomp/datamodel/origin.h>
|
||||
#include <seiscomp/datamodel/arrival.h>
|
||||
#include <seiscomp/datamodel/pick.h>
|
||||
#include <seiscomp/datamodel/station.h>
|
||||
#include <seiscomp/seismology/locatorinterface.h>
|
||||
#include <seiscomp/core.h>
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <stdio.h>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
|
||||
namespace Seiscomp{
|
||||
|
||||
|
||||
namespace Internal {
|
||||
|
||||
struct Locator_params;
|
||||
class LocSAT;
|
||||
class Loc;
|
||||
|
||||
}
|
||||
|
||||
|
||||
struct SC_SYSTEM_CORE_API LocSATErrorEllipsoid {
|
||||
LocSATErrorEllipsoid() {
|
||||
sxx=syy=szz=stt=sxy=sxz=syz=stx=sty=stz=sdobs=smajax=sminax=strike=sdepth=stime=conf=0.;
|
||||
}
|
||||
|
||||
float sxx;
|
||||
float syy;
|
||||
float szz;
|
||||
float stt;
|
||||
float sxy;
|
||||
float sxz;
|
||||
float syz;
|
||||
float stx;
|
||||
float sty;
|
||||
float stz;
|
||||
float sdobs;
|
||||
float smajax;
|
||||
float sminax;
|
||||
float strike;
|
||||
float sdepth;
|
||||
float stime;
|
||||
float conf;
|
||||
};
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API LocSAT : public Seismology::LocatorInterface {
|
||||
public:
|
||||
LocSAT();
|
||||
virtual ~LocSAT();
|
||||
|
||||
virtual bool init(const Config::Config &config);
|
||||
|
||||
//! Returns supported parameters to be changed.
|
||||
virtual IDList parameters() const;
|
||||
|
||||
//! Returns the value of a parameter.
|
||||
virtual std::string parameter(const std::string &name) const;
|
||||
|
||||
//! Sets the value of a parameter.
|
||||
virtual bool setParameter(const std::string &name,
|
||||
const std::string &value);
|
||||
|
||||
virtual IDList profiles() const;
|
||||
virtual void setProfile(const std::string &name);
|
||||
|
||||
static void setDefaultProfile(const std::string &name);
|
||||
static std::string currentDefaultProfile();
|
||||
|
||||
void setNewOriginID(const std::string& newOriginID);
|
||||
|
||||
int capabilities() const;
|
||||
|
||||
DataModel::Origin* locate(PickList& pickList);
|
||||
DataModel::Origin* locate(PickList& pickList,
|
||||
double initLat, double initLon, double initDepth,
|
||||
const Seiscomp::Core::Time& initTime);
|
||||
|
||||
DataModel::Origin* relocate(const DataModel::Origin* origin);
|
||||
|
||||
const LocSATErrorEllipsoid &errorEllipsoid() const {
|
||||
return _errorEllipsoid;
|
||||
}
|
||||
|
||||
private:
|
||||
void setLocatorParams(int param, const char* value);
|
||||
std::string getLocatorParams(int param) const;
|
||||
void setDefaultLocatorParams();
|
||||
|
||||
bool loadArrivals(const DataModel::Origin* origin);
|
||||
DataModel::Origin *fromPicks(PickList& pickList);
|
||||
DataModel::Origin *loc2Origin(Internal::Loc* loc);
|
||||
|
||||
double stationCorrection(const std::string &staid, const std::string &stacode,
|
||||
const std::string &phase) const;
|
||||
|
||||
|
||||
private:
|
||||
typedef std::map<std::string, double> PhaseCorrectionMap;
|
||||
typedef std::map<std::string, PhaseCorrectionMap> StationCorrectionMap;
|
||||
|
||||
static std::string _defaultTablePrefix;
|
||||
static IDList _allowedParameters;
|
||||
|
||||
StationCorrectionMap _stationCorrection;
|
||||
std::string _newOriginID;
|
||||
std::string _tablePrefix;
|
||||
bool _computeConfidenceEllipsoid;
|
||||
Internal::LocSAT *_locateEvent;
|
||||
Internal::Locator_params *_locator_params;
|
||||
double _minArrivalWeight{0.5};
|
||||
double _defaultPickUncertainty;
|
||||
bool _usePickUncertainties{false};
|
||||
bool _usePickBackazimuth{true};
|
||||
bool _usePickSlowness{true};
|
||||
|
||||
bool _enableDebugOutput;
|
||||
|
||||
IDList _profiles;
|
||||
|
||||
LocSATErrorEllipsoid _errorEllipsoid;
|
||||
};
|
||||
|
||||
|
||||
}// of namespace Seiscomp
|
||||
|
||||
#endif
|
77
include/seiscomp/seismology/locator/utils.h
Normal file
77
include/seiscomp/seismology/locator/utils.h
Normal file
@ -0,0 +1,77 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SEISCOMP_SEISMOLOGY_LOCATOR_UTILS_H
|
||||
#define SEISCOMP_SEISMOLOGY_LOCATOR_UTILS_H
|
||||
|
||||
|
||||
namespace Seiscomp{
|
||||
|
||||
namespace DataModel {
|
||||
|
||||
class Origin;
|
||||
class OriginQuality;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Compiles an origin quality object from an origin.
|
||||
* Computed attributes:
|
||||
* * minimum distance
|
||||
* * median distance
|
||||
* * maximum distance
|
||||
* * azimuthal gap
|
||||
* * associated phase count
|
||||
* * used phase count
|
||||
* * depth phase count
|
||||
* * associated station count
|
||||
* * used station count
|
||||
*
|
||||
* Preconditions are:
|
||||
* * Arrivals must be present to generate phase counts
|
||||
* * Arrivals must have azimuth and distance set to generate azimuthal gap and
|
||||
* min/max/median distances
|
||||
* * Picks must be resolvable (Pick::Find) to update station counts
|
||||
*
|
||||
* Values that cannot be determined will not be written into the output quality,
|
||||
* meaning that this function will never set an output attribute to None.
|
||||
*
|
||||
* @param quality The output quality
|
||||
* @param origin The input origin
|
||||
*/
|
||||
void compile(DataModel::OriginQuality &quality, const DataModel::Origin *origin);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Convenience function which populates the origin quality of an origin
|
||||
* object.
|
||||
* If the origin holds already a quality object then it will be updated.
|
||||
* Otherwise a new quality object will be set.
|
||||
* @param origin The origin that will receive the quality object.
|
||||
*/
|
||||
void populateQuality(DataModel::Origin *origin);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
266
include/seiscomp/seismology/locatorinterface.h
Normal file
266
include/seiscomp/seismology/locatorinterface.h
Normal file
@ -0,0 +1,266 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef SEISCOMP_SEISMOLOGY_LOCATORINTERFACE_H
|
||||
#define SEISCOMP_SEISMOLOGY_LOCATORINTERFACE_H
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <stdio.h>
|
||||
#include <vector>
|
||||
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
#include <seiscomp/core/interfacefactory.h>
|
||||
#include <seiscomp/config/config.h>
|
||||
#include <seiscomp/datamodel/origin.h>
|
||||
#include <seiscomp/datamodel/arrival.h>
|
||||
#include <seiscomp/datamodel/pick.h>
|
||||
#include <seiscomp/datamodel/sensorlocation.h>
|
||||
#include <seiscomp/core.h>
|
||||
|
||||
|
||||
#define SC3_LOCATOR_INTERFACE_VERSION 2
|
||||
|
||||
/******************************************************************************
|
||||
API Changelog
|
||||
******************************************************************************
|
||||
2
|
||||
- First defined version
|
||||
- Replaced WeightedPick with PickItem which allows not to only use a binary
|
||||
weight but flags to enable/disable the time, backazimuth and/or slowness
|
||||
*/
|
||||
|
||||
namespace Seiscomp{
|
||||
namespace Seismology{
|
||||
|
||||
|
||||
class PickNotFoundException;
|
||||
class LocatorException;
|
||||
class StationNotFoundException;
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(SensorLocationDelegate);
|
||||
|
||||
class SC_SYSTEM_CORE_API SensorLocationDelegate : public Core::BaseObject {
|
||||
public:
|
||||
SensorLocationDelegate();
|
||||
|
||||
public:
|
||||
virtual DataModel::SensorLocation* getSensorLocation(DataModel::Pick *pick) const = 0;
|
||||
};
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(LocatorInterface);
|
||||
|
||||
class SC_SYSTEM_CORE_API LocatorInterface : public Core::BaseObject {
|
||||
public:
|
||||
MAKEENUM(
|
||||
Flags,
|
||||
EVALUES(
|
||||
F_NONE = 0x00,
|
||||
F_BACKAZIMUTH = 0x01,
|
||||
F_SLOWNESS = 0x02,
|
||||
F_TIME = 0x04,
|
||||
F_ALL = F_BACKAZIMUTH | F_SLOWNESS | F_TIME
|
||||
),
|
||||
ENAMES(
|
||||
"None",
|
||||
"Backazimuth",
|
||||
"Horizontal slowness",
|
||||
"Time",
|
||||
"All"
|
||||
)
|
||||
);
|
||||
|
||||
enum Capability {
|
||||
NoCapability = 0x0000,
|
||||
InitialLocation = 0x0001,
|
||||
FixedDepth = 0x0002,
|
||||
DistanceCutOff = 0x0004,
|
||||
IgnoreInitialLocation = 0x0008,
|
||||
CapQuantity
|
||||
};
|
||||
|
||||
enum MessageType {
|
||||
Log,
|
||||
Warning
|
||||
};
|
||||
|
||||
struct PickItem {
|
||||
PickItem(DataModel::Pick *pick = nullptr, int f = F_ALL)
|
||||
: pick(pick), flags(f) {}
|
||||
PickItem(DataModel::PickPtr pick, int f = F_ALL)
|
||||
: pick(pick), flags(f) {}
|
||||
|
||||
DataModel::PickPtr pick;
|
||||
int flags;
|
||||
};
|
||||
|
||||
typedef std::vector<PickItem> PickList;
|
||||
typedef std::vector<std::string> IDList;
|
||||
typedef std::map<std::string, std::string> ParameterMap;
|
||||
|
||||
|
||||
public:
|
||||
LocatorInterface();
|
||||
virtual ~LocatorInterface();
|
||||
|
||||
|
||||
public:
|
||||
static LocatorInterface *Create(const char *algo);
|
||||
|
||||
//! Returns the name of the locator, e.g. LocSAT or NonLinLoc
|
||||
const std::string &name() const;
|
||||
|
||||
//! Sets a delegate which returns a sensor location of
|
||||
//! a pick. If no sensor location delegate is set the
|
||||
//! default query will be used instead.
|
||||
void setSensorLocationDelegate(SensorLocationDelegate *delegate);
|
||||
|
||||
//! Initialize the configuration
|
||||
virtual bool init(const Config::Config &config) = 0;
|
||||
|
||||
//! Returns supported parameters to be changed. The default
|
||||
//! implementation returns an empty list.
|
||||
virtual IDList parameters() const;
|
||||
|
||||
//! Returns the value of a parameter. The default implementation
|
||||
//! returns always an empty string.
|
||||
virtual std::string parameter(const std::string &name) const;
|
||||
|
||||
//! Sets the value of a parameter. The default implementation
|
||||
//! returns always false.
|
||||
virtual bool setParameter(const std::string &name,
|
||||
const std::string &value);
|
||||
|
||||
//! Returns supported locator profiles (velocity models, ...)
|
||||
virtual IDList profiles() const = 0;
|
||||
|
||||
//! specify the Earth model to be used, e.g. "iasp91"
|
||||
virtual void setProfile(const std::string &name) = 0;
|
||||
|
||||
//! Returns the implementations capabilities
|
||||
virtual int capabilities() const = 0;
|
||||
|
||||
//! the following all return nullptr if (re)location failed
|
||||
virtual DataModel::Origin *locate(PickList& pickList) = 0;
|
||||
virtual DataModel::Origin *locate(PickList& pickList,
|
||||
double initLat, double initLon, double initDepth,
|
||||
const Core::Time &initTime) = 0;
|
||||
virtual DataModel::Origin *relocate(const DataModel::Origin *origin) = 0;
|
||||
|
||||
//! Returns a string (optional) valid for the last
|
||||
//! (re)locate call. Supported are log and warning
|
||||
//! messages. Errors are reported by throwing an exception.
|
||||
virtual std::string lastMessage(MessageType) const;
|
||||
|
||||
//! queries for a set capability
|
||||
bool supports(Capability) const;
|
||||
|
||||
//! Fixes the depth in km:
|
||||
void setFixedDepth(double depth, bool use=true);
|
||||
void useFixedDepth(bool use=true);
|
||||
double fixedDepth() const { return _fixedDepth; }
|
||||
bool usingFixedDepth() const { return _usingFixedDepth; }
|
||||
void releaseDepth();
|
||||
|
||||
//! Sets the distance cut-off in km
|
||||
void setDistanceCutOff(double distance);
|
||||
void releaseDistanceCutOff();
|
||||
|
||||
bool isInitialLocationIgnored() const { return _ignoreInitialLocation; }
|
||||
void setIgnoreInitialLocation(bool f) { _ignoreInitialLocation = f; }
|
||||
|
||||
|
||||
public:
|
||||
//! Finds the pick referenced by an arrival
|
||||
//! The default implementation looks up the global
|
||||
//! objects pool with publicID = arrival->pickID()
|
||||
virtual DataModel::Pick *getPick(DataModel::Arrival *arrival) const;
|
||||
|
||||
//! Find the station referenced by a pick
|
||||
//! The default implementation looks up the global inventory
|
||||
//! and tries to find the station there if no sensor location
|
||||
//! delegate is set. Otherwise it queries for the station there.
|
||||
virtual DataModel::SensorLocation* getSensorLocation(DataModel::Pick *pick) const;
|
||||
|
||||
|
||||
protected:
|
||||
std::string _name;
|
||||
SensorLocationDelegatePtr _sensorLocationDelegate;
|
||||
bool _usingFixedDepth;
|
||||
double _fixedDepth;
|
||||
bool _enableDistanceCutOff;
|
||||
double _distanceCutOff;
|
||||
bool _ignoreInitialLocation;
|
||||
};
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API PickNotFoundException : public Core::GeneralException {
|
||||
public:
|
||||
PickNotFoundException();
|
||||
PickNotFoundException(const std::string& str);
|
||||
};
|
||||
|
||||
class SC_SYSTEM_CORE_API LocatorException : public Core::GeneralException {
|
||||
public:
|
||||
LocatorException();
|
||||
LocatorException(const std::string& str);
|
||||
};
|
||||
|
||||
class SC_SYSTEM_CORE_API StationNotFoundException : public Core::GeneralException {
|
||||
public:
|
||||
StationNotFoundException();
|
||||
StationNotFoundException(const std::string& str);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief Extracts arrival information to create the usage flags. In particular
|
||||
* Arrival.timeUsed, Arrival.horizontalSlownessUsed and
|
||||
* Arrival.backazimuthUsed are evaluated. An unset value means 'used'.
|
||||
* Furthermore the final flags are update according to the arrival
|
||||
* weight. So a weight of 0 will unset all flags.
|
||||
* @param arrival The arrival to extract the flags from
|
||||
* @return Flags
|
||||
*/
|
||||
int arrivalToFlags(const DataModel::Arrival *arrival);
|
||||
|
||||
/**
|
||||
* @brief Applies locator flags to an arrival.
|
||||
* @param arrival The arrival to be updated
|
||||
* @param flags The usage flags
|
||||
*/
|
||||
void flagsToArrival(DataModel::Arrival *arrival, int flags);
|
||||
|
||||
|
||||
DEFINE_INTERFACE_FACTORY(LocatorInterface);
|
||||
|
||||
|
||||
} // of namespace Seismology
|
||||
} // of namespace Seiscomp
|
||||
|
||||
|
||||
#define REGISTER_LOCATOR(Class, Service) \
|
||||
Seiscomp::Core::Generic::InterfaceFactory<Seiscomp::Seismology::LocatorInterface, Class> __##Class##InterfaceFactory__(Service)
|
||||
|
||||
|
||||
#endif
|
112
include/seiscomp/seismology/magnitudes.h
Normal file
112
include/seiscomp/seismology/magnitudes.h
Normal file
@ -0,0 +1,112 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef SEISCOMP_SEISMOLOGY_MAGNITUDES_H
|
||||
#define SEISCOMP_SEISMOLOGY_MAGNITUDES_H
|
||||
|
||||
#include <seiscomp/core.h>
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace Magnitudes {
|
||||
|
||||
/**
|
||||
* Compute Mwp after Tsuboi(1999) with linear correction from GFZ
|
||||
* @param amplitude maximum reading of absolute integrated displacement in m*s
|
||||
* @param delta epicentral distance in degrees
|
||||
* @param mag return value
|
||||
* @param offset taken from fit against Harvard Mw (Mwp=Mw*slope+offset)
|
||||
* @param slope taken from fit against Harvard Mw
|
||||
* @param alpha P-wave velocity along ray path in m/s
|
||||
* @param rho mass density along ray path in kg/m^3
|
||||
* @param fp radiation pattern influence factor
|
||||
* @return false Mwp undefined for given epicentral distance
|
||||
* @return true Mwp calculated successfully
|
||||
*/
|
||||
SC_SYSTEM_CORE_API
|
||||
bool compute_Mwp(
|
||||
double amplitude,
|
||||
double delta,
|
||||
double &mag, // resulting magnitude
|
||||
double offset = 0, double slope = 1,
|
||||
// double offset=2.25,
|
||||
// double slope=1./1.6,
|
||||
double alpha=7900.,
|
||||
double rho=3400.,
|
||||
double fp=0.52);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Compute Mjma after Katsumata (1988) PRELIMINARY!!! only valid for depth < 60 km !!!
|
||||
* @param amplitude maximum reading of absolute integrated displacement in m*s
|
||||
* @param delta epicentral distance in degrees
|
||||
* @return false Mjma undefined for given epicentral distance
|
||||
* @return true Mwp calculated successfully
|
||||
*/
|
||||
SC_SYSTEM_CORE_API
|
||||
bool compute_Mjma(
|
||||
double amplitude,
|
||||
double delta, // in degrees
|
||||
double depth, // in kilometers
|
||||
double& Mjma);
|
||||
|
||||
/**
|
||||
* Mjma variant for BMG/Indonesia
|
||||
*/
|
||||
SC_SYSTEM_CORE_API
|
||||
bool compute_Mbmg(
|
||||
double amplitude,
|
||||
double delta, // in degrees
|
||||
double depth, // in kilometers
|
||||
double& Mbmg);
|
||||
|
||||
|
||||
SC_SYSTEM_CORE_API
|
||||
bool
|
||||
compute_mb(
|
||||
double amplitude, // in micrometers
|
||||
double period, // in seconds
|
||||
double delta, // in degrees
|
||||
double depth, // in kilometers
|
||||
double *mag); // resulting magnitude
|
||||
|
||||
|
||||
SC_SYSTEM_CORE_API
|
||||
bool
|
||||
compute_mb_fromVelocity(
|
||||
double amplitude, // in micrometers/second
|
||||
double delta, // in degrees
|
||||
double depth, // in kilometers
|
||||
double *mag); // resulting magnitude
|
||||
|
||||
|
||||
SC_SYSTEM_CORE_API
|
||||
bool
|
||||
compute_ML(
|
||||
double amplitude, // in micrometers
|
||||
double delta, // in degrees
|
||||
double depth, // in kilometers
|
||||
double *mag); // resulting magnitude
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
61
include/seiscomp/seismology/regions.h
Normal file
61
include/seiscomp/seismology/regions.h
Normal file
@ -0,0 +1,61 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef SEISCOMP_SEISMOLOGY_REGIONS_H
|
||||
#define SEISCOMP_SEISMOLOGY_REGIONS_H
|
||||
|
||||
#include <seiscomp/core.h>
|
||||
#include <seiscomp/seismology/regions/polygon.h>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
|
||||
class SC_SYSTEM_CORE_API Regions {
|
||||
public:
|
||||
static std::string getFlinnEngdahlRegion(double lat, double lon, int *id = nullptr);
|
||||
|
||||
/**
|
||||
* @return The number of available Flinn-Engdahl regions.
|
||||
*/
|
||||
static int getFlinnEngdahlRegionsCount();
|
||||
|
||||
/**
|
||||
* @brief Returns the Flinn-Engdahl region by id.
|
||||
* Note that the id starts at 1.
|
||||
* @param id The Flinn-Engdahl region id
|
||||
* @return The Flinn-Engdahl region name. If the id is out of
|
||||
* bounds then an empty string will be returned.
|
||||
*/
|
||||
static std::string getFlinnEngdahlRegionById(int id);
|
||||
|
||||
static void load();
|
||||
static std::string getRegionName(double lat, double lon);
|
||||
static Seiscomp::Geo::PolyRegions &polyRegions();
|
||||
|
||||
private:
|
||||
Regions() = default;
|
||||
};
|
||||
|
||||
|
||||
} // of ns Seiscomp
|
||||
|
||||
#endif
|
68
include/seiscomp/seismology/regions/polygon.h
Normal file
68
include/seiscomp/seismology/regions/polygon.h
Normal file
@ -0,0 +1,68 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef SEISCOMP_SEISMOLOGY_REGIONS_POLY_H
|
||||
#define SEISCOMP_SEISMOLOGY_REGIONS_POLY_H
|
||||
|
||||
#include <seiscomp/core.h>
|
||||
#include <seiscomp/geo/feature.h>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace Geo {
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API PolyRegions {
|
||||
public:
|
||||
PolyRegions() = default;
|
||||
PolyRegions(const std::string &location);
|
||||
~PolyRegions();
|
||||
|
||||
public:
|
||||
void print();
|
||||
void info();
|
||||
|
||||
GeoFeature *findRegion(double lat, double lon) const;
|
||||
std::string findRegionName(double lat, double lon) const;
|
||||
|
||||
size_t regionCount() const;
|
||||
void addRegion(GeoFeature* r);
|
||||
GeoFeature *region(int i) const;
|
||||
|
||||
size_t read(const std::string& location);
|
||||
|
||||
const std::string& dataDir() const { return _dataDir; }
|
||||
|
||||
private:
|
||||
bool readFepBoundaries(const std::string& filename);
|
||||
|
||||
private:
|
||||
std::vector<GeoFeature*> _regions;
|
||||
std::string _dataDir;
|
||||
};
|
||||
|
||||
|
||||
} // of ns Regions
|
||||
} // of ns Seiscomp
|
||||
|
||||
|
||||
#endif
|
267
include/seiscomp/seismology/ttt.h
Normal file
267
include/seiscomp/seismology/ttt.h
Normal file
@ -0,0 +1,267 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef SEISCOMP_CORE_SEISMOLOGY_TTT_H
|
||||
#define SEISCOMP_CORE_SEISMOLOGY_TTT_H
|
||||
|
||||
|
||||
#include <seiscomp/core/baseobject.h>
|
||||
#include <seiscomp/core/exceptions.h>
|
||||
#include <seiscomp/core/interfacefactory.h>
|
||||
#include <seiscomp/core.h>
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API FileNotFoundError : public Core::GeneralException {
|
||||
public:
|
||||
FileNotFoundError(std::string const &filename) : Core::GeneralException("File not found: " + filename) {}
|
||||
};
|
||||
|
||||
class SC_SYSTEM_CORE_API MultipleModelsError : public Core::GeneralException {
|
||||
public:
|
||||
MultipleModelsError(std::string const &model) : Core::GeneralException("Multiple models at the same time are not supported ('" + model +
|
||||
"' instantiated previously)") {}
|
||||
};
|
||||
|
||||
class SC_SYSTEM_CORE_API NoPhaseError : public Core::GeneralException {
|
||||
public:
|
||||
NoPhaseError() : Core::GeneralException("No phase available") {}
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* TravelTime
|
||||
*
|
||||
* Representation of a seismic travel time
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API TravelTime {
|
||||
public:
|
||||
TravelTime();
|
||||
TravelTime(const std::string &_phase,
|
||||
double _time, double _dtdd, double _dtdh, double _dddp,
|
||||
double _takeoff);
|
||||
|
||||
bool operator==(const TravelTime &other) const;
|
||||
bool operator<(const TravelTime &other) const;
|
||||
|
||||
std::string phase; //!< phase code like "P", "pP", "PKiKP" etc.
|
||||
double time; //!< actual travel time in seconds
|
||||
double dtdd; //!< dt/dd angular slowness in sec/deg
|
||||
double dtdh; //!< dt/dh dependence of time on source depth
|
||||
double dddp; //!< dd/dp
|
||||
double takeoff; //!< take-off angle at source
|
||||
OPT(double) azi; //!< azimuth angle at source (for 3D models)
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* TravelTimeList
|
||||
*
|
||||
* A list of TravelTime objects, sorted by travel time value.
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API TravelTimeList : public std::list<TravelTime> {
|
||||
public:
|
||||
bool isEmpty() { return size()==0; } // XXX temporary hack
|
||||
|
||||
void sortByTime();
|
||||
|
||||
double depth, delta;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* TravelTimeTableInterface
|
||||
*
|
||||
* An interface class to compute seismic travel times for arbitrary models.
|
||||
*/
|
||||
|
||||
class SC_SYSTEM_CORE_API TravelTimeTableInterface : public Core::BaseObject {
|
||||
public:
|
||||
TravelTimeTableInterface();
|
||||
virtual ~TravelTimeTableInterface();
|
||||
|
||||
|
||||
public:
|
||||
/**
|
||||
* Instantiates a TTT interface and returns the pointer to
|
||||
* be freed by the caller. If name is not valid, nullptr is
|
||||
* returned. Available interfaces: libtau, LOCSAT
|
||||
*/
|
||||
static TravelTimeTableInterface *Create(const char *name);
|
||||
|
||||
/**
|
||||
* Sets the model to use. Implementations can use this model
|
||||
* string for whatever purpose and must not be validated by
|
||||
* the caller.
|
||||
* Computation of travel times should also work if the
|
||||
* model has not been set from outside.
|
||||
*/
|
||||
virtual bool setModel(const std::string &model) = 0;
|
||||
|
||||
//! Returns the currently set model
|
||||
virtual const std::string &model() const = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Computes a list of all supported phase.
|
||||
*
|
||||
* @param lat1 Latitude of source
|
||||
* @param lon1 Longitude of source
|
||||
* @param dep1 The source depth in km
|
||||
* @param lat2 Latitude of receiver
|
||||
* @param lon2 Longitude of receiver
|
||||
* @param elev2 Elevation of receiver in m
|
||||
* @param ellc Apply ellipticity correction (1 = on, 0 = off)
|
||||
* @returns A TravelTimeList of travel times sorted by time.
|
||||
*/
|
||||
virtual TravelTimeList *
|
||||
compute(double lat1, double lon1, double dep1,
|
||||
double lat2, double lon2, double elev2=0.,
|
||||
int ellc = 1) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Compute the traveltime and a given phase. The default implementation
|
||||
* computes the complete travel time list and searches for them
|
||||
* requested phase.
|
||||
*
|
||||
* @param lat1 Latitude of source
|
||||
* @param lon1 Longitude of source
|
||||
* @param dep1 The source depth in km
|
||||
* @param lat2 Latitude of receiver
|
||||
* @param lon2 Longitude of receiver
|
||||
* @param elev2 Elevation of receiver in m
|
||||
* @param ellc Apply ellipticity correction (1 = on, 0 = off)
|
||||
* @returns A TravelTime
|
||||
*/
|
||||
virtual TravelTime
|
||||
compute(const char *phase,
|
||||
double lat1, double lon1, double dep1,
|
||||
double lat2, double lon2, double elev2=0.,
|
||||
int ellc = 1);
|
||||
|
||||
|
||||
/**
|
||||
* Compute the traveltime for the first (fastest) phase.
|
||||
*
|
||||
* @param lat1 Latitude of source
|
||||
* @param lon1 Longitude of source
|
||||
* @param dep1 The source depth in km
|
||||
* @param lat2 Latitude of receiver
|
||||
* @param lon2 Longitude of receiver
|
||||
* @param elev2 Elevation of receiver in m
|
||||
* @param ellc Apply ellipticity correction (1 = on, 0 = off)
|
||||
* @returns A TravelTime
|
||||
*/
|
||||
virtual TravelTime
|
||||
computeFirst(double lat1, double lon1, double dep1,
|
||||
double lat2, double lon2, double elev2=0.,
|
||||
int ellc = 1) = 0;
|
||||
|
||||
/**
|
||||
* Compute the travel time for a given phase. This is intended
|
||||
* to be a faster call than 'compute' since only the travel time
|
||||
* is returned. However the default implementation call 'compute'
|
||||
* and return the travel time for the requested phase.
|
||||
*
|
||||
* @param lat1 Latitude of source
|
||||
* @param lon1 Longitude of source
|
||||
* @param dep1 The source depth in km
|
||||
* @param lat2 Latitude of receiver
|
||||
* @param lon2 Longitude of receiver
|
||||
* @param elev2 Elevation of receiver in m
|
||||
* @param ellc Apply ellipticity correction (1 = on, 0 = off)
|
||||
* @returns The travel time for the phase
|
||||
*/
|
||||
virtual double
|
||||
computeTime(const char *phase,
|
||||
double lat1, double lon1, double dep1,
|
||||
double lat2, double lon2, double elev2=0.,
|
||||
int ellc = 1);
|
||||
};
|
||||
|
||||
|
||||
DEFINE_INTERFACE_FACTORY(TravelTimeTableInterface);
|
||||
DEFINE_SMARTPOINTER(TravelTimeTableInterface);
|
||||
|
||||
|
||||
class SC_SYSTEM_CORE_API TravelTimeTable : public TravelTimeTableInterface {
|
||||
public:
|
||||
TravelTimeTable();
|
||||
|
||||
|
||||
public:
|
||||
bool setModel(const std::string &model);
|
||||
const std::string &model() const;
|
||||
|
||||
TravelTimeList *
|
||||
compute(double lat1, double lon1, double dep1,
|
||||
double lat2, double lon2, double elev2 = 0.,
|
||||
int ellc = 1);
|
||||
|
||||
TravelTime
|
||||
compute(const char *phase,
|
||||
double lat1, double lon1, double dep1,
|
||||
double lat2, double lon2, double elev2 = 0.,
|
||||
int ellc = 1);
|
||||
|
||||
TravelTime
|
||||
computeFirst(double lat1, double lon1, double dep1,
|
||||
double lat2, double lon2, double elev2 = 0.,
|
||||
int ellc = 1);
|
||||
|
||||
private:
|
||||
static TravelTimeTableInterfacePtr _interface;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Some helpers
|
||||
|
||||
SC_SYSTEM_CORE_API
|
||||
bool ellipcorr(const std::string &phase,
|
||||
double lat1, double lon1,
|
||||
double lat2, double lon2,
|
||||
double depth, double &corr);
|
||||
|
||||
// Retrieve traveltime for the specified phase. Returns true if phase was
|
||||
// found, false otherwise.
|
||||
SC_SYSTEM_CORE_API
|
||||
const TravelTime* getPhase(const TravelTimeList *, const std::string &phaseCode);
|
||||
|
||||
SC_SYSTEM_CORE_API
|
||||
const TravelTime* firstArrivalP(const TravelTimeList *);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#define REGISTER_TRAVELTIMETABLE(Class, Service) \
|
||||
static Seiscomp::Core::Generic::InterfaceFactory<Seiscomp::TravelTimeTableInterface, Class> __##Class##InterfaceFactory__(Service)
|
||||
|
||||
|
||||
#endif
|
133
include/seiscomp/seismology/ttt/libtau.h
Normal file
133
include/seiscomp/seismology/ttt/libtau.h
Normal file
@ -0,0 +1,133 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef SEISCOMP_TTT_LIBTAU_H
|
||||
#define SEISCOMP_TTT_LIBTAU_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <seiscomp/seismology/ttt.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
#include <libtau/tau.h>
|
||||
|
||||
}
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace TTT {
|
||||
|
||||
|
||||
/**
|
||||
* TTTLibTau
|
||||
*
|
||||
* A class to compute seismic travel times for 1D models like "iasp91".
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API LibTau : public TravelTimeTableInterface {
|
||||
public:
|
||||
/**
|
||||
* Construct a TravelTimeTable object for the specified model.
|
||||
* Currently only "iasp91" is supported.
|
||||
*/
|
||||
LibTau();
|
||||
~LibTau();
|
||||
|
||||
LibTau(const LibTau &other);
|
||||
LibTau &operator=(const LibTau &other);
|
||||
|
||||
|
||||
public:
|
||||
bool setModel(const std::string &model) override;
|
||||
const std::string &model() const override;
|
||||
|
||||
|
||||
/**
|
||||
* Select a branch of traveltimes to be computed. Currently only
|
||||
* "all" is supported. Use the default!
|
||||
*/
|
||||
void setBranch(const std::string &branch="all");
|
||||
|
||||
|
||||
/**
|
||||
* Compute the traveltime(s) for the branch selected using setBranch()
|
||||
* @param dep1 The source depth in km
|
||||
*
|
||||
* @returns A TravelTimeList of travel times sorted by time.
|
||||
*
|
||||
* It should be noted that in this implementation it is extremely
|
||||
* important to compute as many travel times for the same focal
|
||||
* depth as possible. Changing the depth will always result in
|
||||
* the time-consuming re-computation of some internal tables,
|
||||
* which can be avoided by as many consecutive compute() calls as
|
||||
* possible, for the same depth.
|
||||
*
|
||||
* XXX However:
|
||||
* XXX NEITHER ellipticity NOR altitude correction is currently
|
||||
* XXX implemented! The respective parameters are ignored.
|
||||
*/
|
||||
TravelTimeList *compute(double lat1, double lon1, double dep1,
|
||||
double lat2, double lon2, double alt2 = 0.,
|
||||
int ellc = 1) override;
|
||||
|
||||
|
||||
/**
|
||||
* Compute the traveltime for the branch selected using setBranch()
|
||||
* and the first (fastest) phase.
|
||||
* @param dep1 The source depth in km
|
||||
*
|
||||
* @returns A TravelTime
|
||||
*
|
||||
* XXX However:
|
||||
* XXX NEITHER ellipticity NOR altitude correction is currently
|
||||
* XXX implemented! The respective parameters are ignored.
|
||||
*/
|
||||
TravelTime computeFirst(double lat1, double lon1, double dep1,
|
||||
double lat2, double lon2, double alt2 = 0.,
|
||||
int ellc = 1) override;
|
||||
|
||||
|
||||
private:
|
||||
TravelTimeList *compute(double delta, double depth);
|
||||
TravelTime computeFirst(double delta, double depth);
|
||||
|
||||
/**
|
||||
* Sets the source depth.
|
||||
* @param depth The source depth in km
|
||||
*/
|
||||
void setDepth(double depth);
|
||||
|
||||
void initPath(const std::string &model);
|
||||
|
||||
libtau _handle;
|
||||
|
||||
double _depth;
|
||||
std::string _model;
|
||||
|
||||
bool _initialized;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
148
include/seiscomp/seismology/ttt/locsat.h
Normal file
148
include/seiscomp/seismology/ttt/locsat.h
Normal file
@ -0,0 +1,148 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) gempa GmbH *
|
||||
* All rights reserved. *
|
||||
* Contact: gempa GmbH (seiscomp-dev@gempa.de) *
|
||||
* *
|
||||
* GNU Affero General Public License Usage *
|
||||
* This file may be used under the terms of the GNU Affero *
|
||||
* Public License version 3.0 as published by the Free Software Foundation *
|
||||
* and appearing in the file LICENSE included in the packaging of this *
|
||||
* file. Please review the following information to ensure the GNU Affero *
|
||||
* Public License version 3.0 requirements will be met: *
|
||||
* https://www.gnu.org/licenses/agpl-3.0.html. *
|
||||
* *
|
||||
* Other Usage *
|
||||
* Alternatively, this file may be used in accordance with the terms and *
|
||||
* conditions contained in a signed written agreement between you and *
|
||||
* gempa GmbH. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef SEISCOMP_TTT_LOCSAT_H
|
||||
#define SEISCOMP_TTT_LOCSAT_H
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <seiscomp/seismology/ttt.h>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
namespace TTT {
|
||||
|
||||
|
||||
/**
|
||||
* TTTLibTau
|
||||
*
|
||||
* A class to compute seismic travel times for 1D models like "iasp91".
|
||||
*/
|
||||
class SC_SYSTEM_CORE_API Locsat : public TravelTimeTableInterface {
|
||||
public:
|
||||
struct Velocity {
|
||||
Velocity() {}
|
||||
Velocity(float z, float p, float s) : depth(z), vp(p), vs(s) {}
|
||||
float depth;
|
||||
float vp;
|
||||
float vs;
|
||||
};
|
||||
|
||||
public:
|
||||
/**
|
||||
* Construct a TravelTimeTable object for the specified model.
|
||||
* Currently only "iasp91" is supported.
|
||||
*/
|
||||
Locsat();
|
||||
~Locsat();
|
||||
|
||||
Locsat(const Locsat &other);
|
||||
Locsat &operator=(const Locsat &other);
|
||||
|
||||
|
||||
public:
|
||||
bool setModel(const std::string &model) override;
|
||||
const std::string &model() const override;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Compute the traveltime(s) for the model selected using
|
||||
* setModel().
|
||||
*
|
||||
* Note that altitude correction is currently not implemented! The
|
||||
* respective parameters are ignored.
|
||||
* @param dep1 The source depth in km
|
||||
*
|
||||
* @returns A TravelTimeList of travel times sorted by time.
|
||||
*/
|
||||
TravelTimeList *compute(double lat1, double lon1, double dep1,
|
||||
double lat2, double lon2, double alt2 = 0.,
|
||||
int ellc = 1) override;
|
||||
|
||||
/**
|
||||
* Compute the traveltime and a given phase. The default implementation
|
||||
* computes the complete travel time list and searches for them
|
||||
* requested phase.
|
||||
* @param dep1 The source depth in km
|
||||
*
|
||||
* @returns A TravelTime
|
||||
*/
|
||||
TravelTime compute(const char *phase,
|
||||
double lat1, double lon1, double dep1,
|
||||
double lat2, double lon2, double alt2=0.,
|
||||
int ellc = 1) override;
|
||||
|
||||
/**
|
||||
* @brief Compute the traveltime for the model selected using setModel()
|
||||
* and the first (fastest) phase.
|
||||
*
|
||||
* Note that altitude correction is currently not implemented! The
|
||||
* respective parameters are ignored.
|
||||
* @param dep1 The source depth in km
|
||||
* @returns A TravelTime
|
||||
*/
|
||||
TravelTime computeFirst(double lat1, double lon1, double dep1,
|
||||
double lat2, double lon2, double alt2 = 0.,
|
||||
int ellc = 1) override;
|
||||
|
||||
|
||||
/**
|
||||
* Compute the travel time for a given phase. This is intended
|
||||
* to be a faster call than 'compute' since only the travel time
|
||||
* is returned.
|
||||
*
|
||||
* @param lat1 Latitude of source
|
||||
* @param lon1 Longitude of source
|
||||
* @param dep1 The source depth in km
|
||||
* @param lat2 Latitude of receiver
|
||||
* @param lon2 Longitude of receiver
|
||||
* @param elev2 Elevation of receiver in m
|
||||
* @param ellc Apply ellipticity correction (1 = on, 0 = off)
|
||||
* @returns The travel time for the phase
|
||||
*/
|
||||
double computeTime(const char *phase,
|
||||
double lat1, double lon1, double dep1,
|
||||
double lat2, double lon2, double elev2=0.,
|
||||
int ellc = 1) override;
|
||||
|
||||
|
||||
private:
|
||||
TravelTimeList *compute(double delta, double depth);
|
||||
TravelTime compute(const char *phase, double delta, double depth);
|
||||
TravelTime computeFirst(double delta, double depth);
|
||||
double computeTime(const char *phase, double delta, double depth);
|
||||
|
||||
bool initTables();
|
||||
|
||||
|
||||
private:
|
||||
std::string _model;
|
||||
std::string _tablePrefix;
|
||||
int _Pindex;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user