Skip to content

Commit

Permalink
Merge pull request #33 from pmpowers-usgs/master
Browse files Browse the repository at this point in the history
edits and config changes
  • Loading branch information
pmpowers-usgs committed Sep 25, 2015
2 parents af5ef05 + 6a71eb0 commit e492975
Show file tree
Hide file tree
Showing 12 changed files with 1,006 additions and 145 deletions.
2 changes: 1 addition & 1 deletion .classpath
Expand Up @@ -19,7 +19,7 @@
<attribute name="owner.project.facets" value="jst.utility"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/Java SE 7 [1.7.0_45]">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
Expand Down
1 change: 1 addition & 0 deletions .gitignore
@@ -1,3 +1,4 @@
.settings
/bin
/classes
/dist
Expand Down
3 changes: 2 additions & 1 deletion src/org/opensha2/calc/AsyncCalc.java
Expand Up @@ -193,7 +193,8 @@ static final List<HazardCurveSet> sourceSetToCurves(
InputList inputs = inputFn.apply(source);
// System.out.println("Inputs: " + inputs.size() + " " + sw);

Set<Gmm> gmms = sourceSet.groundMotionModels().gmms();
// TODO why isn't this outside the loop??
Set<Gmm> gmms = sourceSet.groundMotionModels().gmms();
Table<Gmm, Imt, GroundMotionModel> gmmInstances = Gmm.instances(gmms, config.imts);
Function<InputList, GroundMotions> gmFn = new InputsToGroundMotions(gmmInstances);
GroundMotions groundMotions = gmFn.apply(inputs);
Expand Down
82 changes: 76 additions & 6 deletions src/org/opensha2/calc/GridTableCalc.java
@@ -1,5 +1,10 @@
package org.opensha2.calc;

import org.opensha2.eq.model.GmmSet;
import org.opensha2.gmm.Gmm;
import org.opensha2.gmm.GroundMotionModel;
import org.opensha2.gmm.Imt;

/**
* Handler for hazard calculations where grid source ground motions have been
* precomputed for set magnitudes and distance bins
Expand All @@ -8,15 +13,80 @@
*/
@Deprecated
class GridTableCalc {

/*
* If, for a basic HazardResult, we want to be able to give a per-source-set
* decomposition by ground motion model, or just a decomposition of the total curve,
* we'll need to have a table of the curves for every model.
* If, for a basic HazardResult, we want to be able to give a per-source-set
* decomposition by ground motion model, or just a decomposition of the
* total curve, we'll need to have a table of the curves for every model.
*
* If not necessary, then can have table of total curves and table of mean
* (and sigma?) for each model. Just mean is necessary for deaggeregation
* epsilon
*
* OK... so...
*
* If not necessary, then can have table of total curves and table of mean (and sigma?)
* for each model. Just mean is necessary for deaggeregation epsilon
* Preliminary implementations of grid source optimizations modeled after
* the NSHMP Fortran codes porecomputed median curves in distance and
* magnitude (using a weighted combination of Gmms) and then performed
* lookups for each source, aggregating a total curve along the way. This
* approach is lossy in that data for individual Gmms is lost, and it was
* never extended to support deaggregation where ground motion mean and
* sigma are required.
*
* Further consideration of these issues suggests that, rather than
* agregating curves along the way, we should build a separate table in
* magnitude and distance of rates while looping over sources. At the end,
* curves could be computed once for each distance and magnitude bin.
* Although full curves for each Gmm could be precomputed, the time to loop
* over the rate table may not be significant enough to warrant the memory
* overhead (bear in mind that's a lot of curves when considering large
* logic trees of Gmms and numerous periods).
*
* There is also the additional issue of additional epistemic uncertinaty on
* ground motions, which does not need to be considered here if building
* magnitude-distance rate tables.
*
* There is the additional issue of different focal mechanisms. FOr NGAW2
* and the WUS, we would need to have 5 curves per gmm and r/m bin: 2
* reverse, 2 normal 1 strike slip
*
* Precomputed curves may still be warranted for map calculations where Gmm
* specific data and deaggregation are irrelevant.
*/

/*
* need to specify magnitude and distance discretization
*
* cache by GmmSet alone (need to maintain internal map by period) - or
* another internal cahce; a cache of caches sounds ugly and keeps the table
* management class simpler
*
* of cache by GmmSet and Imt
*
* class names GroundMotionCache cahce of ground motion tables in distance
* and magnitude
*
* How do we tell if hanging wall is needed?
*/

GridTableCalc(GmmSet gmmSet) {

// no hanging wall
for (Gmm gmm : gmmSet.gmms()) {

}
GroundMotionModel gmm = Gmm.ASK_14.instance(Imt.PGA);

// DataTableBuilder builder = DataTableBuilder.create().

// hanging wall
}

public enum SourceStyle {
STRIKE_SLIP,
REVERSE_FOOTWALL,
REVERSE_HANGINGWALL,
NORMAL_FOOTWALL,
NORMAL_HANGINGWALL;
}
}
2 changes: 1 addition & 1 deletion src/org/opensha2/data/ArrayXY_Sequence.java
Expand Up @@ -55,7 +55,7 @@ public class ArrayXY_Sequence extends AbstractXY_Sequence {
checkArgument(checkNotNull(xs).length > 1, "Xs too small");
if (ys == null) ys = new double[xs.length];
checkArgument(xs.length == ys.length, "Xs and Ys are different lengths");
checkArgument(isMonotonic(true, false, xs), "Non-monotonic x-values");
checkArgument(isMonotonic(true, true, xs), "Non-monotonic x-values");
this.xs = Arrays.copyOf(xs, xs.length);
this.ys = Arrays.copyOf(ys, ys.length);
xHash = Arrays.hashCode(xs);
Expand Down

0 comments on commit e492975

Please sign in to comment.