diff --git a/src/main/java/gov/usgs/earthquake/nshmp/model/Models.java b/src/main/java/gov/usgs/earthquake/nshmp/model/Models.java index 5f9b8a6bce7726cb79091acfbfc91a74721e35d1..c84537fd26c29c09e5592396ad72eb1f7f0a26a0 100644 --- a/src/main/java/gov/usgs/earthquake/nshmp/model/Models.java +++ b/src/main/java/gov/usgs/earthquake/nshmp/model/Models.java @@ -15,7 +15,9 @@ import java.util.stream.Collectors; import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import gov.usgs.earthquake.nshmp.data.XySequence; import gov.usgs.earthquake.nshmp.mfd.Mfd; +import gov.usgs.earthquake.nshmp.mfd.Mfds; import gov.usgs.earthquake.nshmp.model.SourceTree.Leaf; import gov.usgs.earthquake.nshmp.tree.Branch; @@ -70,7 +72,6 @@ public class Models { // System.out.println(GSON.toJson(tree(model, 2591))); // Stonewall Ant. System.out.println(GSON.toJson(tree(model, 2535))); // Steens - } /** @@ -156,6 +157,7 @@ public class Models { final String path; final TectonicSetting setting; final SourceType type; + final XySequence totalMfd; final List<SourceBranch> branches; Tree(SourceTree tree, Path modelRoot) { @@ -164,6 +166,8 @@ public class Models { this.path = modelRoot.relativize(tree.path()).toString(); this.setting = tree.setting(); this.type = tree.type(); + this.totalMfd = Mfds.combine(tree.stream().map(branch -> branch.value().totalMfd()) + .collect(Collectors.toList())).data(); List<SourceBranch> branches = new ArrayList<>(); diff --git a/src/main/java/gov/usgs/earthquake/nshmp/model/RuptureSet.java b/src/main/java/gov/usgs/earthquake/nshmp/model/RuptureSet.java index 420bd54613bf2eb4a78ae3266cc3cf1da5fa2a57..b3fcaa5302349c9e194085aff659d9ac7d08f5ba 100644 --- a/src/main/java/gov/usgs/earthquake/nshmp/model/RuptureSet.java +++ b/src/main/java/gov/usgs/earthquake/nshmp/model/RuptureSet.java @@ -16,6 +16,13 @@ import gov.usgs.earthquake.nshmp.tree.LogicTree; */ public interface RuptureSet<T extends Source> extends Iterable<T> { + /** + * Return the total Mfd. + */ + default Mfd totalMfd() { + return ModelTrees.reduceMfdTree(mfdTree()); + }; + /** * The display name of the rupture set. */ @@ -97,12 +104,6 @@ public interface RuptureSet<T extends Source> extends Iterable<T> { */ Predicate<T> distanceFilter(Location loc, double distance); - /** - * Return the total - * @return - */ - // Mfd mfd(); - // instead of Source // interface .Model