Skip to content

Commit

Permalink
Merge pull request #206 from pmpowers-usgs/deagg-gmm-bug-205
Browse files Browse the repository at this point in the history
Fix for deagg failures
  • Loading branch information
pmpowers-usgs committed Mar 28, 2017
2 parents 632d854 + 61a97ef commit 44d2b87
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/org/opensha2/calc/Deaggregator.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,20 @@ private Map<Gmm, DeaggDataset> processClusterSources() {
for (Entry<Gmm, DeaggDataset.Builder> entry : datasetBuilders.entrySet()) {

/*
* Scale, skipping clusters that do not contribute as their attendant
* sources will also not contribute and 0/0 will yield NaNs.
* Due to Gmm variations with distance, cluster curves for some GMMs may
* not have been calculated. Skip non-participating clusters (curve will
* be absent). Scale to total cluster rate. Builder rate > 0.0 check
* assures no 0/0 --> NaN and is necessary for curves that are present
* but that end below the target deagg iml.
*/
Gmm gmm = entry.getKey();
DeaggDataset.Builder clusterBuilder = entry.getValue();
XySequence clusterCurve = clusterCurves.get(gmm);
double clusterRate = Deaggregation.RATE_INTERPOLATER.findY(clusterCurve, iml);
if (clusterBuilder.rate() > 0.0) {
clusterBuilder.multiply(clusterRate / clusterBuilder.rate());
if (clusterCurves.containsKey(gmm)) {
XySequence clusterCurve = clusterCurves.get(gmm);
double clusterRate = Deaggregation.RATE_INTERPOLATER.findY(clusterCurve, iml);
if (clusterBuilder.rate() > 0.0) {
clusterBuilder.multiply(clusterRate / clusterBuilder.rate());
}
}

/* Swap parents. */
Expand Down

0 comments on commit 44d2b87

Please sign in to comment.