org.opensha.sha.calc
Class HazardCurveCalculator

java.lang.Object
  extended by org.opensha.sha.calc.HazardCurveCalculator
All Implemented Interfaces:
java.util.EventListener, ParameterChangeWarningListener, HazardCurveCalculatorAPI

public class HazardCurveCalculator
extends java.lang.Object
implements HazardCurveCalculatorAPI, ParameterChangeWarningListener

Title: HazardCurveCalculator

Description: This class calculates the Hazard curve based on the input parameters imr, site and eqkRupforecast or eqkRupture (for probabilistic or deterministic, respectively)

Copyright: Copyright (c) 2002

Company:

Version:
1.0
Author:
: Ned Field & Nitin Gupta & Vipin Gupta

Field Summary
protected static java.lang.String C
           
protected  int currRuptures
           
protected static boolean D
           
protected  int numSources
           
protected  int sourceIndex
           
protected  int totRuptures
           
 
Constructor Summary
HazardCurveCalculator()
          creates the HazardCurveCalculator object
 
Method Summary
 ParameterList getAdjustableParams()
          Get the adjustable parameter list of calculation parameters
 java.util.ListIterator<Parameter<?>> getAdjustableParamsIterator()
          Get iterator for the adjustable parameters
 DiscretizedFunc getAnnualizedRates(DiscretizedFunc hazFunction, double years)
          Returns the Annualized Rates for the Hazard Curves
 DiscretizedFunc getAverageEventSetHazardCurve(DiscretizedFunc hazFunction, Site site, ScalarIMR imr, ERF eqkRupForecast)
          This function computes an average hazard curve from a number of stochastic event sets for the given Site, IMR, eqkRupForecast, where the number of event-set realizations is specified as the value in numStochEventSetRealizationsParam.
 int getCurrRuptures()
          gets the current rupture that is being processed
 DiscretizedFunc getEventSetHazardCurve(DiscretizedFunc hazFunction, Site site, ScalarIMR imr, java.util.List<EqkRupture> eqkRupList, boolean updateCurrRuptures)
          This function computes a hazard curve for the given Site, IMR, and event set (eqkRupList), where it is assumed that each of the events occur (probability of each is 1.0).
 DiscretizedFunc getHazardCurve(DiscretizedFunc hazFunction, Site site, java.util.Map<TectonicRegionType,ScalarIMR> imrMap, ERF eqkRupForecast)
          This function computes a hazard curve for the given Site, imrMap, ERF, and discretized function, where the latter supplies the x-axis values (the IMLs) for the computation, and the result (probability) is placed in the y-axis values of this function.
 DiscretizedFunc getHazardCurve(DiscretizedFunc hazFunction, Site site, ScalarIMR imr, EqkRupture rupture)
          This computes the "deterministic" exceedance curve for the given Site, IMR, and ProbEqkrupture (conditioned on the event actually occurring).
 DiscretizedFunc getHazardCurve(DiscretizedFunc hazFunction, Site site, ScalarIMR imr, ERF eqkRupForecast)
          This function computes a hazard curve for the given Site, IMR, ERF, and discretized function, where the latter supplies the x-axis values (the IMLs) for the computation, and the result (probability) is placed in the y-axis values of this function.
 ArbitrarilyDiscretizedFunc getMagDistCutoffFunc()
          This gets the mag-dist filter function (distance on x-axis and mag on y-axis), returning null if the includeMagDistFilterParam has been set to false.
 double getMaxSourceDistance()
          This is a direct way of getting the distance cutoff from that parameter
 PtSrcDistCorr.Type getPtSrcDistCorrType()
          This gets the type of point-source distance correction that is desired (see the class PtSrcDistCorr for options)
 int getTotRuptures()
          gets the total number of ruptures.
protected  void initDiscretizeValues(DiscretizedFunc arb, double val)
          Initialize the prob as 1 for the Hazard function
static void main(java.lang.String[] args)
           
 void parameterChangeWarning(ParameterChangeWarningEvent event)
          Function that must be implemented by all Listeners for ParameterChangeWarnEvents.
 void setAdjustableParams(ParameterList paramList)
          This was created so new instances of this calculator could be given pointers to a set of parameter that already exist.
 void setIncludeMagDistCutoff(boolean include)
          Sets the IncludeMagDistFilterParam parameter, which determines if the magnitude/distance filter is used in calculation.
 void setMagDistCutoffFunc(ArbitrarilyDiscretizedFunc magDistfunc)
          This sets the mag-dist filter function (distance on x-axis and mag on y-axis), and also sets the value of includeMagDistFilterParam as true
 void setMaxSourceDistance(double distance)
          This sets the maximum distance of sources to be considered in the calculation.
 void setNumStochEventSetRealizations(int numRealizations)
          Set the number of stochastic event set realizations for average event set hazard curve calculation.
 void setPtSrcDistCorrType(PtSrcDistCorr.Type type)
          This sets the type of point-source distance correction that is desired (see the class PtSrcDistCorr for options)
 void stopCalc()
          stops the Hazard Curve calculations.
 void testEventSetHazardCurve(int numIterations)
          This tests whether the average over many curves from getEventSetCurve equals what is given by getHazardCurve.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

C

protected static final java.lang.String C
See Also:
Constant Field Values

D

protected static final boolean D
See Also:
Constant Field Values

currRuptures

protected int currRuptures

totRuptures

protected int totRuptures

sourceIndex

protected int sourceIndex

numSources

protected int numSources
Constructor Detail

HazardCurveCalculator

public HazardCurveCalculator()
creates the HazardCurveCalculator object

Method Detail

setPtSrcDistCorrType

public void setPtSrcDistCorrType(PtSrcDistCorr.Type type)
Description copied from interface: HazardCurveCalculatorAPI
This sets the type of point-source distance correction that is desired (see the class PtSrcDistCorr for options)

Specified by:
setPtSrcDistCorrType in interface HazardCurveCalculatorAPI

getPtSrcDistCorrType

public PtSrcDistCorr.Type getPtSrcDistCorrType()
Description copied from interface: HazardCurveCalculatorAPI
This gets the type of point-source distance correction that is desired (see the class PtSrcDistCorr for options)

Specified by:
getPtSrcDistCorrType in interface HazardCurveCalculatorAPI

setMaxSourceDistance

public void setMaxSourceDistance(double distance)
Description copied from interface: HazardCurveCalculatorAPI
This sets the maximum distance of sources to be considered in the calculation. Sources more than this distance away are ignored. This is simply a direct way of setting the parameter. Default value is 250 km.

Specified by:
setMaxSourceDistance in interface HazardCurveCalculatorAPI

setNumStochEventSetRealizations

public void setNumStochEventSetRealizations(int numRealizations)
Description copied from interface: HazardCurveCalculatorAPI
Set the number of stochastic event set realizations for average event set hazard curve calculation. This simply sets the NumStochasticEventSetsParam parameter.

Specified by:
setNumStochEventSetRealizations in interface HazardCurveCalculatorAPI
Parameters:
numRealizations - number of stochastic event set realizations

getMaxSourceDistance

public double getMaxSourceDistance()
Description copied from interface: HazardCurveCalculatorAPI
This is a direct way of getting the distance cutoff from that parameter

Specified by:
getMaxSourceDistance in interface HazardCurveCalculatorAPI
Returns:
max source distance

setMagDistCutoffFunc

public void setMagDistCutoffFunc(ArbitrarilyDiscretizedFunc magDistfunc)
Description copied from interface: HazardCurveCalculatorAPI
This sets the mag-dist filter function (distance on x-axis and mag on y-axis), and also sets the value of includeMagDistFilterParam as true

Specified by:
setMagDistCutoffFunc in interface HazardCurveCalculatorAPI
Parameters:
magDistfunc - function to set

setIncludeMagDistCutoff

public void setIncludeMagDistCutoff(boolean include)
Description copied from interface: HazardCurveCalculatorAPI
Sets the IncludeMagDistFilterParam parameter, which determines if the magnitude/distance filter is used in calculation.

Specified by:
setIncludeMagDistCutoff in interface HazardCurveCalculatorAPI
Parameters:
include - if true, the magnitude/distance filter is included

getMagDistCutoffFunc

public ArbitrarilyDiscretizedFunc getMagDistCutoffFunc()
Description copied from interface: HazardCurveCalculatorAPI
This gets the mag-dist filter function (distance on x-axis and mag on y-axis), returning null if the includeMagDistFilterParam has been set to false.

Specified by:
getMagDistCutoffFunc in interface HazardCurveCalculatorAPI
Returns:
mag-dist filter function

getAnnualizedRates

public DiscretizedFunc getAnnualizedRates(DiscretizedFunc hazFunction,
                                          double years)
Description copied from interface: HazardCurveCalculatorAPI
Returns the Annualized Rates for the Hazard Curves

Specified by:
getAnnualizedRates in interface HazardCurveCalculatorAPI
Parameters:
hazFunction - Discretized Hazard Function
Returns:
annualized rates for the given hazard function

getHazardCurve

public DiscretizedFunc getHazardCurve(DiscretizedFunc hazFunction,
                                      Site site,
                                      ScalarIMR imr,
                                      ERF eqkRupForecast)
Description copied from interface: HazardCurveCalculatorAPI
This function computes a hazard curve for the given Site, IMR, ERF, and discretized function, where the latter supplies the x-axis values (the IMLs) for the computation, and the result (probability) is placed in the y-axis values of this function. This always applies a source and rupture distance cutoff using the value of the maxDistanceParam parameter (set to a very high value if you don't want this). It also applies a magnitude-dependent distance cutoff on the sources if the value of includeMagDistFilterParam is "true" and using the function in magDistCutoffParam.

Specified by:
getHazardCurve in interface HazardCurveCalculatorAPI
Returns:

getHazardCurve

public DiscretizedFunc getHazardCurve(DiscretizedFunc hazFunction,
                                      Site site,
                                      java.util.Map<TectonicRegionType,ScalarIMR> imrMap,
                                      ERF eqkRupForecast)
Description copied from interface: HazardCurveCalculatorAPI
This function computes a hazard curve for the given Site, imrMap, ERF, and discretized function, where the latter supplies the x-axis values (the IMLs) for the computation, and the result (probability) is placed in the y-axis values of this function. This always applies a source and rupture distance cutoff using the value of the maxDistanceParam parameter (set to a very high value if you don't want this). It also applies a magnitude-dependent distance cutoff on the sources if the value of includeMagDistFilterParam is "true" and using the function in magDistCutoffParam. The IMR will be selected on a source by source basis by the imrMap parameter. If the mapping only contains a single IMR, then that IMR will be used for all sources. Otherwise, if a mapping exists for the source's tectonic region type (TRT), then the IMR from that mapping will be used for that source. If no mapping exists, a NullPointerException will be thrown. Once the IMR is selected, it's TRT paramter can be set by the soruce, depending on the SetTRTinIMR_FromSourceParam param and NonSupportedTRT_OptionsParam param. If SetTRTinIMR_FromSourceParam is true, then the IMR's TRT param will be set by the source (otherwise it will be left unchanged). If it is to be set, but the source's TRT is not supported by the IMR, then NonSupportedTRT_OptionsParam is used.

Specified by:
getHazardCurve in interface HazardCurveCalculatorAPI
imrMap - this Map specifies which IMR to use with each tectonic region.
eqkRupForecast - selected Earthquake rup forecast
Returns:
hazard curve. Function passed in is updated in place, so this is just a pointer to the hazFunction param.

getAverageEventSetHazardCurve

public DiscretizedFunc getAverageEventSetHazardCurve(DiscretizedFunc hazFunction,
                                                     Site site,
                                                     ScalarIMR imr,
                                                     ERF eqkRupForecast)
Description copied from interface: HazardCurveCalculatorAPI
This function computes an average hazard curve from a number of stochastic event sets for the given Site, IMR, eqkRupForecast, where the number of event-set realizations is specified as the value in numStochEventSetRealizationsParam. The passed in discretized function supplies the x-axis values (the IMLs) for the computation, and the result (probability) is placed in the y-axis values of this function. This always applies a rupture distance cutoff using the value of the maxDistanceParam parameter (set to a very high value if you don't want this). This does not (yet?) apply the magnitude-dependent distance cutoff represented by includeMagDistFilterParam and magDistCutoffParam.

Specified by:
getAverageEventSetHazardCurve in interface HazardCurveCalculatorAPI
Parameters:
hazFunction - This function is where the hazard curve is placed
site - site object
imr - selected IMR object
eqkRupForecast - selected Earthquake rup forecast
Returns:
hazard curve. Function passed in is updated in place, so this is just a pointer to the hazFunction param.

getEventSetHazardCurve

public DiscretizedFunc getEventSetHazardCurve(DiscretizedFunc hazFunction,
                                              Site site,
                                              ScalarIMR imr,
                                              java.util.List<EqkRupture> eqkRupList,
                                              boolean updateCurrRuptures)
Description copied from interface: HazardCurveCalculatorAPI
This function computes a hazard curve for the given Site, IMR, and event set (eqkRupList), where it is assumed that each of the events occur (probability of each is 1.0). The passed in discretized function supplies the x-axis values (the IMLs) for the computation, and the result (probability) is placed in the y-axis values of this function. This always applies a rupture distance cutoff using the value of the maxDistanceParam parameter (set to a very high value if you don't want this). This does not (yet?) apply the magnitude-dependent distance cutoff represented by includeMagDistFilterParam and magDistCutoffParam.

Specified by:
getEventSetHazardCurve in interface HazardCurveCalculatorAPI
Parameters:
hazFunction - This function is where the hazard curve is placed
site - site object
imr - selected IMR object
updateCurrRuptures - tells whether to update current ruptures (for the getCurrRuptures() method used for progress bars)
Returns:
hazard curve. Function passed in is updated in place, so this is just a pointer to the hazFunction param.

getHazardCurve

public DiscretizedFunc getHazardCurve(DiscretizedFunc hazFunction,
                                      Site site,
                                      ScalarIMR imr,
                                      EqkRupture rupture)
Description copied from interface: HazardCurveCalculatorAPI
This computes the "deterministic" exceedance curve for the given Site, IMR, and ProbEqkrupture (conditioned on the event actually occurring). The hazFunction passed in provides the x-axis values (the IMLs) and the result (probability) is placed in the y-axis values of this function.

Specified by:
getHazardCurve in interface HazardCurveCalculatorAPI
Parameters:
hazFunction - This function is where the deterministic hazard curve is placed
site - site object
imr - selected IMR object
rupture - Single Earthquake Rupture
Returns:
hazard curve. Function passed in is updated in place, so this is just a pointer to the hazFunction param.

getCurrRuptures

public int getCurrRuptures()
Description copied from interface: HazardCurveCalculatorAPI
gets the current rupture that is being processed

Specified by:
getCurrRuptures in interface HazardCurveCalculatorAPI

getTotRuptures

public int getTotRuptures()
Description copied from interface: HazardCurveCalculatorAPI
gets the total number of ruptures.

Specified by:
getTotRuptures in interface HazardCurveCalculatorAPI
Returns:
total number of ruptures.

stopCalc

public void stopCalc()
Description copied from interface: HazardCurveCalculatorAPI
stops the Hazard Curve calculations.

Specified by:
stopCalc in interface HazardCurveCalculatorAPI

initDiscretizeValues

protected void initDiscretizeValues(DiscretizedFunc arb,
                                    double val)
Initialize the prob as 1 for the Hazard function

Parameters:
arb -

getAdjustableParams

public ParameterList getAdjustableParams()
Description copied from interface: HazardCurveCalculatorAPI
Get the adjustable parameter list of calculation parameters

Specified by:
getAdjustableParams in interface HazardCurveCalculatorAPI
Returns:
the adjustable ParameterList

setAdjustableParams

public void setAdjustableParams(ParameterList paramList)
Description copied from interface: HazardCurveCalculatorAPI
This was created so new instances of this calculator could be given pointers to a set of parameter that already exist.

Specified by:
setAdjustableParams in interface HazardCurveCalculatorAPI
Parameters:
paramList - parameters to be set

getAdjustableParamsIterator

public java.util.ListIterator<Parameter<?>> getAdjustableParamsIterator()
Description copied from interface: HazardCurveCalculatorAPI
Get iterator for the adjustable parameters

Specified by:
getAdjustableParamsIterator in interface HazardCurveCalculatorAPI
Returns:
parameter iterator

testEventSetHazardCurve

public void testEventSetHazardCurve(int numIterations)
This tests whether the average over many curves from getEventSetCurve equals what is given by getHazardCurve.


parameterChangeWarning

public void parameterChangeWarning(ParameterChangeWarningEvent event)
Description copied from interface: ParameterChangeWarningListener
Function that must be implemented by all Listeners for ParameterChangeWarnEvents.

Specified by:
parameterChangeWarning in interface ParameterChangeWarningListener
Parameters:
event - The Event which triggered this function call

main

public static void main(java.lang.String[] args)