org.opensha.commons.eq.cat
Class CatTools

java.lang.Object
  extended by org.opensha.commons.eq.cat.CatTools

public class CatTools
extends Object

Catalog utilities.

Version:
$Id: CatTools.java 8912 2012-04-20 17:29:53Z pmpowers $
Author:
Peter Powers

Field Summary
static double MAG_MAX
          Maximum earthquake magnitude value (10) used for range checking.
static double MAG_MIN
          Minimum earthquake magnitude value (-2) used for range checking.
 
Constructor Summary
CatTools()
           
 
Method Summary
static String toJSON(Catalog catalog)
          Returns a JSON string containing data arrays for the following data [TIME, LONGITUDE, LATITUDE, DEPTH, MAGNITUDE]
static void validateMag(double mag)
          Verifies that a magnitude value falls within range of MAG_MIN and MAG_MAX (inclusive).
static void validateMags(double[] mags)
          Verifies that a set of magnitude values fall within range of MAG_MIN and MAG_MAX (inclusive).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAG_MIN

public static final double MAG_MIN
Minimum earthquake magnitude value (-2) used for range checking.

See Also:
Constant Field Values

MAG_MAX

public static final double MAG_MAX
Maximum earthquake magnitude value (10) used for range checking.

See Also:
Constant Field Values
Constructor Detail

CatTools

public CatTools()
Method Detail

validateMags

public static final void validateMags(double[] mags)
Verifies that a set of magnitude values fall within range of MAG_MIN and MAG_MAX (inclusive).

Parameters:
mags - magnitudes to validate
Throws:
IllegalArgumentException - if a data value is out of range

validateMag

public static final void validateMag(double mag)
Verifies that a magnitude value falls within range of MAG_MIN and MAG_MAX (inclusive).

Parameters:
mag - magnitude to validate
Throws:
IllegalArgumentException - if data value is out of range

toJSON

public static final String toJSON(Catalog catalog)
Returns a JSON string containing data arrays for the following data [TIME, LONGITUDE, LATITUDE, DEPTH, MAGNITUDE]

Parameters:
catalog - to process
Returns:
a JSON formatted String
Throws:
IllegalArgumentException - if catalog does not contain the required output data types