org.opensha.sha.earthquake.calc
Class ERF_Calculator

java.lang.Object
  extended by org.opensha.sha.earthquake.calc.ERF_Calculator

public class ERF_Calculator
extends Object

Title: ERF_Calculator

Description: This for various calculations related to ERFs. This is to replace ERF2GriddedSeisRatesCalc (which is overly complex)

Version:
1.0
Author:
Ned Field

Constructor Summary
ERF_Calculator()
          default class Constructor.
 
Method Summary
static GriddedGeoDataSet get_bValueAtPointsInRegion(ERF erf, GriddedRegion griddedRegion, double min_bValMag, double max_bValMag)
          This returns the b-value between min_bValMag and max_bValMag at each point in the region for the given ERF.
static SummedMagFreqDist getMagFreqDistInRegion(ERF erf, Region region, double minMag, int numMag, double deltaMag, boolean preserveRates)
          This computes the total nucleation magnitude frequency distribution (equivalent poisson rates) for the ERF inside the region (only the fraction of each rupture inside the region is included)
static SummedMagFreqDist getMagFreqDistInRegionFaster(ERF erf, Region region, double minMag, int numMag, double deltaMag, boolean preserveRates)
          This computes the total nucleation magnitude frequency distribution (equivalent poisson rates) for the ERF inside the region (only the fraction of each rupture inside the region is included, where here the surface is approximated by the trace)
static ArrayList<SummedMagFreqDist> getMagFreqDistsAtLocsInRegion(ERF erf, GriddedRegion griddedRegion, double minMag, int numMag, double deltaMag, boolean preserveRates)
          This computes the magnitude frequency distribution (equivalent poisson rates) for each location in the supplied GriddedRegion and ERF.
static GriddedGeoDataSet getMomentRatesInRegion(ERF erf, GriddedRegion griddedRegion)
          The computes the nucleation moment rate in each grid point in the supplied GriddedRegion.
static GriddedGeoDataSet getNucleationRatesInRegion(ERF erf, GriddedRegion griddedRegion, double minMag, double maxMag)
          The gives the effective nucleation rates for events greater than or equal to minMag and less than maxMag for each point in the supplied GriddedRegion.
static GriddedGeoDataSet getNucleationRatesInRegion(ERF erf, GriddedRegion griddedRegion, double minMag, double maxMag, RupNodesCache rupNodesCache)
          The gives the effective nucleation rates for events greater than or equal to minMag and less than maxMag for each point in the supplied GriddedRegion.
static SummedMagFreqDist getParticipationMagFreqDistInRegion(ERF erf, Region region, double minMag, int numMag, double deltaMag, boolean preserveRates)
          This computes the total participation magnitude frequency distribution (equivalent poisson rates) for the ERF inside the region (rupture mag and rate is included if any part of the rupture is inside)
static SummedMagFreqDist getParticipationMagFreqDistInRegion(ERF erf, Region region, double minMag, int numMag, double deltaMag, boolean preserveRates, RupInRegionCache rupInRegionCache)
           
static GriddedGeoDataSet getParticipationRatesInRegion(ERF erf, GriddedRegion griddedRegion, double minMag, double maxMag)
          The gives the effective participation rates for events greater than or equal to minMag and less than maxMag for each point in the supplied GriddedRegion.
static GriddedGeoDataSet getParticipationRatesInRegion(ERF erf, GriddedRegion griddedRegion, double minMag, double maxMag, RupNodesCache rupNodesCache)
           
static int[] getRupNodesInRegion(ProbEqkRupture rupture, GriddedRegion griddedRegion)
           
static SummedMagFreqDist getTotalMFD_ForERF(ERF eqkRupForecast, double min, double max, int num, boolean preserveRates)
          This computes the annualized total magnitude frequency distribution for the ERF.
static SummedMagFreqDist getTotalMFD_ForSource(ProbEqkSource src, double duration, double min, double max, int num, boolean preserveRates)
          This computes the annualized total magnitude frequency distribution for the ERF.
static SummedMagFreqDist getTotalMFD_ForSourceRange(ERF eqkRupForecast, double min, double max, int num, boolean preserveRates, int firstSourceIndex, int lastSourceIndex)
          This computes the annualized total magnitude frequency distribution for the ERF for the specified range of sources.
static double getTotalMomentRateForSource(ProbEqkSource src, double duration)
          This returns the total equivalent annual moment rate for the source
static double getTotalMomentRateInRegion(ERF erf, Region region)
          This computes the total moment rate (Nm/yr), from equivalent poisson rates, for the ERF inside the region (only the fraction of each rupture inside the region is included)
static double getTotalRateAboveMagForSource(ProbEqkSource src, double duration, double magThresh)
          This returns the total equivalent annual rate for the source for ruptures with magnitude greater than or equal to the given magThres
static double getTotalRateInRegion(ERF erf, Region region, double minMag)
          This computes the rate of event (equivalent poisson rates) for the ERF inside the region (only the fraction of each rupture inside the region is included)
static void main(String[] args)
           
static void writeSTEP_FormatFile(ArrayList<SummedMagFreqDist> mfds, GriddedRegion griddedRegion, String filePathAndName)
          This writes a STEP format file, which gives the lat, lon, and rates for the associated mag-freq dist on each line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ERF_Calculator

public ERF_Calculator()
default class Constructor.

Method Detail

getTotalMFD_ForERF

public static SummedMagFreqDist getTotalMFD_ForERF(ERF eqkRupForecast,
                                                   double min,
                                                   double max,
                                                   int num,
                                                   boolean preserveRates)
This computes the annualized total magnitude frequency distribution for the ERF. Magnitudes that are out of the range specified are ignored.

Parameters:
eqkRupForecast - - assumed to be updated before being passed in
min - - for MagFreqDist x axis
max - - for MagFreqDist x axis
num - - for MagFreqDist x axis
preserveRates - - if true rates are assigned to nearest discrete magnitude without modification,if false rates are adjusted to preserve moment rate.
Returns:

getTotalMFD_ForSourceRange

public static SummedMagFreqDist getTotalMFD_ForSourceRange(ERF eqkRupForecast,
                                                           double min,
                                                           double max,
                                                           int num,
                                                           boolean preserveRates,
                                                           int firstSourceIndex,
                                                           int lastSourceIndex)
This computes the annualized total magnitude frequency distribution for the ERF for the specified range of sources. Magnitudes that are out of the range specified are ignored.

Parameters:
eqkRupForecast - - assumed to be updated before being passed in
min - - for MagFreqDist x axis
max - - for MagFreqDist x axis
num - - for MagFreqDist x axis
preserveRates - - if true rates are assigned to nearest discrete magnitude without modification,if false rates are adjusted to preserve moment rate.
firstSourceIndex - - first index of sources to be included
lastSourceIndex - - last index of sources to be included
Returns:

getTotalMFD_ForSource

public static SummedMagFreqDist getTotalMFD_ForSource(ProbEqkSource src,
                                                      double duration,
                                                      double min,
                                                      double max,
                                                      int num,
                                                      boolean preserveRates)
This computes the annualized total magnitude frequency distribution for the ERF. Magnitudes that are out of the range specified are ignored.

Parameters:
src - - an earthquake source
duration - - the forecast duration (e.g., from a time span)
min - - for MagFreqDist x axis
max - - for MagFreqDist x axis
num - - for MagFreqDist x axis
preserveRates - - if true rates are assigned to nearest discrete magnitude without modification,if false rates are adjusted to preserve moment rate.
Returns:

getTotalRateAboveMagForSource

public static double getTotalRateAboveMagForSource(ProbEqkSource src,
                                                   double duration,
                                                   double magThresh)
This returns the total equivalent annual rate for the source for ruptures with magnitude greater than or equal to the given magThres

Parameters:
src -
duration -
magThresh -
Returns:

getTotalMomentRateForSource

public static double getTotalMomentRateForSource(ProbEqkSource src,
                                                 double duration)
This returns the total equivalent annual moment rate for the source

Parameters:
src -
duration -
Returns:

getMagFreqDistInRegion

public static SummedMagFreqDist getMagFreqDistInRegion(ERF erf,
                                                       Region region,
                                                       double minMag,
                                                       int numMag,
                                                       double deltaMag,
                                                       boolean preserveRates)
This computes the total nucleation magnitude frequency distribution (equivalent poisson rates) for the ERF inside the region (only the fraction of each rupture inside the region is included)

Parameters:
erf -
region -
minMag -
numMag -
deltaMag -
preserveRates - - this tells whether to preserve rates or preserve moment rates
Returns:

getMagFreqDistInRegionFaster

public static SummedMagFreqDist getMagFreqDistInRegionFaster(ERF erf,
                                                             Region region,
                                                             double minMag,
                                                             int numMag,
                                                             double deltaMag,
                                                             boolean preserveRates)
This computes the total nucleation magnitude frequency distribution (equivalent poisson rates) for the ERF inside the region (only the fraction of each rupture inside the region is included, where here the surface is approximated by the trace)

Parameters:
erf -
region -
minMag -
numMag -
deltaMag -
preserveRates - - this tells whether to preserve rates or preserve moment rates
Returns:

getParticipationMagFreqDistInRegion

public static SummedMagFreqDist getParticipationMagFreqDistInRegion(ERF erf,
                                                                    Region region,
                                                                    double minMag,
                                                                    int numMag,
                                                                    double deltaMag,
                                                                    boolean preserveRates)
This computes the total participation magnitude frequency distribution (equivalent poisson rates) for the ERF inside the region (rupture mag and rate is included if any part of the rupture is inside)

Parameters:
erf -
region -
minMag -
numMag -
deltaMag -
preserveRates - - this tells whether to preserve rates or preserve moment rates
Returns:

getParticipationMagFreqDistInRegion

public static SummedMagFreqDist getParticipationMagFreqDistInRegion(ERF erf,
                                                                    Region region,
                                                                    double minMag,
                                                                    int numMag,
                                                                    double deltaMag,
                                                                    boolean preserveRates,
                                                                    RupInRegionCache rupInRegionCache)

getTotalRateInRegion

public static double getTotalRateInRegion(ERF erf,
                                          Region region,
                                          double minMag)
This computes the rate of event (equivalent poisson rates) for the ERF inside the region (only the fraction of each rupture inside the region is included)

Parameters:
erf -
region -
minMag - - ruptures with magnitudes less than this are not included in the total
Returns:

getTotalMomentRateInRegion

public static double getTotalMomentRateInRegion(ERF erf,
                                                Region region)
This computes the total moment rate (Nm/yr), from equivalent poisson rates, for the ERF inside the region (only the fraction of each rupture inside the region is included)

Parameters:
erf -
region - - set as null to get ERF total moment rate
Returns:

getMagFreqDistsAtLocsInRegion

public static ArrayList<SummedMagFreqDist> getMagFreqDistsAtLocsInRegion(ERF erf,
                                                                         GriddedRegion griddedRegion,
                                                                         double minMag,
                                                                         int numMag,
                                                                         double deltaMag,
                                                                         boolean preserveRates)
This computes the magnitude frequency distribution (equivalent poisson rates) for each location in the supplied GriddedRegion and ERF. This assumes a uniform distribution of nucleations on each rupture. Ruptures that fall outside the region are ignored. The indices for the returned array list are the same as for the GriddedRegion.

Parameters:
erf -
griddedRegion -
minMag -
numMag -
deltaMag -
preserveRates - - this tells whether to preserve rates or preserve moment rates
Returns:

get_bValueAtPointsInRegion

public static GriddedGeoDataSet get_bValueAtPointsInRegion(ERF erf,
                                                           GriddedRegion griddedRegion,
                                                           double min_bValMag,
                                                           double max_bValMag)
This returns the b-value between min_bValMag and max_bValMag at each point in the region for the given ERF. Set min_bValMag (or max_bValMag) as Double.NaN if you want this set as the smallest (or largest) mag with a non-zero rate.

Parameters:
erf -
griddedRegion -
min_bValMag -
max_bValMag -
Returns:

getNucleationRatesInRegion

public static GriddedGeoDataSet getNucleationRatesInRegion(ERF erf,
                                                           GriddedRegion griddedRegion,
                                                           double minMag,
                                                           double maxMag)
The gives the effective nucleation rates for events greater than or equal to minMag and less than maxMag for each point in the supplied GriddedRegion.

Parameters:
erf - - it's assumed that erf.updateForecast() has already been called
griddedRegion -
minMag -
maxMag -
Returns:
GriddedGeoDataSet - X-axis is set as Latitude, and Y-axis is Longitude

getNucleationRatesInRegion

public static GriddedGeoDataSet getNucleationRatesInRegion(ERF erf,
                                                           GriddedRegion griddedRegion,
                                                           double minMag,
                                                           double maxMag,
                                                           RupNodesCache rupNodesCache)
The gives the effective nucleation rates for events greater than or equal to minMag and less than maxMag for each point in the supplied GriddedRegion.

Parameters:
erf - - it's assumed that erf.updateForecast() has already been called
griddedRegion -
minMag -
maxMag -
Returns:
GriddedGeoDataSet - X-axis is set as Latitude, and Y-axis is Longitude

getMomentRatesInRegion

public static GriddedGeoDataSet getMomentRatesInRegion(ERF erf,
                                                       GriddedRegion griddedRegion)
The computes the nucleation moment rate in each grid point in the supplied GriddedRegion.

Parameters:
erf - - it's assumed that erf.updateForecast() has already been called
griddedRegion -
Returns:
GriddedGeoDataSet - X-axis is set as Latitude, and Y-axis is Longitude

getParticipationRatesInRegion

public static GriddedGeoDataSet getParticipationRatesInRegion(ERF erf,
                                                              GriddedRegion griddedRegion,
                                                              double minMag,
                                                              double maxMag)
The gives the effective participation rates for events greater than or equal to minMag and less than maxMag for each point in the supplied GriddedRegion.

Parameters:
erf - - it's assumed that erf.updateForecast() has already been called
griddedRegion -
minMag -
maxMag -
Returns:
GriddedGeoDataSet - X-axis is set as Latitude, and Y-axis is Longitude

getParticipationRatesInRegion

public static GriddedGeoDataSet getParticipationRatesInRegion(ERF erf,
                                                              GriddedRegion griddedRegion,
                                                              double minMag,
                                                              double maxMag,
                                                              RupNodesCache rupNodesCache)

getRupNodesInRegion

public static int[] getRupNodesInRegion(ProbEqkRupture rupture,
                                        GriddedRegion griddedRegion)

writeSTEP_FormatFile

public static void writeSTEP_FormatFile(ArrayList<SummedMagFreqDist> mfds,
                                        GriddedRegion griddedRegion,
                                        String filePathAndName)
This writes a STEP format file, which gives the lat, lon, and rates for the associated mag-freq dist on each line.

Parameters:
mfds -
griddedRegion -
filePathAndName -

main

public static void main(String[] args)