org.opensha.sha.calc.hazardMap.components
Class AsciiFileCurveArchiver

java.lang.Object
  extended by org.opensha.sha.calc.hazardMap.components.AsciiFileCurveArchiver
All Implemented Interfaces:
XMLSaveable, CurveResultsArchiver

public class AsciiFileCurveArchiver
extends java.lang.Object
implements CurveResultsArchiver

This class writes hazard curves to simple output files.

Author:
kevin

Field Summary
static java.lang.String XML_METADATA_NAME
           
 
Constructor Summary
AsciiFileCurveArchiver(java.lang.String outputDir, boolean binByLat, boolean binByLon)
           
 
Method Summary
 void archiveCurve(DiscretizedFunc curve, CurveMetadata meta)
          This stores the curve for the given site.
 void close()
           
static AsciiFileCurveArchiver fromXMLMetadata(Element archiverEl)
           
 java.lang.String getOutputDir()
           
 java.io.File getStoreDir()
          Return the store dir if applicable (null otherwise) for this archiver.
 boolean isCurveCalculated(CurveMetadata meta, DiscretizedFunc xVals)
          Returns true if the given curve has already been calculated and archived
 void setOutputDir(java.lang.String outputDir)
           
 Element toXMLMetadata(Element root)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XML_METADATA_NAME

public static final java.lang.String XML_METADATA_NAME
See Also:
Constant Field Values
Constructor Detail

AsciiFileCurveArchiver

public AsciiFileCurveArchiver(java.lang.String outputDir,
                              boolean binByLat,
                              boolean binByLon)
                       throws java.io.IOException
Parameters:
outputDir - - directory where curves will be stored
binByLat - - if true, curves will be put in subdirectories for each latitude value. This prevents directories from getting too large (storing too many files) for big calculatoins
binByLon - - same as binByLat but for longitude
Throws:
java.io.IOException
Method Detail

archiveCurve

public void archiveCurve(DiscretizedFunc curve,
                         CurveMetadata meta)
                  throws java.io.IOException
Description copied from interface: CurveResultsArchiver
This stores the curve for the given site.

Specified by:
archiveCurve in interface CurveResultsArchiver
Parameters:
curve - - the curve itself
meta - - curve metadata
Throws:
java.io.IOException

getOutputDir

public java.lang.String getOutputDir()

setOutputDir

public void setOutputDir(java.lang.String outputDir)
                  throws java.io.IOException
Throws:
java.io.IOException

toXMLMetadata

public Element toXMLMetadata(Element root)
Specified by:
toXMLMetadata in interface XMLSaveable

fromXMLMetadata

public static AsciiFileCurveArchiver fromXMLMetadata(Element archiverEl)
                                              throws java.io.IOException
Throws:
java.io.IOException

isCurveCalculated

public boolean isCurveCalculated(CurveMetadata meta,
                                 DiscretizedFunc xVals)
Description copied from interface: CurveResultsArchiver
Returns true if the given curve has already been calculated and archived

Specified by:
isCurveCalculated in interface CurveResultsArchiver
Returns:

getStoreDir

public java.io.File getStoreDir()
Description copied from interface: CurveResultsArchiver
Return the store dir if applicable (null otherwise) for this archiver.

Specified by:
getStoreDir in interface CurveResultsArchiver
Returns:

close

public void close()
Specified by:
close in interface CurveResultsArchiver