|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.opensha.sha.imr.AbstractIMR
org.opensha.sha.imr.AttenuationRelationship
public abstract class AttenuationRelationship
Title: AttenuationRelationship
Description: This subclass of IntensityMeasureRelationship is the abstract implementation for Attenuation Relationships (also known as Ground Motion Prediction Equations (GMPEs)). In addition to implementing the ScalarIntensityMeasureRelationshipAPI interface (where all IMLs are double values), this also assumes that the probability distribution for the IMLs is Gaussian. The probability calculation is identical for all subclasses, and is therefore handled here in the abstract class (according to the truncation-type and truncation-level parameters defined here), whereas subclasses simply implement the getMean() and getStdDev() methods (as well as others).
Remember, the probability that an intensity-measure type (IMT, defined by a parameter in the subclass) will exceed some IML is computed from parameters defined in the subclass, and these parameters are categorized according to whether they relate to a Site, EqkRupture, Propagation Effect (meaning the value depends on both the given Site and EqkRupture), or to some "Other" category (there is a separate list defined for each of these categories). In addition, each subclass has a list of supported IMTs.
We need to avoid subclasses from defining the same parameter with different names, or defining different parameters with he same name. To this end, we define the following parameters here in this abstract class (all of which are instances of the associated parameter defined in the "param" folder at the same directory level of this class, see that code for exact definitions):
Intensity-Measure parameters (IMTs)
Site-related parameters
EqkRupture-related parameters
Propagation-Effect related parameters
Note that these parameters are only defined here, and need to be instantiated in a given subclass if their use is desired (otherwise they can be ignored). Again, most of the parameters do not really need to be defined here (other than the few that are actually used in methods here), but we define them here anyway to encourage consistent usage. These parameters can also be overridden if different attributes are desired.
Notes for Implementing Subclasses:
The easiest way to learn how to implement an AttenuationRelationship is to look at one that's already been implemented. In fact, you can simply duplicate the one that is closest to what you want to implement, change the name, and modify accordingly (that's what we generally do).
The first step is to identify the intensity-measure types the model is to support, and to initialize these from the constructor using the initPropagationEffectParams() method, which also populates the supportedIMParams list.
When defining a new parameter (either for an IMT or for one of the other parameter types described below), you should always choose from the parameters already defined in the "param" folder (at the same level as this class) if it exists. Otherwise you need to define and create a new one in your subclass. If you think anyone else might want to use your new one (or could accidentally adopt the same name), then we should add it to "params" folder here to avoid effort duplication (or inconsistencies).
The second step is to identify the parameters the model depends upon (categorized by those that depend on the Site, EqkRupture, Propagation Effect, or Other), and to initialize them from the constructor using the following associated methods:
All but the last method is defined as abstract here in order to remind developers to implement these methods (they can have an empty implementation if there are no such parameters in the subclass). The initOtherParams() method is implemented here because the two truncation-related parameters will likely exist in every subclass (although this method must still be called as "super.initOtherParams()" from the subclass in order to include them). Each of the above methods also populates the associated list (siteParams, eqkRuptureParams, propagationEffectParams, or otherParams).
The third step is to populate the following lists (typically done using a initIndependentParamLists() method called from the constructor): meanIndependentParams, stdDevIndependentParams, exceedProbIndependentParams, and imlAtExceedProbIndependentParams. If the Attenuation Relationship is to listen to, and act, on any parameter changes, the following methods need to be implement: initParameterEventListeners(), resetParameterEventListeners() and parameterChange(*).
The fourth step is to implement the setEqkRupture(qkRup) and setSite(site) methods, which simply set the values of the EqkRupture-related and Site-related parameters from the objects passed in. We also need to implement the initPropagationEffectParams() method, which sets those parameters from the current Site and EqkRupture objects (this method is generally called at the end of the setEqkRupture(qkRup) and setSite(site) methods).
The fifth step is to implement the getMean() and getStdDev() methods, which simply calculate those respective values from current parameter settings.
Note that if the value of the distance parameter used by the model exceeds the USER_MAX_DISTANCE field, then the value of VERY_SMALL_MEAN should be returned by the getMean() method (implemented in order to get results consistent with the 2003 NSHMP Fortran code). The final step is to document the attenuation relationship, both in terms of Java docs and the glossary at our web page (http://www.opensha.org/documentation/glossary), for which you can use another model as a guide (e.g., see CB_2008_AttenRel and its glossary entry - http://www.opensha.org/documentation/modelsImplemented/attenRel/CB_2008.html).
We've skipped some details in these instructions, but again, the easiest way to implement a model is look at one that's already been implemented
Please ask questions and feel free to improve these notes if you can.
| Field Summary | |
|---|---|
protected AftershockParam |
aftershockParam
|
static String |
C
Classname constant used for debugging statements |
protected CAV_Param |
cavParam
|
protected ComponentParam |
componentParam
|
protected static boolean |
D
Prints out debugging statements if true |
protected DepthTo1pt0kmPerSecParam |
depthTo1pt0kmPerSecParam
|
protected DepthTo2pt5kmPerSecParam |
depthTo2pt5kmPerSecParam
|
protected DipParam |
dipParam
|
protected DistanceJBParameter |
distanceJBParam
|
protected DistanceRupParameter |
distanceRupParam
Propagation Effect Parameters (see classes for exact definitions) |
protected DistanceSeisParameter |
distanceSeisParam
|
protected DistRupMinusDistX_OverRupParam |
distRupMinusDistX_OverRupParam
|
protected DistRupMinusJB_OverRupParameter |
distRupMinusJB_OverRupParam
|
protected Ds575_Param |
ds575Param
|
protected Ds595_Param |
ds595Param
|
protected static String |
ERR
Common error message = "Not all parameters have been set" |
protected ParameterList |
exceedProbIndependentParams
List of all Parameters that the exceed. |
protected FaultTypeParam |
fltTypeParam
|
protected FocalDepthParam |
focalDepthParam
|
protected HangingWallFlagParam |
hangingWallFlagParam
|
protected ParameterList |
imlAtExceedProbIndependentParams
List of all Parameters that the IML at exceed. |
protected MagParam |
magParam
Earthquake Rupture related parameters (see classes for exact definitions) |
protected ParameterList |
meanIndependentParams
List of all Parameters that the mean calculation depends upon, except for the intensity-measure related parameters (type/level) and any independentdent parameters they contain. |
protected PGA_Param |
pgaParam
Intensity-Measure Parameters (see classes for exact definitions) |
protected PGD_Param |
pgdParam
|
protected PGV_Param |
pgvParam
|
protected RakeParam |
rakeParam
|
protected RupTopDepthParam |
rupTopDepthParam
|
protected RupWidthParam |
rupWidthParam
|
protected DampingParam |
saDampingParam
|
protected SA_Param |
saParam
|
protected PeriodParam |
saPeriodParam
|
protected SigmaTruncLevelParam |
sigmaTruncLevelParam
|
protected SigmaTruncTypeParam |
sigmaTruncTypeParam
|
protected ParameterList |
stdDevIndependentParams
List of all Parameters that the stdDev calculation depends upon, except for the intensity-measure related parameters (type/level) and any independentdent parameters they contain. |
protected StdDevTypeParam |
stdDevTypeParam
Other Parameters (see classes for exact definitions) |
protected TectonicRegionTypeParam |
tectonicRegionTypeParam
|
protected double |
USER_MAX_DISTANCE
This allows users to set a maximul distance (beyond which the mean will be effectively zero) |
protected static double |
VERY_SMALL_MEAN
|
protected Vs30_TypeParam |
vs30_TypeParam
|
protected Vs30_Param |
vs30Param
Site related parameters (see classes for exact definitions) |
| Fields inherited from class org.opensha.sha.imr.AbstractIMR |
|---|
eqkRupture, eqkRuptureParams, EXCEED_PROB_DEFAULT, EXCEED_PROB_INFO, EXCEED_PROB_MAX, EXCEED_PROB_MIN, EXCEED_PROB_NAME, exceedProbParam, im, intensityMeasureChanged, listener, otherParams, propagationEffectParams, site, siteParams, supportedIMParams, url_info_string, XML_METADATA_IMT_NAME, XML_METADATA_NAME, XML_METADATA_SITE_PARAMETERS_NAME |
| Fields inherited from interface org.opensha.commons.metadata.XMLSaveable |
|---|
XML_METADATA_NAME |
| Constructor Summary | |
|---|---|
AttenuationRelationship()
Constructor for the AttenuationRelationship object - subclasses should execute the various init*() methods (in proper order) |
|
| Method Summary | |
|---|---|
String |
getAllParamMetadata()
This returns metadata for all parameters (only showing the independent parameters relevant for the presently chosen imt) |
double |
getEpsilon()
This returns (iml-mean)/stdDev, ignoring any truncation. |
double |
getEpsilon(double iml)
This returns (iml-mean)/stdDev, ignoring any truncation. |
DiscretizedFunc |
getExceedProbabilities(DiscretizedFunc intensityMeasureLevels)
This fills in the exceedance probability for multiple intensityMeasure levels (often called a "hazard curve"); the levels are obtained from the X values of the input function, and Y values are filled in with the asociated exceedance probabilities. |
double |
getExceedProbability()
This calculates the probability that the intensity-measure level (the value in the Intensity-Measure Parameter) will be exceeded given the mean and stdDev computed from current independent parameter values. |
double |
getExceedProbability(double iml)
This calculates the probability that the supplied intensity-measure level will be exceeded given the mean and stdDev computed from current independent parameter values. |
protected double |
getExceedProbability(double mean,
double stdDev,
double iml)
This method computed the probability of exceeding the IM-level given the mean and stdDev, and considering the sigma truncation type and level. |
ParameterList |
getExceedProbIndependentParams()
Returns a list of all the Parameters that the exceedProb calculation depends upon (not including the intensity-measure related parameters and their internal, independent parameters). |
ListIterator<Parameter<?>> |
getExceedProbIndependentParamsIterator()
Returns an iterator over all the Parameters that the exceedProb calculation depends upon (not including the intensity-measure related parameters and their internal, independent parameters). |
double |
getIML_AtExceedProb()
This calculates the intensity-measure level associated with probability held by the exceedProbParam given the mean and standard deviation (according to the chosen truncation type and level). |
double |
getIML_AtExceedProb(double exceedProb)
This calculates the intensity-measure level associated with given probability and the calculated mean and standard deviation (and according to the chosen truncation type and level). |
ParameterList |
getIML_AtExceedProbIndependentParams()
Returns a list of all the Parameters that the IML-at-exceed- probability calculation depends upon. |
ListIterator<Parameter<?>> |
getIML_AtExceedProbIndependentParamsIterator()
Returns an iterator over all the Parameters that the IML-at-exceed- probability calculation depends upon. |
ParameterList |
getMeanIndependentParams()
Returns a list of all the Parameters that the Mean calculation depends upon. |
ListIterator<Parameter<?>> |
getMeanIndependentParamsIterator()
Returns an iterator over all the Parameters that the Mean calculation depends upon. |
DiscretizedFunc |
getSA_ExceedProbSpectrum(double iml)
This calculates the exceed-probability at each SA Period for the supplied intensity-measure level (a hazard spectrum). |
DiscretizedFunc |
getSA_IML_AtExceedProbSpectrum(double exceedProb)
This calculates the intensity-measure level for each SA Period associated with the given probability. |
ParameterList |
getStdDevIndependentParams()
Returns a list of all the Parameters that the StdDev calculation depends upon (not including the intensity-measure related parameters and their internal, independent parameters). |
ListIterator<Parameter<?>> |
getStdDevIndependentParamsIterator()
Returns an iterator over all the Parameters that the StdDev calculation depends upon (not including the intensity-measure related parameters and their internal, independent parameters). |
double |
getTotExceedProbability(PointEqkSource ptSrc,
double iml)
This method will compute the total probability of exceedance for a PointEqkSource (including the probability of each rupture). |
protected abstract void |
initEqkRuptureParams()
Creates the EqkRupture-related parameters, which are all associated parameters that the exceedance probability depends upon. |
protected void |
initOtherParams()
This creates the otherParams list. |
protected void |
initParameterEventListeners()
Adds the Listeners to the parameters so that Attenuation can listen to any kind of changes to parameter values. |
protected abstract void |
initPropagationEffectParams()
Creates Propagation-Effect related parameters, which are all associated parameters that the exceedance probability depends upon. |
protected abstract void |
initSiteParams()
This creates Site-related parameters, which are all associated parameters that the exceedance probability depends upon. |
protected abstract void |
initSupportedIntensityMeasureParams()
This creates the supported intensity-measure parameters. |
boolean |
isTectonicRegionSupported(String tectRegionName)
Tells whether the given tectonic region is supported |
boolean |
isTectonicRegionSupported(TectonicRegionType tectRegion)
Tells whether the given tectonic region is supported |
void |
resetParameterEventListeners()
Allows to reset the change listeners on the parameters |
void |
setIntensityMeasureLevel(Double iml)
Sets the value of the selected intensityMeasure; |
void |
setIntensityMeasureLevel(Object iml)
Sets the value of the currently selected intensityMeasure (if the value is allowed); this will reject anything that is not a Double. |
protected abstract void |
setPropagationEffectParams()
Calculates the value of each propagation effect parameter from the current Site and ProbEqkRupture objects. |
void |
setSiteLocation(Location loc)
This method sets the location in the site. |
void |
setUserMaxDistance(double maxDist)
This method sets the user-defined distance beyond which ground motion is set to effectively zero (the mean is a large negative value). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.opensha.sha.imr.ScalarIMR |
|---|
getMean, getStdDev |
| Methods inherited from interface java.lang.Comparable |
|---|
compareTo |
| Field Detail |
|---|
public static final String C
protected static final boolean D
protected PGA_Param pgaParam
protected PGV_Param pgvParam
protected PGD_Param pgdParam
protected SA_Param saParam
protected PeriodParam saPeriodParam
protected DampingParam saDampingParam
protected CAV_Param cavParam
protected Ds575_Param ds575Param
protected Ds595_Param ds595Param
protected StdDevTypeParam stdDevTypeParam
protected SigmaTruncTypeParam sigmaTruncTypeParam
protected SigmaTruncLevelParam sigmaTruncLevelParam
protected ComponentParam componentParam
protected TectonicRegionTypeParam tectonicRegionTypeParam
protected MagParam magParam
protected FaultTypeParam fltTypeParam
protected AftershockParam aftershockParam
protected RakeParam rakeParam
protected DipParam dipParam
protected RupTopDepthParam rupTopDepthParam
protected RupWidthParam rupWidthParam
protected FocalDepthParam focalDepthParam
protected DistanceRupParameter distanceRupParam
protected DistanceJBParameter distanceJBParam
protected DistanceSeisParameter distanceSeisParam
protected DistRupMinusJB_OverRupParameter distRupMinusJB_OverRupParam
protected DistRupMinusDistX_OverRupParam distRupMinusDistX_OverRupParam
protected HangingWallFlagParam hangingWallFlagParam
protected Vs30_Param vs30Param
protected Vs30_TypeParam vs30_TypeParam
protected DepthTo2pt5kmPerSecParam depthTo2pt5kmPerSecParam
protected DepthTo1pt0kmPerSecParam depthTo1pt0kmPerSecParam
protected double USER_MAX_DISTANCE
protected static final double VERY_SMALL_MEAN
protected static final String ERR
protected ParameterList meanIndependentParams
protected ParameterList stdDevIndependentParams
protected ParameterList exceedProbIndependentParams
protected ParameterList imlAtExceedProbIndependentParams
| Constructor Detail |
|---|
public AttenuationRelationship()
| Method Detail |
|---|
public void setUserMaxDistance(double maxDist)
setUserMaxDistance in interface ScalarIMRmaxDist -
public void setIntensityMeasureLevel(Object iml)
throws ParameterException
setIntensityMeasureLevel in interface IntensityMeasureRelationshipsetIntensityMeasureLevel in class AbstractIMRiml - The new intensityMeasureLevel value
ParameterException - Description of the Exception
public void setIntensityMeasureLevel(Double iml)
throws ParameterException
setIntensityMeasureLevel in interface ScalarIMRiml - The new intensityMeasureLevel value
ParameterException - Description of the Exceptionpublic void setSiteLocation(Location loc)
setSiteLocation in interface ScalarIMRprotected abstract void setPropagationEffectParams()
public double getExceedProbability()
throws ParameterException,
IMRException
getExceedProbability in interface IntensityMeasureRelationshipParameterException - Description of the Exception
IMRException - Description of the Exception
public double getExceedProbability(double iml)
throws ParameterException,
IMRException
getExceedProbability in interface ScalarIMRParameterException - Description of the Exception
IMRException - Description of the Exception
public DiscretizedFunc getSA_ExceedProbSpectrum(double iml)
throws ParameterException,
IMRException
getSA_ExceedProbSpectrum in interface ScalarIMRParameterException
IMRException
public DiscretizedFunc getSA_IML_AtExceedProbSpectrum(double exceedProb)
throws ParameterException,
IMRException
getSA_IML_AtExceedProbSpectrum in interface ScalarIMRexceedProb -
ParameterException
IMRExceptionpublic double getEpsilon()
getEpsilon in interface ScalarIMRpublic double getEpsilon(double iml)
getEpsilon in interface ScalarIMRiml - double
protected double getExceedProbability(double mean,
double stdDev,
double iml)
throws ParameterException,
IMRException
mean - stdDev - iml -
ParameterException
IMRException
public DiscretizedFunc getExceedProbabilities(DiscretizedFunc intensityMeasureLevels)
throws ParameterException
getExceedProbabilities in interface ScalarIMRintensityMeasureLevels - The function to be filled in
ParameterException - Description of the Exception
public double getTotExceedProbability(PointEqkSource ptSrc,
double iml)
ptSrc - iml -
public double getIML_AtExceedProb()
throws ParameterException
getIML_AtExceedProb in interface ScalarIMRParameterException - Description of the Exception
public double getIML_AtExceedProb(double exceedProb)
throws ParameterException
getIML_AtExceedProb in interface ScalarIMRexceedProb - : Sets the Value of the exceed Prob param with this value.
ParameterException - Description of the Exceptionpublic ListIterator<Parameter<?>> getMeanIndependentParamsIterator()
getMeanIndependentParamsIterator in interface ScalarIMRpublic ParameterList getMeanIndependentParams()
ScalarIMR
getMeanIndependentParams in interface ScalarIMRpublic ListIterator<Parameter<?>> getStdDevIndependentParamsIterator()
getStdDevIndependentParamsIterator in interface ScalarIMRpublic ParameterList getStdDevIndependentParams()
ScalarIMR
getStdDevIndependentParams in interface ScalarIMRpublic ListIterator<Parameter<?>> getExceedProbIndependentParamsIterator()
getExceedProbIndependentParamsIterator in interface ScalarIMRpublic ParameterList getExceedProbIndependentParams()
ScalarIMR
getExceedProbIndependentParams in interface ScalarIMRpublic ListIterator<Parameter<?>> getIML_AtExceedProbIndependentParamsIterator()
getIML_AtExceedProbIndependentParamsIterator in interface ScalarIMRpublic ParameterList getIML_AtExceedProbIndependentParams()
ScalarIMR
getIML_AtExceedProbIndependentParams in interface ScalarIMRpublic String getAllParamMetadata()
getAllParamMetadata in interface ScalarIMRprotected abstract void initSupportedIntensityMeasureParams()
protected abstract void initSiteParams()
protected abstract void initEqkRuptureParams()
protected abstract void initPropagationEffectParams()
protected void initOtherParams()
protected void initParameterEventListeners()
public void resetParameterEventListeners()
resetParameterEventListeners in interface ScalarIMRpublic boolean isTectonicRegionSupported(String tectRegionName)
isTectonicRegionSupported in interface ScalarIMRtectRegionName -
public boolean isTectonicRegionSupported(TectonicRegionType tectRegion)
isTectonicRegionSupported in interface ScalarIMRtectRegion -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||