From e08a523b73764203bcc1ecbdda5c19aa34314ce3 Mon Sep 17 00:00:00 2001
From: Brandon Clayton <bclayton@usgs.gov>
Date: Thu, 31 Oct 2024 13:30:19 -0600
Subject: [PATCH] use new method

---
 .../gov/usgs/earthquake/nshmp/www/hazard/DisaggService.java | 6 ++++--
 .../gov/usgs/earthquake/nshmp/www/hazard/HazardService.java | 4 +++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/main/java/gov/usgs/earthquake/nshmp/www/hazard/DisaggService.java b/src/main/java/gov/usgs/earthquake/nshmp/www/hazard/DisaggService.java
index 5f1d223f..a0bdb002 100644
--- a/src/main/java/gov/usgs/earthquake/nshmp/www/hazard/DisaggService.java
+++ b/src/main/java/gov/usgs/earthquake/nshmp/www/hazard/DisaggService.java
@@ -8,6 +8,7 @@ import static java.util.stream.Collectors.toList;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
+import java.util.OptionalDouble;
 import java.util.Set;
 import java.util.TreeMap;
 import java.util.concurrent.CompletableFuture;
@@ -27,6 +28,7 @@ import gov.usgs.earthquake.nshmp.calc.Disaggregation;
 import gov.usgs.earthquake.nshmp.calc.Hazard;
 import gov.usgs.earthquake.nshmp.calc.HazardCalcs;
 import gov.usgs.earthquake.nshmp.calc.Site;
+import gov.usgs.earthquake.nshmp.calc.Sites;
 import gov.usgs.earthquake.nshmp.geo.Location;
 import gov.usgs.earthquake.nshmp.gmm.Gmm;
 import gov.usgs.earthquake.nshmp.gmm.Imt;
@@ -147,7 +149,7 @@ public final class DisaggService {
         .build();
 
     Location loc = Location.create(request.longitude, request.latitude);
-    Site site = ServletUtil.createSite(loc, request.vs30, model.siteData());
+    Site site = Sites.locationToSite(loc, model.siteData(), OptionalDouble.of(request.vs30));
 
     // use HazardService.calcHazard() instead?
     CompletableFuture<Hazard> hazFuture = CompletableFuture.supplyAsync(
@@ -180,7 +182,7 @@ public final class DisaggService {
         .build();
 
     Location loc = Location.create(request.longitude, request.latitude);
-    Site site = ServletUtil.createSite(loc, request.vs30, model.siteData());
+    Site site = Sites.locationToSite(loc, model.siteData(), OptionalDouble.of(request.vs30));
 
     // could just get from HazardService
     CompletableFuture<Hazard> hazFuture = CompletableFuture.supplyAsync(
diff --git a/src/main/java/gov/usgs/earthquake/nshmp/www/hazard/HazardService.java b/src/main/java/gov/usgs/earthquake/nshmp/www/hazard/HazardService.java
index c6ba8adf..42830d66 100644
--- a/src/main/java/gov/usgs/earthquake/nshmp/www/hazard/HazardService.java
+++ b/src/main/java/gov/usgs/earthquake/nshmp/www/hazard/HazardService.java
@@ -12,6 +12,7 @@ import java.util.EnumMap;
 import java.util.EnumSet;
 import java.util.List;
 import java.util.Map;
+import java.util.OptionalDouble;
 import java.util.Set;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ExecutionException;
@@ -26,6 +27,7 @@ import gov.usgs.earthquake.nshmp.calc.DataType;
 import gov.usgs.earthquake.nshmp.calc.Hazard;
 import gov.usgs.earthquake.nshmp.calc.HazardCalcs;
 import gov.usgs.earthquake.nshmp.calc.Site;
+import gov.usgs.earthquake.nshmp.calc.Sites;
 import gov.usgs.earthquake.nshmp.data.MutableXySequence;
 import gov.usgs.earthquake.nshmp.data.XySequence;
 import gov.usgs.earthquake.nshmp.geo.Location;
@@ -114,7 +116,7 @@ public final class HazardService {
         .build();
 
     Location loc = Location.create(request.longitude, request.latitude);
-    Site site = ServletUtil.createSite(loc, request.vs30, model.siteData());
+    Site site = Sites.locationToSite(loc, model.siteData(), OptionalDouble.of(request.vs30));
 
     CompletableFuture<Hazard> future = CompletableFuture.supplyAsync(
         () -> HazardCalcs.hazard(
-- 
GitLab