|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.opensha.sha.simulators.eqsim_v04.General_EQSIM_Tools
public class General_EQSIM_Tools
This class reads and writes various files, as well as doing some analysis of simulator results. Note that this class could extend some class representing the "Container" defined in EQSIM, but it's not clear that generality is necessary. Things to keep in mind: Indexing in the EQSIM files starts from 1, not zero. Therefore, here we refer to their "indices" as IDs to avoid confusion (so IDs here start from 1, but indices here start from zero). Thus, the ID for the ith RectangularElement in rectElementsList equals i+1 (rectElementsList.get(i).getID() = i+1) because the input file has everything in an order of increasing IDs. The same goes for other lists. Note that index for eventList is not necessarily equal to eventID-1 because some events in the input file may not be included (e.g., if Mag = -Inf, which occurs) All units in EQSIM files are SI Note that DAS values are unique only within a fault section (values can start over on the next section) Note that slip rates in EQSIM files are in units of m/s, whereas we convert these to m/yr internally here. We assume the first vertex in each element here is the first on the upper edge (traceFlag=2 if the element is at the top); this is not checked for explicitly.
| Field Summary | |
|---|---|
protected static boolean |
D
|
static double |
SECONDS_PER_YEAR
|
| Constructor Summary | |
|---|---|
General_EQSIM_Tools(File file)
This constructor loads the data from an EQSIM_v04 Geometry file |
|
General_EQSIM_Tools(int deformationModelID,
boolean aseisReducesArea,
double maxDiscretization)
This constructor makes the list of RectangularElements from a UCERF2 deformation model |
|
General_EQSIM_Tools(String filePathName)
This constructor loads the data from an EQSIM_v04 Geometry file |
|
General_EQSIM_Tools(String filePathName,
int formatType)
This constructor loads the data from either an EQSIM_v04 Geometry file (formatType=0) or from Steve Ward's format (formatType=1). |
|
General_EQSIM_Tools(URL url)
This constructor loads the data from an EQSIM_v04 Geometry file |
|
| Method Summary | |
|---|---|
void |
checkElementSlipRates(String fileNamePrefix,
boolean makePlot)
This compares observed slip rate (from events) with those imposed. |
String |
checkEventMagnitudes(double magThresh)
This compares all the computed magnitudes to those given on the input files and writes out the maximum absolute difference. |
String |
checkFullDDW_rupturing(boolean plotResult,
boolean savePlot)
This looks at what ruptures do and do not rupture all the way down dip (as defined by the isEventSupraSeismogenic(event, Double.NaN) method) |
void |
checkThatAllEventRecordsHaveSlips()
|
ArrayList<ArbIncrementalMagFreqDist> |
computeMagFreqDistByFaultSection(double minMag,
double maxMag,
int numMag,
boolean makeOnePlotWithAll,
boolean makeSeparatePlots,
boolean savePlots)
|
ArbIncrementalMagFreqDist |
computeTotalMagFreqDist(double minMag,
double maxMag,
int numMag,
boolean makePlot,
boolean savePlot)
This computes the total magnitude frequency distribution (with an option to plot the results) |
boolean |
doesEventUtilizedFault(EQSIM_Event event,
int faultID)
This tells whether the event utilizes any section with the given faultID |
Vertex |
getClosestVertex(Location loc)
This returns the vertex that is closest to the given location (although this might not be very close) |
ArrayList<RectangularElement> |
getElementsList()
This returns the list of RectangularElement objects |
HashMap<Integer,EQSIM_Event> |
getEventsHashMap()
This returns a HashMap of EQSIM_Event objects where the key is the event ID |
ArrayList<EQSIM_Event> |
getEventsList()
Note that because some events were filtered out, the index in the returned array list is not neccessariy equal to the eventID minus one (getEventsList().get(index).getID()=1 != index). |
static EvenlyDiscretizedFunc |
getNormRI_Distribution(ArrayList<Double> normRI_List,
double deltaT)
|
static HeadlessGraphPanel |
getNormRI_DistributionGraphPanel(ArrayList<Double> normRI_List,
String plotTitle)
This utility returns a graph panel with a histogram of normalized recurrence intervals from normRI_List, along with best-fit BPT, Lognormal, and Weibull distributions. |
int |
getNumEventsWithElementSlipData()
This tells whether all events have data on the slip on each element |
double[] |
getRecurIntervalsForDAS_and_FaultID(double das,
int sectID,
double magThresh)
This get the RI for all events that pass below the given DAS & sectID (the way Keith Richards Dinger does it). |
double[] |
getRecurIntervalsForElement(int elemID,
double magThresh)
For the specified element ID, this computes the intervals between events that have magnitude greater than the given threshold. |
static ArrayList<EvenlyDiscretizedFunc> |
getRenewalModelFunctionFitsToDist(EvenlyDiscretizedFunc dist)
|
int |
getSectionIndexForVertex(Vertex vertex)
This returns the section index (not ID) for the given vertex, assuming there is only one section for each vertex (exception is thrown if not) (not efficient) |
ArrayList<String> |
getSectionsNameList()
|
double |
getSimulationDuration()
|
static double |
getSimulationDuration(List<EQSIM_Event> events)
|
double |
getSimulationDurationYears()
|
static double |
getSimulationDurationYears(List<EQSIM_Event> events)
|
boolean |
isEventSupraSeismogenic(EQSIM_Event event,
double magThresh)
This tells whether the given event is a supra-seismogenic rupture. |
static void |
main(String[] args)
|
void |
mkElementsFromUCERF2_DefMod(int deformationModelID,
boolean aseisReducesArea,
double maxDiscretization)
This makes the elements from a UCERF2 deformation model |
void |
mkFigsForUCERF3_ProjPlanRepot(String dirNameForSavingFiles,
double magThresh)
|
void |
oldTests(String dirNameForSavingFiles,
double magThresh)
This is no longer used or needed? |
boolean |
plotAveNormSlipAlongRupture(Double magThresh,
boolean savePlot)
This plot the average normalized slip along ruptures |
void |
plotNormRecurIntsForAllSurfaceElements(double magThresh,
boolean savePlot)
This plots a histogram of normalized recurrence intervals for all surface elements (normalized by the average interval at each element). |
static GraphiWindowAPI_Impl |
plotNormRI_Distribution(ArrayList<Double> normRI_List,
String plotTitle)
This utility plots the histogram of normalized recurrence intervals from normRI_List, along with best-fit BPT, Lognormal, and Weibull distributions. |
void |
plotRecurIntervalsForElement(double[] intervals,
boolean savePlot,
String locName,
String infoString)
|
boolean |
plotRecurIntervalsForNearestLoc(Location loc,
double magThresh,
boolean savePlot,
String locName,
String infoString)
This quits and returns false if the loc is not within 5 km of a vertex. |
void |
plotSAF_EventsAlongStrikeVsTime(double magThresh,
int maxNumEvents)
|
void |
plotScalingRelationships(boolean savePlotsToFile)
This plots slip versus length, mag versus area, and mag versus length. |
void |
plotYearlyEventRates()
This plots yearly event rates |
String |
printMinAndMaxElementArea()
|
void |
randomizeEventTimes()
This replaces all the event times with a random value sampled between the first and last original event time using a uniform distribution. |
void |
read_EQSIMv04_EventsFile(File file)
|
void |
read_EQSIMv04_EventsFile(String filePathName)
|
void |
read_EQSIMv04_EventsFile(URL url)
|
void |
setDirNameForSavingFiles(String dirNameForSavingFiles)
This sets the directory name for files that are saved |
void |
testDistanceAlong()
This tests the EQSIM_Event.getDistAlongRupForElements() for a few ruptures, and assuming the "eqs.ALLCAL2_RSQSim_sigma0.5-5_b=0.015.barall" input file is used (event indices are set by hand). |
void |
testElementAreas()
This tests whether element areas agree between gridded surface and that computed by RectangularElement |
void |
testTemp()
|
String |
testTimePredictability(double supraSeisMagThresh,
boolean saveStuff,
Integer testElementID,
boolean plotSectionResults)
This method evaluates Ned's average time- and slip-predictability in various ways. |
void |
writeDAS_ForVertices()
|
void |
writeEventsThatInvolveMultSections()
|
void |
writeRI_COV_forAllSurfaceElements(double magThresh,
String fileName)
|
void |
writeSectionNamesEtc()
This writes out the section index, ID (index+1), name, and fault ID to a file called "simulatorSectionNamesEtc.txt" |
void |
writeTo_EQSIM_V04_GeometryFile(String fileName,
ArrayList<String> infoLines,
String titleLine,
String author,
String date)
The creates a EQSIM V04 Geometry file for the given instance. |
void |
writeToWardFile(String fileName)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final boolean D
public static final double SECONDS_PER_YEAR
| Constructor Detail |
|---|
public General_EQSIM_Tools(int deformationModelID,
boolean aseisReducesArea,
double maxDiscretization)
deformationModelID - - D2.1 = 82; D2.2 = 83; D2.3 = 84; D2.4 = 85; D2.5 = 86; D2.6 = 87aseisReducesArea - - whether or not to reduce area (otherwise reduces slip rate?)maxDiscretization - - the maximum element sizepublic General_EQSIM_Tools(String filePathName)
filePathName - - full path and file name
public General_EQSIM_Tools(String filePathName,
int formatType)
filePathName - - full path and file nameformatType - - set as 0 for EQSIM_v04 Geometry file or 1 for Steve Ward's format
public General_EQSIM_Tools(File file)
throws IOException
url - - full URL path name
IOExceptionpublic General_EQSIM_Tools(URL url)
url - - full URL path name| Method Detail |
|---|
public ArrayList<String> getSectionsNameList()
public void read_EQSIMv04_EventsFile(URL url)
throws IOException
IOException
public void read_EQSIMv04_EventsFile(File file)
throws IOException
IOException
public void read_EQSIMv04_EventsFile(String filePathName)
throws FileNotFoundException,
IOException
FileNotFoundException
IOException
public boolean isEventSupraSeismogenic(EQSIM_Event event,
double magThresh)
event - magThresh - - set as Double.NaN to use down-dip-width
public ArrayList<RectangularElement> getElementsList()
public String printMinAndMaxElementArea()
public void testElementAreas()
public void testDistanceAlong()
public void mkElementsFromUCERF2_DefMod(int deformationModelID,
boolean aseisReducesArea,
double maxDiscretization)
deformationModelID - - D2.1 = 82; D2.2 = 83; D2.3 = 84; D2.4 = 85; D2.5 = 86; D2.6 = 87aseisReducesArea - - whether or not to reduce area (otherwise reduces slip rate?)maxDiscretization - - the maximum element size
public void writeToWardFile(String fileName)
throws IOException
IOException
public void writeTo_EQSIM_V04_GeometryFile(String fileName,
ArrayList<String> infoLines,
String titleLine,
String author,
String date)
throws IOException
fileName - infoLines - - each line here should NOT end with a new line char "\n" (this will be added)titleLine - author - date -
IOException
public ArbIncrementalMagFreqDist computeTotalMagFreqDist(double minMag,
double maxMag,
int numMag,
boolean makePlot,
boolean savePlot)
public ArrayList<ArbIncrementalMagFreqDist> computeMagFreqDistByFaultSection(double minMag,
double maxMag,
int numMag,
boolean makeOnePlotWithAll,
boolean makeSeparatePlots,
boolean savePlots)
minMag - maxMag - numMag - makeOnePlotWithAll - - plot all incremental dists in one graphmakeSeparatePlots - - make separate plots of incremental and cumulative distributions
public int getNumEventsWithElementSlipData()
public ArrayList<EQSIM_Event> getEventsList()
public HashMap<Integer,EQSIM_Event> getEventsHashMap()
public void randomizeEventTimes()
public void plotYearlyEventRates()
public void plotSAF_EventsAlongStrikeVsTime(double magThresh,
int maxNumEvents)
public static EvenlyDiscretizedFunc getNormRI_Distribution(ArrayList<Double> normRI_List,
double deltaT)
public static ArrayList<EvenlyDiscretizedFunc> getRenewalModelFunctionFitsToDist(EvenlyDiscretizedFunc dist)
public static HeadlessGraphPanel getNormRI_DistributionGraphPanel(ArrayList<Double> normRI_List,
String plotTitle)
normRI_List - plotTitle -
public static GraphiWindowAPI_Impl plotNormRI_Distribution(ArrayList<Double> normRI_List,
String plotTitle)
normRI_List - plotTitle - public void testTemp()
public String testTimePredictability(double supraSeisMagThresh,
boolean saveStuff,
Integer testElementID,
boolean plotSectionResults)
supraSeisMagThresh - - threshold defining supra-seismogenic rupture (if Double.NaN sqrt(area)>fltDDW will be used)saveStuff - testElementID - - set null if not wanted
public void checkThatAllEventRecordsHaveSlips()
public String checkEventMagnitudes(double magThresh)
public void writeEventsThatInvolveMultSections()
public double getSimulationDuration()
public static double getSimulationDuration(List<EQSIM_Event> events)
public double getSimulationDurationYears()
public static double getSimulationDurationYears(List<EQSIM_Event> events)
public void checkElementSlipRates(String fileNamePrefix,
boolean makePlot)
fileNamePrefix - - set as null to not write the data out.
public boolean plotAveNormSlipAlongRupture(Double magThresh,
boolean savePlot)
magThresh - - Double.NaN for supra seismogenic
This returns false if the plot can't be made (e.g., ViscoSim has
some problem with event.getNormDistAlongRupForElements())savePlot - public void plotScalingRelationships(boolean savePlotsToFile)
public double[] getRecurIntervalsForElement(int elemID,
double magThresh)
elemID - magThresh - - set as Double.NaN to use sqrt(area)>aveFaultDDW instead
public void writeRI_COV_forAllSurfaceElements(double magThresh,
String fileName)
public void writeDAS_ForVertices()
public void writeSectionNamesEtc()
public void plotNormRecurIntsForAllSurfaceElements(double magThresh,
boolean savePlot)
magThresh -
public boolean plotRecurIntervalsForNearestLoc(Location loc,
double magThresh,
boolean savePlot,
String locName,
String infoString)
loc - magThresh - savePlot - locName - infoString -
public void plotRecurIntervalsForElement(double[] intervals,
boolean savePlot,
String locName,
String infoString)
public Vertex getClosestVertex(Location loc)
loc -
public int getSectionIndexForVertex(Vertex vertex)
vertex -
public double[] getRecurIntervalsForDAS_and_FaultID(double das,
int sectID,
double magThresh)
das - - in meters!sectID - - id of fault section (not index!)magThresh -
public void oldTests(String dirNameForSavingFiles,
double magThresh)
dirNameForSavingFiles - magThresh -
public String checkFullDDW_rupturing(boolean plotResult,
boolean savePlot)
public void setDirNameForSavingFiles(String dirNameForSavingFiles)
dirNameForSavingFiles -
public void mkFigsForUCERF3_ProjPlanRepot(String dirNameForSavingFiles,
double magThresh)
public boolean doesEventUtilizedFault(EQSIM_Event event,
int faultID)
faultID -
public static void main(String[] args)
throws FileNotFoundException,
IOException
args -
IOException
FileNotFoundException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||