org.opensha.commons.util
Class FaultUtils

java.lang.Object
  extended by org.opensha.commons.util.FaultUtils

public final class FaultUtils
extends java.lang.Object

Title: FaultUtils

Description: Collection of static utilities used in conjunction with strike, dip and rake angles of faults. These functions are assertion functions, in that they validate the angles as valid strike, dip, and rake angles, and return true or false if valid.

Version:
1.0
Author:
Steven W. Rock

Field Summary
protected static java.lang.String C
          Class name used for debug strings
protected static boolean D
          boolean that indicates if print out debug statements
 
Constructor Summary
FaultUtils()
           
 
Method Summary
static void assertValidDepth(double depth)
          This makes sure that a depth on the fault is a positive number
static void assertValidDip(double dip)
          Checks that the dip angle fits within the definition
static void assertValidRake(double rake)
          Checks that the rake angle fits within the definition
static void assertValidSeisUpperAndLower(double upperSeis, double lowerSeis)
          This makes sure that a depth on the fault is a positive number
static void assertValidStrike(double strike)
          Checks that the strike angle fits within the definition
static double getAngleAverage(java.util.List<java.lang.Double> angles)
          Averages angles dealing with any -180/180 or 0/360 cut issues.
static java.util.ArrayList<FaultTrace> getEqualLengthSubsectionTraces(FaultTrace faultTrace, double maxSubSectionLen)
          This subdivides the given fault trace into sub-traces that have the length as given (or less).
static java.util.ArrayList<FaultTrace> getEqualLengthSubsectionTraces(FaultTrace faultTrace, double maxSubSectionLen, int minSubSections)
          This subdivides the given fault trace into sub-traces that have the length as given (or less).
static double getInRakeRange(double angle)
          Returns the given angle in the range -180 <= rake <= 180
static double getLengthBasedAngleAverage(java.util.List<Location> locs, java.util.List<java.lang.Double> angles)
          Returns an average of the given angles scaled by the distances between the corresponding locations.
static double getScaledAngleAverage(java.util.List<java.lang.Double> scalars, java.util.List<java.lang.Double> angles)
          Returns an average of the given angles scaled by the given scalars.
static double[] getSlipVector(double[] strikeDipRake)
          Calculates a slip vector from strike, dip, and rake information provided.
static void plotTraces(java.util.ArrayList<FaultTrace> traces)
          This is a quick plot of the traces
static FaultTrace resampleTrace(FaultTrace trace, int num)
          This resamples the trace into num subsections of equal length (final number of points in trace is num+1).
 
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
Class name used for debug strings

See Also:
Constant Field Values

D

protected static final boolean D
boolean that indicates if print out debug statements

See Also:
Constant Field Values
Constructor Detail

FaultUtils

public FaultUtils()
Method Detail

assertValidStrike

public static void assertValidStrike(double strike)
                              throws InvalidRangeException
Checks that the strike angle fits within the definition

0 <= strike <= 360

Parameters:
strike - Angle to validate
Throws:
InvalidRangeException - Thrown if not valid angle

assertValidDip

public static void assertValidDip(double dip)
                           throws InvalidRangeException
Checks that the dip angle fits within the definition

0 <= dip <= 90

Parameters:
dip - Angle to validate
Throws:
InvalidRangeException - Thrown if not valid angle

assertValidDepth

public static void assertValidDepth(double depth)
                             throws InvalidRangeException
This makes sure that a depth on the fault is a positive number

Parameters:
depth -
Throws:
InvalidRangeException

assertValidSeisUpperAndLower

public static void assertValidSeisUpperAndLower(double upperSeis,
                                                double lowerSeis)
                                         throws InvalidRangeException
This makes sure that a depth on the fault is a positive number

Parameters:
depth -
Throws:
InvalidRangeException

assertValidRake

public static void assertValidRake(double rake)
                            throws InvalidRangeException
Checks that the rake angle fits within the definition

-180 <= rake <= 180

Parameters:
rake - Angle to validate
Throws:
InvalidRangeException - Thrown if not valid angle

getInRakeRange

public static double getInRakeRange(double angle)
Returns the given angle in the range -180 <= rake <= 180

Parameters:
angle -

getEqualLengthSubsectionTraces

public static java.util.ArrayList<FaultTrace> getEqualLengthSubsectionTraces(FaultTrace faultTrace,
                                                                             double maxSubSectionLen)
This subdivides the given fault trace into sub-traces that have the length as given (or less). This assumes all fault trace points are at the same depth.

Parameters:
faultTrace -
maxSubSectionLen - Maximum length of each subsection

getEqualLengthSubsectionTraces

public static java.util.ArrayList<FaultTrace> getEqualLengthSubsectionTraces(FaultTrace faultTrace,
                                                                             double maxSubSectionLen,
                                                                             int minSubSections)
This subdivides the given fault trace into sub-traces that have the length as given (or less). This assumes all fault trace points are at the same depth.

Parameters:
faultTrace -
maxSubSectionLen - Maximum length of each subsection
minSubSections - minimum number of sub sections to generate

resampleTrace

public static FaultTrace resampleTrace(FaultTrace trace,
                                       int num)
This resamples the trace into num subsections of equal length (final number of points in trace is num+1). However, note that these subsections of are equal length on the original trace, and that the final subsections will be less than that if there is curvature in the original between the points (e.g., corners getting cut).

Parameters:
trace -
num - - number of subsections
Returns:

plotTraces

public static void plotTraces(java.util.ArrayList<FaultTrace> traces)
This is a quick plot of the traces

Parameters:
traces -

getLengthBasedAngleAverage

public static double getLengthBasedAngleAverage(java.util.List<Location> locs,
                                                java.util.List<java.lang.Double> angles)
Returns an average of the given angles scaled by the distances between the corresponding locations. Note that this expects angles in degrees, and will return angles from 0 to 360 degrees.

Parameters:
locs - locations for distance scaling
angles - angles in degrees corresponding to each pair of locations
Returns:

getScaledAngleAverage

public static double getScaledAngleAverage(java.util.List<java.lang.Double> scalars,
                                           java.util.List<java.lang.Double> angles)
Returns an average of the given angles scaled by the given scalars. Note that this expects angles in degrees, and will return angles from 0 to 360 degrees.

Parameters:
scalars - scalar weights for each angle (does not need to be normalized)
angles - angles in degrees corresponding to each pair of locations
Returns:

getAngleAverage

public static double getAngleAverage(java.util.List<java.lang.Double> angles)
Averages angles dealing with any -180/180 or 0/360 cut issues. Note that this expects angles in degrees, and will return angles from 0 to 360 degrees.

Parameters:
angles -
Returns:

getSlipVector

public static double[] getSlipVector(double[] strikeDipRake)
Calculates a slip vector from strike, dip, and rake information provided.

Parameters:
strike -
dip -
rake -
Returns:
double[x,y,z] array for slip vector.