From db19afd0423e240ed99f31843db483e93bbec413 Mon Sep 17 00:00:00 2001
From: Peter Powers <pmpowers@usgs.gov>
Date: Tue, 12 Nov 2024 12:38:16 -0700
Subject: [PATCH] lib update with config ret period --> double

---
 gradle.properties                             |  2 +-
 .../gov/usgs/earthquake/nshmp/HazardMaps.java | 21 +++++++++----------
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/gradle.properties b/gradle.properties
index d804c184..a68dc200 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -12,7 +12,7 @@ micronautVersion = 3.2.3
 micronautRxVersion = 2.1.1
 nodePluginVersion = 3.0.1
 nodeVersion = 16.3.0
-nshmpLibVersion = 1.5.1
+nshmpLibVersion = 1.5.2
 nshmpUtilsJavaVersion = 0.4.0
 openApiVersion = 4.0.0
 shadowVersion = 7.1.2
diff --git a/src/main/java/gov/usgs/earthquake/nshmp/HazardMaps.java b/src/main/java/gov/usgs/earthquake/nshmp/HazardMaps.java
index a93b4130..27763a21 100644
--- a/src/main/java/gov/usgs/earthquake/nshmp/HazardMaps.java
+++ b/src/main/java/gov/usgs/earthquake/nshmp/HazardMaps.java
@@ -27,7 +27,7 @@ public class HazardMaps {
 
   private static final String COMMA = ",";
   private static final String CURVES_FILE = "curves.csv";
-  private static final List<Integer> DEFAULT_RETURN_PERIODS = List.of(475, 975, 2475);
+  private static final List<Double> DEFAULT_RETURN_PERIODS = List.of(475.0, 975.0, 2475.0);
   private static final Interpolator INTERPOLATOR = Interpolator.builder()
       .logx()
       .logy()
@@ -61,14 +61,13 @@ public class HazardMaps {
     }
 
     Path curvesPath = Path.of(args[0]);
-    List<Integer> returnPeriods = DEFAULT_RETURN_PERIODS;
+    List<Double> returnPeriods = DEFAULT_RETURN_PERIODS;
     Logger log = Logger.getLogger(HazardMaps.class.getName());
 
     if (args.length > 1) {
       returnPeriods = Arrays.stream(args)
           .skip(1)
-          .mapToInt(Integer::valueOf)
-          .boxed()
+          .map(Double::valueOf)
           .collect(Collectors.toList());
     }
 
@@ -83,7 +82,7 @@ public class HazardMaps {
 
   static void createDataSets(
       Path curvesPath,
-      List<Integer> returnPeriods,
+      List<Double> returnPeriods,
       Logger log) throws IOException {
     log.info(PROGRAM + ": Creating hazard map datasets...");
     log.info("    Return periods: " + returnPeriods.toString());
@@ -97,7 +96,7 @@ public class HazardMaps {
     }
   }
 
-  private static List<String> create(List<String> lines, List<Integer> returnPeriods) {
+  private static List<String> create(List<String> lines, List<Double> returnPeriods) {
     int headerCount = lines.get(0).startsWith("name") ? 3 : 2;
     List<String> header = Arrays.asList(lines.get(0).split(COMMA));
 
@@ -126,7 +125,7 @@ public class HazardMaps {
     return linesOut;
   }
 
-  private static void processCurveFile(Path curves, List<Integer> returnPeriods) {
+  private static void processCurveFile(Path curves, List<Double> returnPeriods) {
     try (Stream<String> stream = Files.lines(curves)) {
       List<String> linesIn = stream.collect(Collectors.toList());
       List<String> linesOut = create(linesIn, returnPeriods);
@@ -138,9 +137,9 @@ public class HazardMaps {
   }
 
   private static class CurvesVisitor extends SimpleFileVisitor<Path> {
-    List<Integer> returnPeriods;
+    List<Double> returnPeriods;
 
-    public CurvesVisitor(List<Integer> returnPeriods) {
+    public CurvesVisitor(List<Double> returnPeriods) {
       this.returnPeriods = returnPeriods;
     }
 
@@ -155,11 +154,11 @@ public class HazardMaps {
   }
 
   private static class Slicer {
-    private final List<Integer> returnPeriods;
+    private final List<Double> returnPeriods;
     private final double[] imls;
     private final int headerCount;
 
-    private Slicer(List<Integer> returnPeriods, double imls[], int headerCount) {
+    private Slicer(List<Double> returnPeriods, double imls[], int headerCount) {
       this.returnPeriods = returnPeriods;
       this.imls = imls;
       this.headerCount = headerCount;
-- 
GitLab