Skip to content
Snippets Groups Projects
Commit 77a30ab7 authored by Powers, Peter M.'s avatar Powers, Peter M.
Browse files

named sites flag

parent c0a6cde3
No related branches found
No related tags found
1 merge request!252Conditional spectrum (interim updates)
......@@ -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) {
......
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment