From 3dcc172780131b4708e09e7eb6a894fe6f03dd4e Mon Sep 17 00:00:00 2001
From: Peter Powers <pmpowers@usgs.gov>
Date: Tue, 25 Jan 2022 14:15:55 -0700
Subject: [PATCH] disagg epsilon output options from config

---
 .../java/gov/usgs/earthquake/nshmp/DisaggEpsilon.java    | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/main/java/gov/usgs/earthquake/nshmp/DisaggEpsilon.java b/src/main/java/gov/usgs/earthquake/nshmp/DisaggEpsilon.java
index 2b9e4075f..d10e9eda7 100644
--- a/src/main/java/gov/usgs/earthquake/nshmp/DisaggEpsilon.java
+++ b/src/main/java/gov/usgs/earthquake/nshmp/DisaggEpsilon.java
@@ -2,6 +2,8 @@ package gov.usgs.earthquake.nshmp;
 
 import static com.google.common.base.Preconditions.checkArgument;
 import static gov.usgs.earthquake.nshmp.Text.NEWLINE;
+import static gov.usgs.earthquake.nshmp.calc.DataType.GMM;
+import static gov.usgs.earthquake.nshmp.calc.DataType.SOURCE;
 
 import java.io.IOException;
 import java.io.Writer;
@@ -251,10 +253,13 @@ public class DisaggEpsilon {
       Site site = sites.get(i);
       Map<Imt, Double> spectrum = rtrSpectra.get(i);
 
-      // use IMLs from site spectra
+      // task: use IMLs from site spectra
       Hazard hazard = HazardCalcs.hazard(model, config, site, exec);
       Disaggregation disagg = Disaggregation.atImls(hazard, spectrum, exec);
 
+      boolean gmmsOut = config.output.dataTypes.contains(GMM);
+      boolean typesOut = config.output.dataTypes.contains(SOURCE);
+
       List<Response> responses = new ArrayList<>(spectrum.size());
       for (Imt imt : spectrum.keySet()) {
         ResponseData imtMetadata = new ResponseData(
@@ -264,7 +269,7 @@ public class DisaggEpsilon {
             spectrum.get(imt));
         Response response = new Response(
             imtMetadata,
-            disagg.toJson(imt, false, true, true, false));
+            disagg.toJson(imt, false, gmmsOut, typesOut, false));
         responses.add(response);
       }
       Result result = new Result(responses);
-- 
GitLab