diff --git a/src/main/java/gov/usgs/earthquake/nshmp/calc/HazardExport.java b/src/main/java/gov/usgs/earthquake/nshmp/calc/HazardExport.java index 47ccd92e82dc3bc96579438e7745172c9763a5d1..8a62bce2c709d3a6813632596cedba6a4118b184 100644 --- a/src/main/java/gov/usgs/earthquake/nshmp/calc/HazardExport.java +++ b/src/main/java/gov/usgs/earthquake/nshmp/calc/HazardExport.java @@ -69,7 +69,7 @@ public final class HazardExport { private HazardExport( HazardModel model, CalcConfig config, - List<Site> sites, + boolean namedSites, Path out) throws IOException { this.out = out; @@ -83,10 +83,8 @@ public final class HazardExport { ? Maths.annualRateToProbabilityConverter().andThen(formatter) : formatter; - Site demoSite = sites.get(0); - this.namedSites = demoSite.name() != Site.NO_NAME; - - init(sites); + this.namedSites = namedSites; + init(); } /** @@ -94,21 +92,22 @@ public final class HazardExport { * * @param model being run * @param config that specifies output options and formats - * @param sites reference to the sites to be processed (not retained) + * @param namedSites whether the sites being processed contain a 'name' column + * that should be preserved in output files * @param out results directory; this may have been been modified from * {@code config.output.directory} by calling program */ public static HazardExport create( HazardModel model, CalcConfig config, - List<Site> sites, + boolean namedSites, Path out) throws IOException { - return new HazardExport(model, config, sites, out); + return new HazardExport(model, config, namedSites, out); } /* Initialize output directories. */ - private void init(List<Site> sites) throws IOException { + private void init() throws IOException { for (Imt imt : config.hazard.imts) { diff --git a/src/test/java/gov/usgs/earthquake/nshmp/model/LoaderTests.java b/src/test/java/gov/usgs/earthquake/nshmp/model/LoaderTests.java index 0b79509351ee2bb23c1705a18ec4e8230811faa3..aca6c3d41cd0b1e20becc6f8b3082d367c8f019b 100644 --- a/src/test/java/gov/usgs/earthquake/nshmp/model/LoaderTests.java +++ b/src/test/java/gov/usgs/earthquake/nshmp/model/LoaderTests.java @@ -214,7 +214,8 @@ class LoaderTests { List<Site> sites) throws IOException { ExecutorService exec = initExecutor(config.performance.threadCount); - HazardExport handler = HazardExport.create(model, config, sites, config.output.directory); + boolean namedSites = sites.get(0).name() != Site.NO_NAME; + HazardExport handler = HazardExport.create(model, config, namedSites, config.output.directory); for (Site site : sites) { Hazard hazard = HazardCalcs.hazard(model, config, site, exec); handler.write(hazard);