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

removed unnecessary methods from export classes

parent 47d4cdc9
No related branches found
No related tags found
1 merge request!251Export updates
package gov.usgs.earthquake.nshmp.calc;
import static com.google.common.base.Preconditions.checkState;
import static java.nio.file.StandardOpenOption.APPEND;
import java.io.IOException;
......@@ -41,11 +40,8 @@ public final class EqRateExport {
private final HazardModel model;
private final boolean exportSource;
private int resultCount = 0;
private final boolean namedSites;
private boolean firstRecord = true;
private boolean used = false;
private EqRateExport(
HazardModel model,
......@@ -90,37 +86,6 @@ public final class EqRateExport {
* @param rate data container to add
*/
public void write(EqRate rate) throws IOException {
checkState(!used, "This result handler is expired");
writeRate(rate);
resultCount++;
}
/**
* Flushes any remaining results, stops all timers and sets the state of this
* exporter to 'used'; no more results may be added.
*/
public void expire() {
used = true;
}
/**
* The number of rate results passed to this handler thus far.
*/
public int resultCount() {
return resultCount;
}
/**
* The target output directory established by this handler.
*/
public Path outputDir() {
return out;
}
/*
* Write the current list of {@code EqRate}s to file.
*/
private void writeRate(EqRate rate) throws IOException {
Iterable<Double> emptyValues = Doubles.asList(new double[rate.totalMfd.size()]);
Function<Double, String> formatter = Parsing.formatDoubleFunction(valueFormat);
......
package gov.usgs.earthquake.nshmp.calc;
import static com.google.common.base.Preconditions.checkState;
import static gov.usgs.earthquake.nshmp.calc.ValueFormat.POISSON_PROBABILITY;
import static gov.usgs.earthquake.nshmp.data.MutableXySequence.emptyCopyOf;
import static java.nio.charset.StandardCharsets.UTF_8;
......@@ -51,14 +50,6 @@ import gov.usgs.earthquake.nshmp.model.SourceType;
*/
public final class HazardExport {
/*
* Developer notes
*
* Export of gmm and source type is unreliable for results where multiple
* models may have been run (e.g. Hazard2018) because the model.types() and
* model.gmms() methods will only reflect a single model.
*/
private static final String GMM_DIR = "gmm";
static final String TYPE_DIR = "source";
private static final String CURVE_FILE_ASCII = "curves.csv";
......@@ -73,10 +64,7 @@ public final class HazardExport {
private final Function<Double, String> valueFormatter;
private int resultCount = 0;
private final boolean namedSites;
private boolean used = false;
private HazardExport(
HazardModel model,
......@@ -189,35 +177,6 @@ public final class HazardExport {
* @param hazard to write
*/
public void write(Hazard hazard) throws IOException {
checkState(!used, "This result handler is expired");
writeHazard(hazard);
resultCount++;
}
/**
* Stops all timers and sets the state of this {@code Results} instance to
* 'used'; no more results may be added.
*/
public void expire() {
used = true;
}
/**
* The number of hazard results passed to this handler thus far.
*/
public int resultCount() {
return resultCount;
}
/**
* The target output directory established by this handler.
*/
public Path outputDir() {
return out;
}
/* Write the supplied hazard results to file(s). */
private void writeHazard(Hazard hazard) throws IOException {
Set<Gmm> gmms = hazard.model.gmms();
Set<SourceType> types = hazard.model.types();
......
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