From aedbe9a43531fca0c2add6b045ed0f08d20c71f4 Mon Sep 17 00:00:00 2001
From: Peter Powers <pmpowers@usgs.gov>
Date: Tue, 1 Feb 2022 20:21:42 -0700
Subject: [PATCH] removed deprecated calc entrypoints

---
 .../earthquake/nshmp/calc/Disaggregation.java | 81 ++++---------------
 .../earthquake/nshmp/calc/HazardCalcs.java    | 58 -------------
 2 files changed, 16 insertions(+), 123 deletions(-)

diff --git a/src/main/java/gov/usgs/earthquake/nshmp/calc/Disaggregation.java b/src/main/java/gov/usgs/earthquake/nshmp/calc/Disaggregation.java
index cef4d828..9fc84d9c 100644
--- a/src/main/java/gov/usgs/earthquake/nshmp/calc/Disaggregation.java
+++ b/src/main/java/gov/usgs/earthquake/nshmp/calc/Disaggregation.java
@@ -9,7 +9,6 @@ import java.util.EnumMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
-import java.util.Set;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Executor;
 import java.util.function.Function;
@@ -94,12 +93,16 @@ public final class Disaggregation {
   }
 
   /**
-   * Disaggregate {@code hazard} at the intensity measure level corresponding to
-   * the supplied {@code returnPeriod}. Only a single {@code Imt} will be
-   * processed if supplied.
+   * Disaggregate probabilistic seismic {@code hazard} at the intensity measure
+   * level corresponding to the supplied {@code returnPeriod} (in years).
+   * Disaggregation is performed for all IMTs specified in the {@code hazard}
+   * object. The calculation configuration file accompanying the {@code hazard}
+   * object is used to configure the disaggregations.
    *
-   * @param hazard to disaggregate.
-   * @param returnPeriod at which to disaggregate {@code hazard}
+   * @param hazard to disaggregate
+   * @param returnPeriod at which to disaggregate (in years)
+   * @param exec executor service to use for disaggregation
+   * @return a {@code Disaggregation} object
    */
   public static Disaggregation atReturnPeriod(
       Hazard hazard,
@@ -117,70 +120,18 @@ public final class Disaggregation {
     return atImls(hazard, imtImls, exec);
   }
 
-  @Deprecated
-  public static Disaggregation atReturnPeriodOld(
-      Hazard hazard,
-      double returnPeriod,
-      Executor exec) {
-
-    double rate = 1.0 / returnPeriod;
-    Set<Imt> imtsToDisagg = hazard.totalCurves.keySet();
-
-    DisaggConfig.Builder cb = DisaggConfig.builder(hazard);
-    HazardToDisagg transform = new HazardToDisagg(hazard);
-    AsyncList<ImtDisagg> futureImtDisaggs = AsyncList.createWithCapacity(imtsToDisagg.size());
-
-    for (Imt imt : imtsToDisagg) {
-      double iml = IML_INTERPOLATER.findX(hazard.totalCurves.get(imt), rate);
-      DisaggConfig config = cb.imt(imt).iml(iml, rate, returnPeriod).build();
-      futureImtDisaggs.add(toImtDisagg(transform, config, exec));
-    }
-
-    Map<Imt, ImtDisagg> imtDisaggs = toImtDisaggMap(futureImtDisaggs);
-    return new Disaggregation(imtDisaggs, hazard.site);
-  }
-
   /**
-   * Disaggregate {@code hazard} at the supplied intensity measure level. Only a
-   * single {@code Imt} will be processed if supplied.
-   *
-   * @param hazard to disaggregate.
-   * @param iml intensity measure level at which to disaggregate {@code hazard}
-   */
-  @Deprecated
-  public static Disaggregation atIml(
-      Hazard hazard,
-      double iml,
-      Executor exec) {
-
-    Set<Imt> imtsToDisagg = hazard.totalCurves.keySet();
-
-    DisaggConfig.Builder cb = DisaggConfig.builder(hazard);
-    HazardToDisagg transform = new HazardToDisagg(hazard);
-    AsyncList<ImtDisagg> futureImtDisaggs = AsyncList.createWithCapacity(imtsToDisagg.size());
-
-    double lnIml = Math.log(iml);
-    for (Imt imt : imtsToDisagg) {
-      double rate = RATE_INTERPOLATER.findY(hazard.totalCurves.get(imt), lnIml);
-      double returnPeriod = 1.0 / rate;
-      DisaggConfig config = cb.imt(imt).iml(lnIml, rate, returnPeriod).build();
-      futureImtDisaggs.add(toImtDisagg(transform, config, exec));
-    }
-
-    Map<Imt, ImtDisagg> imtDisaggs = toImtDisaggMap(futureImtDisaggs);
-    return new Disaggregation(imtDisaggs, hazard.site);
-  }
-
-  /**
-   * New primary entry point for disaggregation.
-   *
-   * Experimental: Disaggregate {@code hazard} at a unique intensity measure
-   * level for each IMT. Assumes hazard contains results for each IMT identified
-   * in the {@code imtImls} map.
+   * Disaggregate probabilistic seismic {@code hazard} at a unique intensity
+   * measure level for each IMT. Assumes hazard contains results for each IMT
+   * identified in the {@code imtImls} map. The calculation configuration file
+   * accompanying the {@code hazard} object is used to configure the
+   * disaggregations.
    *
    * @param hazard to disaggregate.
    * @param imtImls per-IMT intensity measure levels at which to disaggregate
    *        {@code hazard}
+   * @param exec executor service to use for disaggregation
+   * @return a {@code Disaggregation} object
    */
   public static Disaggregation atImls(
       Hazard hazard,
diff --git a/src/main/java/gov/usgs/earthquake/nshmp/calc/HazardCalcs.java b/src/main/java/gov/usgs/earthquake/nshmp/calc/HazardCalcs.java
index 05ee8950..11ad060b 100644
--- a/src/main/java/gov/usgs/earthquake/nshmp/calc/HazardCalcs.java
+++ b/src/main/java/gov/usgs/earthquake/nshmp/calc/HazardCalcs.java
@@ -8,7 +8,6 @@ import static gov.usgs.earthquake.nshmp.calc.CalcFactory.clustersToCurves;
 import static gov.usgs.earthquake.nshmp.calc.CalcFactory.sourcesToCurves;
 import static gov.usgs.earthquake.nshmp.calc.CalcFactory.systemToCurves;
 import static gov.usgs.earthquake.nshmp.calc.CalcFactory.toHazardResult;
-import static gov.usgs.earthquake.nshmp.data.DoubleData.checkInRange;
 import static gov.usgs.earthquake.nshmp.model.SourceType.FAULT;
 import static gov.usgs.earthquake.nshmp.model.SourceType.FAULT_CLUSTER;
 import static gov.usgs.earthquake.nshmp.model.SourceType.FAULT_SYSTEM;
@@ -96,63 +95,6 @@ public class HazardCalcs {
   private static Range<Double> rpRange = Range.closed(1.0, 20000.0);
   private static Range<Double> imlRange = Range.closed(0.0001, 8.0);
 
-  /**
-   * Disaggregate probabilistic seismic hazard at the supplied return period (in
-   * years). Disaggregation will performed for all IMTs specified for hazard.
-   *
-   * <p>Call this method with the {@link Hazard} result of
-   * {@link #hazard(HazardModel, CalcConfig, Site, Executor)} to which you
-   * supply the calculation settings and sites of interest that will also be
-   * used for disaggregation.
-   *
-   * <p><b>Note:</b> any model initialization settings in {@code config} will be
-   * ignored as the supplied model will already have been initialized.
-   *
-   * @param hazard to disaggregate
-   * @param returnPeriod at which to disaggregate (in years)
-   * @return a {@code Disaggregation} object
-   */
-  @Deprecated
-  public static Disaggregation disaggReturnPeriod(
-      Hazard hazard,
-      double returnPeriod,
-      Executor exec) {
-
-    checkNotNull(hazard);
-    checkInRange(rpRange, "Return period", returnPeriod);
-
-    return Disaggregation.atReturnPeriod(hazard, returnPeriod, exec);
-  }
-
-  /**
-   * Disaggregate probabilistic seismic hazard at the supplied intensity measure
-   * level (in units of g). Disaggregation will performed for all IMTs specified
-   * for hazard.
-   *
-   * <p>Call this method with the {@link Hazard} result of
-   * {@link #hazard(HazardModel, CalcConfig, Site, Executor)} to which you
-   * supply the calculation settings and sites of interest that will also be
-   * used for disaggregation.
-   *
-   * <p><b>Note:</b> any model initialization settings in {@code config} will be
-   * ignored as the supplied model will already have been initialized.
-   *
-   * @param hazard to disaggregate
-   * @param iml intensity measure level at which to disaggregate (in g)
-   * @return a {@code Disaggregation} object
-   */
-  @Deprecated
-  public static Disaggregation disaggIml(
-      Hazard hazard,
-      double iml,
-      Executor exec) {
-
-    checkNotNull(hazard);
-    checkInRange(imlRange, "Intensity measure level", iml);
-
-    return Disaggregation.atIml(hazard, iml, exec);
-  }
-
   /**
    * Compute probabilistic seismic hazard curves at a {@code site} using the
    * supplied {@code model} and {@code config}. If an {@code executor} is
-- 
GitLab