gov.usgs.earthquake.event
Class EventSanityCheck

java.lang.Object
  extended by gov.usgs.earthquake.event.EventSanityCheck

public class EventSanityCheck
extends java.lang.Object

Compare 2 versions of the same event to see if it has changed significantly and requires human inspection.


Field Summary
static java.math.BigDecimal DEPTH_THRESHOLD
           
static java.math.BigDecimal DISTANCE_THRESHOLD
           
static java.math.BigDecimal MAGNITUDE_THRESHOLD
           
static java.math.BigDecimal TIME_THRESHOLD
           
 
Constructor Summary
EventSanityCheck()
          Default constructor with values as follows:
EventSanityCheck(java.math.BigDecimal timeThreshold, java.math.BigDecimal distanceThreshold, java.math.BigDecimal depthThreshold, java.math.BigDecimal magnitudeThreshold)
          Constructor with configurable thresholds.
 
Method Summary
 java.math.BigDecimal getDepthThreshold()
           
 double getDistance(EventComparison c)
          Calculate the "euclidean" distance between 2 events.
 java.math.BigDecimal getDistanceThreshold()
           
 java.math.BigDecimal getMagnitudeThreshold()
           
 java.math.BigDecimal getTimeThreshold()
           
 java.lang.String isMatch(EventComparison c)
          Compares two events and returns a string of errors if they are not similar enough or null otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DISTANCE_THRESHOLD

public static final java.math.BigDecimal DISTANCE_THRESHOLD

MAGNITUDE_THRESHOLD

public static final java.math.BigDecimal MAGNITUDE_THRESHOLD

DEPTH_THRESHOLD

public static final java.math.BigDecimal DEPTH_THRESHOLD

TIME_THRESHOLD

public static final java.math.BigDecimal TIME_THRESHOLD
Constructor Detail

EventSanityCheck

public EventSanityCheck()
Default constructor with values as follows:
 TIME_THRESHOLD = 5s
 DISTANCE_THRESHOLD = 30km
 DEPTH_THRESHOLD = 30km
 MAGNITUDE_THRESHOLD = .4
 


EventSanityCheck

public EventSanityCheck(java.math.BigDecimal timeThreshold,
                        java.math.BigDecimal distanceThreshold,
                        java.math.BigDecimal depthThreshold,
                        java.math.BigDecimal magnitudeThreshold)
Constructor with configurable thresholds.

Parameters:
timeThreshold -
distanceThreshold -
depthThreshold -
magnitudeThreshold -
Method Detail

isMatch

public java.lang.String isMatch(EventComparison c)
Compares two events and returns a string of errors if they are not similar enough or null otherwise.

Parameters:
c - comparison to test.
Returns:
error message as string if out of range, null otherwise.

getDistance

public double getDistance(EventComparison c)
Calculate the "euclidean" distance between 2 events.
 sqrt((distance / distanceThreshold) ˆ 2
                + (magnitudeDifference / magnitudeThreshold) ˆ 2
                + (depthDifference / depthThreshold) ˆ 2
                + (timeDifference / timeThreshold) ˆ 2)
 

Parameters:
c -
Returns:

getTimeThreshold

public java.math.BigDecimal getTimeThreshold()

getDistanceThreshold

public java.math.BigDecimal getDistanceThreshold()

getDepthThreshold

public java.math.BigDecimal getDepthThreshold()

getMagnitudeThreshold

public java.math.BigDecimal getMagnitudeThreshold()