From e1687bd826ade5f3f6216e164069d99586fa4b37 Mon Sep 17 00:00:00 2001
From: Peter Powers <pmpowers@usgs.gov>
Date: Mon, 21 Oct 2024 16:51:03 -0600
Subject: [PATCH] added no-epi flavors to nga sub gmms

---
 .../nshmp/gmm/AbrahamsonGulerce_2020.java     | 36 +++++++++++++++-
 .../gov/usgs/earthquake/nshmp/gmm/Gmm.java    | 42 +++++++++++++++++++
 .../earthquake/nshmp/gmm/KuehnEtAl_2020.java  | 34 ++++++++++++++-
 .../earthquake/nshmp/gmm/ParkerEtAl_2020.java | 38 +++++++++++++++--
 4 files changed, 144 insertions(+), 6 deletions(-)

diff --git a/src/main/java/gov/usgs/earthquake/nshmp/gmm/AbrahamsonGulerce_2020.java b/src/main/java/gov/usgs/earthquake/nshmp/gmm/AbrahamsonGulerce_2020.java
index 16cd08f2..b02b7fd9 100644
--- a/src/main/java/gov/usgs/earthquake/nshmp/gmm/AbrahamsonGulerce_2020.java
+++ b/src/main/java/gov/usgs/earthquake/nshmp/gmm/AbrahamsonGulerce_2020.java
@@ -244,7 +244,7 @@ public abstract class AbrahamsonGulerce_2020 implements GroundMotionModel {
   }
 
   @Override
-  public final LogicTree<GroundMotion> calc(GmmInput in) {
+  public LogicTree<GroundMotion> calc(GmmInput in) {
 
     if (coeffs.imt == PGV) {
       GroundMotion pgv = UsgsPgvSupport.calcAB20Pgv(subtype, in);
@@ -449,6 +449,22 @@ public abstract class AbrahamsonGulerce_2020 implements GroundMotionModel {
     }
   }
 
+  static final class GlobalInterfaceNoEpi extends GlobalInterface {
+    static final String NAME = GlobalInterface.NAME + " (no epi)";
+
+    GlobalInterfaceNoEpi(Imt imt) {
+      super(imt);
+    }
+
+    @Override
+    public final LogicTree<GroundMotion> calc(GmmInput in) {
+      // TODO epistemic uncertainty should be configurable
+      // or controlled in the main calc method
+      GroundMotion gm = super.calc(in).get(1).value();
+      return GroundMotions.createTree(gm.mean(), gm.sigma());
+    }
+  }
+
   static final class GlobalInterfaceAkAdjusted extends GlobalInterface {
     static final String NAME = GlobalInterface.NAME + " (Alaska Adjusted)";
 
@@ -462,7 +478,7 @@ public abstract class AbrahamsonGulerce_2020 implements GroundMotionModel {
     }
   }
 
-  static final class GlobalSlab extends Global {
+  static class GlobalSlab extends Global {
     static final String NAME = Global.NAME + " : " + SLAB;
 
     GlobalSlab(Imt imt) {
@@ -475,6 +491,22 @@ public abstract class AbrahamsonGulerce_2020 implements GroundMotionModel {
     }
   }
 
+  static final class GlobalSlabNoEpi extends GlobalSlab {
+    static final String NAME = GlobalSlab.NAME + " (no epi)";
+
+    GlobalSlabNoEpi(Imt imt) {
+      super(imt);
+    }
+
+    @Override
+    public final LogicTree<GroundMotion> calc(GmmInput in) {
+      // TODO epistemic uncertainty should be configurable
+      // or controlled in the main calc method
+      GroundMotion gm = super.calc(in).get(1).value();
+      return GroundMotions.createTree(gm.mean(), gm.sigma());
+    }
+  }
+
   static class CascadiaInterface extends Cascadia {
     static final String NAME = Cascadia.NAME + " : " + INTERFACE;
 
diff --git a/src/main/java/gov/usgs/earthquake/nshmp/gmm/Gmm.java b/src/main/java/gov/usgs/earthquake/nshmp/gmm/Gmm.java
index ef81df50..b6b23272 100644
--- a/src/main/java/gov/usgs/earthquake/nshmp/gmm/Gmm.java
+++ b/src/main/java/gov/usgs/earthquake/nshmp/gmm/Gmm.java
@@ -445,6 +445,13 @@ public enum Gmm {
       AbrahamsonGulerce_2020.COEFFS,
       AbrahamsonGulerce_2020.CONSTRAINTS_INTERFACE),
 
+  /** @see AbrahamsonGulerce_2020 */
+  AG_20_GLOBAL_INTERFACE_NO_EPI(
+      AbrahamsonGulerce_2020.GlobalInterfaceNoEpi.class,
+      AbrahamsonGulerce_2020.GlobalInterfaceNoEpi.NAME,
+      AbrahamsonGulerce_2020.COEFFS,
+      AbrahamsonGulerce_2020.CONSTRAINTS_INTERFACE),
+
   /** @see AbrahamsonGulerce_2020 */
   AG_20_GLOBAL_INTERFACE_AK_ADJUSTED(
       AbrahamsonGulerce_2020.GlobalInterfaceAkAdjusted.class,
@@ -459,6 +466,13 @@ public enum Gmm {
       AbrahamsonGulerce_2020.COEFFS,
       AbrahamsonGulerce_2020.CONSTRAINTS_SLAB),
 
+  /** @see AbrahamsonGulerce_2020 */
+  AG_20_GLOBAL_SLAB_NO_EPI(
+      AbrahamsonGulerce_2020.GlobalSlabNoEpi.class,
+      AbrahamsonGulerce_2020.GlobalSlabNoEpi.NAME,
+      AbrahamsonGulerce_2020.COEFFS,
+      AbrahamsonGulerce_2020.CONSTRAINTS_SLAB),
+
   /** @see AbrahamsonGulerce_2020 */
   AG_20_CASCADIA_INTERFACE(
       AbrahamsonGulerce_2020.CascadiaInterface.class,
@@ -550,6 +564,13 @@ public enum Gmm {
       ParkerEtAl_2020.COEFFS_INTERFACE,
       ParkerEtAl_2020.CONSTRAINTS_INTERFACE),
 
+  /** @see ParkerEtAl_2020 */
+  PSBAH_20_GLOBAL_INTERFACE_NO_EPI(
+      ParkerEtAl_2020.GlobalInterfaceNoEpi.class,
+      ParkerEtAl_2020.GlobalInterfaceNoEpi.NAME,
+      ParkerEtAl_2020.COEFFS_INTERFACE,
+      ParkerEtAl_2020.CONSTRAINTS_INTERFACE),
+
   /** @see ParkerEtAl_2020 */
   PSBAH_20_GLOBAL_INTERFACE_AK_ADJUSTED(
       ParkerEtAl_2020.GlobalInterfaceAkAdjusted.class,
@@ -564,6 +585,13 @@ public enum Gmm {
       ParkerEtAl_2020.COEFFS_SLAB,
       ParkerEtAl_2020.CONSTRAINTS_SLAB),
 
+  /** @see ParkerEtAl_2020 */
+  PSBAH_20_GLOBAL_SLAB_NO_EPI(
+      ParkerEtAl_2020.GlobalSlabNoEpi.class,
+      ParkerEtAl_2020.GlobalSlabNoEpi.NAME,
+      ParkerEtAl_2020.COEFFS_SLAB,
+      ParkerEtAl_2020.CONSTRAINTS_SLAB),
+
   /** @see ParkerEtAl_2020 */
   PSBAH_20_CASCADIA_INTERFACE(
       ParkerEtAl_2020.CascadiaInterface.class,
@@ -620,6 +648,13 @@ public enum Gmm {
       KuehnEtAl_2020.COEFFS,
       KuehnEtAl_2020.CONSTRAINTS_INTERFACE),
 
+  /** @see KuehnEtAl_2020 */
+  KBCG_20_GLOBAL_INTERFACE_NO_EPI(
+      KuehnEtAl_2020.GlobalInterfaceNoEpi.class,
+      KuehnEtAl_2020.GlobalInterfaceNoEpi.NAME,
+      KuehnEtAl_2020.COEFFS,
+      KuehnEtAl_2020.CONSTRAINTS_INTERFACE),
+
   /** @see KuehnEtAl_2020 */
   KBCG_20_GLOBAL_INTERFACE_AK_ADJUSTED(
       KuehnEtAl_2020.GlobalInterfaceAkAdjusted.class,
@@ -634,6 +669,13 @@ public enum Gmm {
       KuehnEtAl_2020.COEFFS,
       KuehnEtAl_2020.CONSTRAINTS_SLAB),
 
+  /** @see KuehnEtAl_2020 */
+  KBCG_20_GLOBAL_SLAB_NO_EPI(
+      KuehnEtAl_2020.GlobalSlabNoEpi.class,
+      KuehnEtAl_2020.GlobalSlabNoEpi.NAME,
+      KuehnEtAl_2020.COEFFS,
+      KuehnEtAl_2020.CONSTRAINTS_SLAB),
+
   /** @see KuehnEtAl_2020 */
   KBCG_20_CASCADIA_INTERFACE(
       KuehnEtAl_2020.CascadiaInterface.class,
diff --git a/src/main/java/gov/usgs/earthquake/nshmp/gmm/KuehnEtAl_2020.java b/src/main/java/gov/usgs/earthquake/nshmp/gmm/KuehnEtAl_2020.java
index 7ec3bea9..ebcc629d 100644
--- a/src/main/java/gov/usgs/earthquake/nshmp/gmm/KuehnEtAl_2020.java
+++ b/src/main/java/gov/usgs/earthquake/nshmp/gmm/KuehnEtAl_2020.java
@@ -570,7 +570,7 @@ public abstract class KuehnEtAl_2020 implements GroundMotionModel {
     }
   }
 
-  static final class GlobalInterface extends Global {
+  static class GlobalInterface extends Global {
     static final String NAME = Global.NAME + " : " + INTERFACE;
 
     GlobalInterface(Imt imt) {
@@ -578,6 +578,22 @@ public abstract class KuehnEtAl_2020 implements GroundMotionModel {
     }
   }
 
+  static final class GlobalInterfaceNoEpi extends GlobalInterface {
+    static final String NAME = GlobalInterface.NAME + " (no epi)";
+
+    GlobalInterfaceNoEpi(Imt imt) {
+      super(imt);
+    }
+
+    @Override
+    public final LogicTree<GroundMotion> calc(GmmInput in) {
+      // TODO epistemic uncertainty should be configurable
+      // or controlled in the main calc method
+      GroundMotion gm = super.calc(in).get(1).value();
+      return GroundMotions.createTree(gm.mean(), gm.sigma());
+    }
+  }
+
   static final class GlobalInterfaceAkAdjusted extends Global {
     static final String NAME = GlobalInterface.NAME + " (Alaska Adjusted)";
 
@@ -604,6 +620,22 @@ public abstract class KuehnEtAl_2020 implements GroundMotionModel {
     }
   }
 
+  static final class GlobalSlabNoEpi extends GlobalSlab {
+    static final String NAME = GlobalSlab.NAME + " (no epi)";
+
+    GlobalSlabNoEpi(Imt imt) {
+      super(imt);
+    }
+
+    @Override
+    public final LogicTree<GroundMotion> calc(GmmInput in) {
+      // TODO epistemic uncertainty should be configurable
+      // or controlled in the main calc method
+      GroundMotion gm = super.calc(in).get(1).value();
+      return GroundMotions.createTree(gm.mean(), gm.sigma());
+    }
+  }
+
   /*
    * 2023-02-23 @pmpowers: Keuhn's Seattle basin model and the M9 adjustments
    * are both dependent on a site being inside the Seattle basin polygon. The M9
diff --git a/src/main/java/gov/usgs/earthquake/nshmp/gmm/ParkerEtAl_2020.java b/src/main/java/gov/usgs/earthquake/nshmp/gmm/ParkerEtAl_2020.java
index 73238b62..2505d3c2 100644
--- a/src/main/java/gov/usgs/earthquake/nshmp/gmm/ParkerEtAl_2020.java
+++ b/src/main/java/gov/usgs/earthquake/nshmp/gmm/ParkerEtAl_2020.java
@@ -296,7 +296,7 @@ public abstract class ParkerEtAl_2020 implements GroundMotionModel {
   }
 
   @Override
-  public final LogicTree<GroundMotion> calc(GmmInput in) {
+  public LogicTree<GroundMotion> calc(GmmInput in) {
 
     double pgaRef = exp(calcMean(
         coeffsPGA, slab(), akBiasAdjusted(), in));
@@ -554,7 +554,7 @@ public abstract class ParkerEtAl_2020 implements GroundMotionModel {
     }
   }
 
-  static final class GlobalInterface extends Global {
+  static class GlobalInterface extends Global {
     static final String NAME = Global.NAME + " : " + INTERFACE;
 
     GlobalInterface(Imt imt) {
@@ -562,6 +562,22 @@ public abstract class ParkerEtAl_2020 implements GroundMotionModel {
     }
   }
 
+  static final class GlobalInterfaceNoEpi extends GlobalInterface {
+    static final String NAME = GlobalInterface.NAME + " (no epi)";
+
+    GlobalInterfaceNoEpi(Imt imt) {
+      super(imt);
+    }
+
+    @Override
+    public final LogicTree<GroundMotion> calc(GmmInput in) {
+      // TODO epistemic uncertainty should be configurable
+      // or controlled in the main calc method
+      GroundMotion gm = super.calc(in).get(1).value();
+      return GroundMotions.createTree(gm.mean(), gm.sigma());
+    }
+  }
+
   static final class GlobalInterfaceAkAdjusted extends Global {
     static final String NAME = GlobalInterface.NAME + " (Alaska Adjusted)";
 
@@ -575,7 +591,7 @@ public abstract class ParkerEtAl_2020 implements GroundMotionModel {
     }
   }
 
-  static final class GlobalSlab extends Global {
+  static class GlobalSlab extends Global {
     static final String NAME = Global.NAME + " : " + SLAB;
 
     GlobalSlab(Imt imt) {
@@ -588,6 +604,22 @@ public abstract class ParkerEtAl_2020 implements GroundMotionModel {
     }
   }
 
+  static final class GlobalSlabNoEpi extends GlobalSlab {
+    static final String NAME = GlobalSlab.NAME + " (no epi)";
+
+    GlobalSlabNoEpi(Imt imt) {
+      super(imt);
+    }
+
+    @Override
+    public final LogicTree<GroundMotion> calc(GmmInput in) {
+      // TODO epistemic uncertainty should be configurable
+      // or controlled in the main calc method
+      GroundMotion gm = super.calc(in).get(1).value();
+      return GroundMotions.createTree(gm.mean(), gm.sigma());
+    }
+  }
+
   static class CascadiaInterface extends Cascadia {
     static final String NAME = Cascadia.NAME + " : " + INTERFACE;
 
-- 
GitLab