Class Mfd
XySequence, however their
construction is varied.
Factory methods are provided to directly create incremental MFD builders
for different MFD types. Note that the Mfd.Builder class
also includes factory methods to initialize builders from data or a copy of
an existing MFD. Once obtained, a builder can be used to scale and shape the
MFD prior to calling build(). Example:
Mfd mfd = Mfds.newGutenbergRighterBuilder(5.0, 7.5, 0.1, 1.0)
.scaleToCumulativeRate(0.02)
.transform(p -> p.set((p.x() > 6.5) ? p.y() * 0.667 : p.y()))
.build()
In the example above, an MFD with a
Gutenberg–Richter distribution of rates is initialized from M=5.0
to M=7.5 with a step size of 0.1 magnitude units. The
resultant MFD will have magnitudes
[5.05, 5.15, 5.25, ... , 7.35, 7.45] centered on the 0.1 magnitude
intervals spanning the magnitude range [5.0..7.5]. The MFD is then
scaled to the cumulative rate of 0.02 events/year, and lastly those rates
above M=6.5 are scaled to ⅔ of their present value. Note that an MFD
builder executes methods in the order defined, so reversing
scaleToCumulativeRate() and transform() in the example above
results in two different MFDs. Note also that builders are reusable, but any
calls to Mfd.Builder.transform(Consumer) can irrevocably change the state
of the builder between build() calls.
MFD Mfd.Properties hold references to the parameters used to
initialize an MFD, including its Mfd.Type. Properties objects may be
constructed directly and support a Mfd.Properties.toBuilder() method. The
the Mfd.Type will be INCREMENTAL if the MFD was created
directly from magnitude and rate data or is the result of combining more than
one MFD via Mfds.combine(java.util.Collection). Similarly, properties
may not align with an associated MFD downstream if a builder
initialized with a set of properties has been used to create multiple MFDs
with variably scaled rates or transformed in various ways. Note also that
when MFDs are combined, the
resulting combined MFD will be of type: Mfd.Type.INCR.
Users of MFDs are encouraged take advantage of the conveniences of the
underlying XySequence, especially streaming support. For example, to
compute the cumulative rate of events in an MFD, one should use
mfd.data().yValues().sum().
- Author:
- U.S. Geological Survey
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classMagnitude frequency distribution (MFD) builder.static classProperties object associated with a MFD.static enumMagnitude-frequency distribution (MFD) type identifier. -
Method Summary
Modifier and TypeMethodDescriptionstatic Mfdcreate(double[] magnitudes, double[] rates) Create an MFD from copies of the supplied arrays.static Mfdcreate(XySequence xy) Create an MFD from the supplied sequence.static Mfdcreate(XySequence xy, Mfd.Properties props) Create an MFD from the supplied sequence and properties.data()The immutable values representing this MFD.static Mfd.BuildernewGaussianBuilder(double m, int nm, double sigma, int nSigma) Create anMfd.Builderfor a doubly-truncated Gaussian MFD.static Mfd.BuildernewGutenbergRichterBuilder(double b, double mDelta, double mMin, double mMax) Create anMfd.Builderfor a truncated Gutenberg–Richter MFD.static Mfd.BuildernewSingleBuilder(double magnitude) Create anMfd.Builderfor a single magnitude with a rate of one.static Mfd.BuildernewTaperedGutenbergRichterBuilder(double b, double mDelta, double mMin, double mMax, double mc) Create anMfd.Builderfor a truncated Gutenberg–Richter MFD with an exponential taper.The properties used to initialize the MFD.toString()
-
Method Details
-
data
The immutable values representing this MFD. -
properties
The properties used to initialize the MFD. -
toString
-
create
Create an MFD from copies of the supplied arrays. The returned MFD will be of type:Mfd.Type.INCR.- Parameters:
magnitudes- to wrap in a MFDrates- to wrap in a MFD- Throws:
IllegalArgumentException- ifmagnitudesis emptyIllegalArgumentException- ifmagnitudesandratesare not the same sizeIllegalArgumentException- ifmagnitudesdoes not increase monotonically or contains repeated valuesIllegalArgumentException- ifmagnitudesorratescontain invalid values perEarthquakes.checkMagnitude(double)andMfds.checkRate(double)
-
create
Create an MFD from the supplied sequence. The returned MFD will be of type:Mfd.Type.INCR. The supplied sequence will only be copied if necessary.- Parameters:
xy- data to wrap in an MFD- Throws:
IllegalArgumentException- if sequence contains invalid magnitudes (x-values) or rates (y-values) perEarthquakes.checkMagnitude(double)andMfds.checkRate(double)
-
create
Create an MFD from the supplied sequence and properties. This method assumes the supplied sequence has been created consistent with the supplied properties. Users will have little use for this method; it is used internally for magnitude array optimizations.- Parameters:
xy- data to wrap in an MFDprops-- Throws:
IllegalArgumentException- if sequence contains invalid magnitudes (x-values) or rates (y-values) perEarthquakes.checkMagnitude(double)andMfds.checkRate(double)
-
newSingleBuilder
Create anMfd.Builderfor a single magnitude with a rate of one.- Parameters:
magnitude-- Throws:
IllegalArgumentException- if magnitude is outside the range[-2.0..9.7]
-
newGaussianBuilder
Create anMfd.Builderfor a doubly-truncated Gaussian MFD. Gaussian MFDs are typically used to represent aleatory variability in magnitude. When building the underlying magnitude distribution, this implementation rounds each magnitude to 5 decimal places. This implementation constructs a distribution that ism ± 2σwide and represented bynmevenly distributed magnitude values. The initial distribution integrates to one. The MFD, once built, will be of type:Mfd.Type.SINGLEas it represents a single magnitude combined with a model of uncertainty. In the context of a hazard model, a normal distribution of magnitudes is typically used to represent aleatory variability.- Parameters:
m- the mean magnitudenm- the number of magnitudes in the resultant distributionsigma- the standard deviationnSigma- the number of standard deviations aboutm- Throws:
IllegalArgumentException- ifmis outside the range[-2.0..9.7]IllegalArgumentException- ifnmis outside the range[1..21]IllegalArgumentException- ifsigmais outside the range(0..0.5]IllegalArgumentException- ifnSigmais outside the range[0..5]
-
newGutenbergRichterBuilder
public static Mfd.Builder newGutenbergRichterBuilder(double b, double mDelta, double mMin, double mMax) Create anMfd.Builderfor a truncated Gutenberg–Richter MFD. When building the underlying magnitude distribution, this implementation rounds each magnitude to 4 decimal places. Note thatmMinandmMaxdefine the lowermost and uppermost magnitude bin edges in a magnitude distribution, respectively, and that magnitude values in a Gutenberg-Richter MFD are defined as bin centers. That is, ifmMin = 5.0andΔm = 0.1, the first magnitude in the distribution will bemMin + Δm / 2 = 5.05.- Parameters:
b- the Gutenberg-Richter b-valuemDelta- the magnitude step of the distributionmMin- the minimum truncation magnitudemMax- the maximum truncation magnitude- Throws:
IllegalArgumentException- ifmMinormMaxis outside the range[-2.0..9.7]IllegalArgumentException- ifmMin > mMaxIllegalArgumentException- ifmDelta > mMax - mMinIllegalArgumentException- ifbis outside the range[0..3]
-
newTaperedGutenbergRichterBuilder
public static Mfd.Builder newTaperedGutenbergRichterBuilder(double b, double mDelta, double mMin, double mMax, double mc) Create anMfd.Builderfor a truncated Gutenberg–Richter MFD with an exponential taper. This implementation uses the scalar seismic moment based distribution of Kagan (2002), Equation 11 (seeMfds.paretoRate(double, double, double, double)for reference) to compute scale factors for each magnitude bin that are then applied to a standard Gutenberg–Richter distribution. When building the underlying magnitude distribution, this implementation rounds each magnitude to 4 decimal places. Note thatmMinandmMaxdefine the lowermost and uppermost magnitude bin edges in a magnitude distribution, respectively, and that magnitude values in a Gutenberg-Richter MFD are defined as bin centers. That is, ifmMin = 5.0andΔm = 0.1, the first magnitude in the distribution will bemMin + Δm / 2 = 5.05.- Parameters:
b- the Gutenberg-Richter b-valuemDelta- the magnitude step of the distributionmMin- the minimum truncation magnitudemMax- the maximum truncation magnitudemc- the corner magnitude of the distribution- Throws:
IllegalArgumentException- ifmMin,mMax, ormcis outside the range[-2.0..9.7]IllegalArgumentException- ifmMin > mMaxormcis notmMin < mc < mMaxIllegalArgumentException- ifmDelta > mMax – mMinIllegalArgumentException- ifbis outside the range[0..3]
-