Skip to content
Snippets Groups Projects
Commit 7aaee54f authored by Powers, Peter M.'s avatar Powers, Peter M.
Browse files

added static gmm weight map to instance logic tree method

parent f328b837
No related branches found
No related tags found
1 merge request!434Ceus 2014 gmm
...@@ -8,9 +8,12 @@ import static gov.usgs.earthquake.nshmp.gmm.Imt.PGA; ...@@ -8,9 +8,12 @@ import static gov.usgs.earthquake.nshmp.gmm.Imt.PGA;
import static gov.usgs.earthquake.nshmp.gmm.Imt.SA0P02; import static gov.usgs.earthquake.nshmp.gmm.Imt.SA0P02;
import static java.lang.Math.log; import static java.lang.Math.log;
import java.util.Map;
import com.google.common.primitives.Doubles; import com.google.common.primitives.Doubles;
import gov.usgs.earthquake.nshmp.gmm.GroundMotionTables.GroundMotionTable; import gov.usgs.earthquake.nshmp.gmm.GroundMotionTables.GroundMotionTable;
import gov.usgs.earthquake.nshmp.tree.LogicTree;
/** /**
* Ground motion model (Gmm) utilities. * Ground motion model (Gmm) utilities.
...@@ -18,6 +21,9 @@ import gov.usgs.earthquake.nshmp.gmm.GroundMotionTables.GroundMotionTable; ...@@ -18,6 +21,9 @@ import gov.usgs.earthquake.nshmp.gmm.GroundMotionTables.GroundMotionTable;
*/ */
public final class GmmUtils { public final class GmmUtils {
/* Name for gmm logic tree; same as in Deserialize. */
private static final String TREE_NAME = "gmm-tree";
/* /*
* Base-10 to base-e conversion factor commonly used with ground motion lookup * Base-10 to base-e conversion factor commonly used with ground motion lookup
* tables that supply log10 instead of natural log values. This conversion * tables that supply log10 instead of natural log values. This conversion
...@@ -54,6 +60,22 @@ public final class GmmUtils { ...@@ -54,6 +60,22 @@ public final class GmmUtils {
: (rake >= -135 && rake <= -45) ? NORMAL : STRIKE_SLIP; : (rake >= -135 && rake <= -45) ? NORMAL : STRIKE_SLIP;
} }
/**
* Convert a map of GMMs and weights to a logic tree of instances for the
* supplied IMT.
*/
static LogicTree<GroundMotionModel> weightMapToInstanceTree(
Map<Gmm, Double> gmms,
Imt imt) {
LogicTree.EnumBuilder<Gmm, GroundMotionModel> tree = LogicTree.enumBuilder(TREE_NAME);
gmms.entrySet().forEach(e -> tree.addBranch(
e.getKey(),
e.getKey().instance(imt),
e.getValue()));
return tree.build();
}
/* Derived from z2p5 via mmoschetti's 2018 ngaw2 db regressions */ /* Derived from z2p5 via mmoschetti's 2018 ngaw2 db regressions */
static final double BASIN_Z1P0_UPPER = 0.3; static final double BASIN_Z1P0_UPPER = 0.3;
static final double BASIN_Z1P0_LOWER = 0.5; static final double BASIN_Z1P0_LOWER = 0.5;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment