Package edu.sc.seis.TauP
Class TauP_Time
java.lang.Object
edu.sc.seis.TauP.TauP_Time
- Direct Known Subclasses:
TauP_Curve
,TauP_Pierce
,TauP_SetSac
,TauP_Table
public class TauP_Time
extends java.lang.Object
Calculate travel times for different branches using linear interpolation
between known slowness samples.
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<Arrival>
arrivals
protected double
azimuth
protected double
backAzimuth
static boolean
DEBUG
Turns on debugging output.protected double
degrees
protected double
depth
protected double
eventLat
protected double
eventLon
static boolean
expert
Turns on expert mode.protected boolean
GUI
static java.lang.String
JSON
protected java.lang.String
modelName
protected boolean
onlyPrintRayP
protected boolean
onlyPrintTime
protected java.lang.String
outFileBase
protected Outputs
outForms
java.lang.String
outputFormat
protected java.util.List<PhaseName>
phaseNames
names of phases to be used, ie PKIKP.protected double
receiverDepth
protected Arrival
relativeArrival
protected java.lang.String
relativePhaseName
protected double
stationLat
protected double
stationLon
protected double
takeoffAngle
static java.lang.String
TEXT
protected TauModel
tMod
Tau model calculated previously.protected TauModel
tModDepth
TauModel derived from tMod by correcting it for a non-surface source.protected java.util.Properties
toolProps
boolean
verbose
Turns on verbose output.protected java.io.PrintWriter
writer
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description void
appendPhaseName(PhaseName phaseName)
void
appendPhaseName(java.lang.String phaseName)
void
calcTakeoff(double takeoffAngle)
void
calcTime(double degrees)
void
calculate(double degrees)
void
clearArrivals()
void
clearPhaseNames()
void
clearPhases()
static boolean
dashEquals(java.lang.String argName, java.lang.String arg)
void
depthCorrect(double depth)
Deprecated.use setSourceDepth insteadvoid
depthCorrect(double depth, double receiverDepth)
In general, this is called by each tool's calculate methods, and so should not need to be called by outside code.void
destroy()
Arrival
getArrival(int i)
java.util.List<Arrival>
getArrivals()
double[]
getDisconDepths()
int
getNumArrivals()
int
getNumPhases()
java.lang.String
getOutFile()
java.lang.String
getOutFileBase()
java.lang.String
getOutFileExtension()
java.lang.String
getOutputFormat()
java.lang.String[]
getPhaseNames()
static java.util.List<java.lang.String>
getPhaseNames(java.lang.String phaseName)
java.lang.String
getPhaseNameString()
double
getReceiverDepth()
java.util.List<SeismicPhase>
getSeismicPhases()
double
getSourceDepth()
TauModel
getTauModel()
TauModel
getTauModelDepthCorrected()
Gets depth corrected TauModel.java.lang.String
getTauModelName()
java.io.PrintWriter
getWriter()
void
init()
preforms intialization of the tool.static double
linearInterp(double xa, double ya, double xb, double yb, double x)
solves the equation (yb-ya)/(xb-xa) = (y-ya)/(x-xa) for y given x.void
loadTauModel(java.lang.String modelName)
static void
main(java.lang.String[] args)
Allows TauP_Time to run as an application.protected java.lang.String[]
parseCmdLineArgs(java.lang.String[] args)
static java.util.List<java.lang.Double>
parseDegreeList(java.lang.String degList)
Parses a comma separated list of distances and returns them in an array.void
parsePhaseList(java.lang.String phaseList)
parses a comma separated list of phase names and adds them to the phaseNames vector.void
printHelp()
static void
printNoComprendoArgs(java.lang.String[] noComprendoArgs)
void
printResult(java.io.PrintWriter out)
void
printResultJSON(java.io.PrintWriter out)
void
printResultText(java.io.PrintWriter out)
void
printScriptBeginning(java.io.PrintWriter out)
a noop that allows overriding classes to print things before results are calculated.void
printStdUsage()
Prints the command line arguments common to all TauP tools.void
printStdUsageHead()
static void
printStdUsageHead(java.lang.Class toolClass)
void
printStdUsageTail()
void
printUsage()
protected void
readPhaseFile(java.lang.String filename)
Reads in list of phase names from a text file.protected void
readTauModel()
Reads the velocity model, slowness model, and tau model from a file saved using Java's Serializable interface.protected void
recalcPhases()
recalculates the given phases using a possibly new or changed tau model.void
setOutFileBase(java.lang.String outFileBase)
void
setOutputFormat(java.lang.String val)
usually one of TauP_Time.TEXT or TauP_Time.JSON.void
setPhaseNames(PhaseName[] phaseNames)
void
setPhaseNames(java.lang.String[] phaseNames)
void
setReceiverDepth(double receiverDepth)
void
setSourceDepth(double depth)
void
setTauModel(TauModel tMod)
void
setWriter(java.io.PrintWriter writer)
void
sortArrivals()
void
start()
-
Field Details
-
DEBUG
public static boolean DEBUGTurns on debugging output. -
verbose
public boolean verboseTurns on verbose output. -
expert
public static boolean expertTurns on expert mode. -
JSON
public static final java.lang.String JSON- See Also:
- Constant Field Values
-
TEXT
public static final java.lang.String TEXT- See Also:
- Constant Field Values
-
outputFormat
public java.lang.String outputFormat -
modelName
protected java.lang.String modelName -
tMod
Tau model calculated previously.- See Also:
TauModel
-
tModDepth
TauModel derived from tMod by correcting it for a non-surface source. -
phaseNames
names of phases to be used, ie PKIKP. -
depth
protected double depth -
receiverDepth
protected double receiverDepth -
degrees
protected double degrees -
azimuth
protected double azimuth -
backAzimuth
protected double backAzimuth -
takeoffAngle
protected double takeoffAngle -
stationLat
protected double stationLat -
stationLon
protected double stationLon -
eventLat
protected double eventLat -
eventLon
protected double eventLon -
arrivals
-
GUI
protected boolean GUI -
onlyPrintRayP
protected boolean onlyPrintRayP -
onlyPrintTime
protected boolean onlyPrintTime -
relativePhaseName
protected java.lang.String relativePhaseName -
relativeArrival
-
outFileBase
protected java.lang.String outFileBase -
writer
protected java.io.PrintWriter writer -
toolProps
protected java.util.Properties toolProps -
outForms
-
-
Constructor Details
-
TauP_Time
protected TauP_Time() -
TauP_Time
- Throws:
TauModelException
-
TauP_Time
creates a TauP_Time object with the tau model specified by modelName already loaded.- Throws:
TauModelException
- if the file can't be found or is corrupted in some way.
-
-
Method Details
-
getPhaseNames
public java.lang.String[] getPhaseNames() -
getPhaseNameString
public java.lang.String getPhaseNameString() -
setPhaseNames
- Throws:
TauModelException
-
setPhaseNames
-
getPhaseNames
public static java.util.List<java.lang.String> getPhaseNames(java.lang.String phaseName) -
appendPhaseName
- Throws:
TauModelException
-
appendPhaseName
-
getNumPhases
public int getNumPhases() -
clearPhaseNames
public void clearPhaseNames() -
getSourceDepth
public double getSourceDepth() -
setSourceDepth
public void setSourceDepth(double depth) -
getReceiverDepth
public double getReceiverDepth() -
setReceiverDepth
public void setReceiverDepth(double receiverDepth) -
getTauModelName
public java.lang.String getTauModelName() -
getTauModel
-
getTauModelDepthCorrected
Gets depth corrected TauModel. -
setTauModel
-
loadTauModel
public void loadTauModel(java.lang.String modelName) throws java.io.FileNotFoundException, java.io.InvalidClassException, java.io.IOException, java.io.StreamCorruptedException, java.io.OptionalDataException, TauModelException- Throws:
java.io.FileNotFoundException
java.io.InvalidClassException
java.io.IOException
java.io.StreamCorruptedException
java.io.OptionalDataException
TauModelException
-
getDisconDepths
public double[] getDisconDepths() -
clearPhases
public void clearPhases() -
clearArrivals
public void clearArrivals() -
getNumArrivals
public int getNumArrivals() -
getArrival
-
getArrivals
-
getSeismicPhases
-
readTauModel
Reads the velocity model, slowness model, and tau model from a file saved using Java's Serializable interface. Performs a depth correction if the current depth is not 0.0- Throws:
TauModelException
-
readPhaseFile
protected void readPhaseFile(java.lang.String filename) throws java.io.IOExceptionReads in list of phase names from a text file. So long as each phase name is separated by some whitespace, " " or newline or tab, it should read them fine. Also, comments are allowed, either # or // are comments to the end of the line while c style slash-star make a block a comment.- Throws:
java.io.IOException
-
parsePhaseList
public void parsePhaseList(java.lang.String phaseList)parses a comma separated list of phase names and adds them to the phaseNames vector. Each phase can have an optional argument after a dash. This would be used for specifying which sac header to put the time in, or for other unforeseen uses. This may be called multiple times to append more phases. For example: P-0,PcP-1,ScP-4,Sn,SS,S^410S would, assuming no previous phases have been added, put P in T0, PcP in T1, ScP in T5, Sn in T2, SS in T3, and S^410S in T5. -
parseDegreeList
public static java.util.List<java.lang.Double> parseDegreeList(java.lang.String degList)Parses a comma separated list of distances and returns them in an array. -
dashEquals
public static boolean dashEquals(java.lang.String argName, java.lang.String arg) -
parseCmdLineArgs
protected java.lang.String[] parseCmdLineArgs(java.lang.String[] args) throws java.io.IOException- Throws:
java.io.IOException
-
sortArrivals
public void sortArrivals() -
calculate
- Throws:
TauModelException
-
calcTime
- Throws:
TauModelException
-
calcTakeoff
- Throws:
TauModelException
-
depthCorrect
Deprecated.use setSourceDepth insteadcorrects the TauModel for the given source depth. It only performs the correction of the model is not already corrected to that depth. In general, this is called by each tool's calculate methods, and so should not need to be called by outside code. Most of the time calling setSourceDepth is preferred, allowing the tool to choose when to call depthCorrect.- Throws:
TauModelException
-
depthCorrect
In general, this is called by each tool's calculate methods, and so should not need to be called by outside code. Most of the time calling setSourceDepth and setReceiverDepth is preferred, allowing the tool to choose when to call depthCorrect.- Parameters:
depth
- the source depthreceiverDepth
- the receiver depth- Throws:
TauModelException
-
recalcPhases
protected void recalcPhases()recalculates the given phases using a possibly new or changed tau model. This should not need to be called by outside classes as it is called by depthCorrect, and calculate. -
printResult
public void printResult(java.io.PrintWriter out) throws java.io.IOException- Throws:
java.io.IOException
-
printResultText
public void printResultText(java.io.PrintWriter out) throws java.io.IOException- Throws:
java.io.IOException
-
printResultJSON
public void printResultJSON(java.io.PrintWriter out) -
init
public void init() throws java.io.IOExceptionpreforms intialization of the tool. Properties are queried for the the default model to load, source depth to use, phases to use, etc. Note that because of the IO inherent in these operations, this method is not appropriate for Applets. Applets should load TauModels themselves and use the setTauModel(TauModel) method.- Throws:
java.io.IOException
-
getOutputFormat
public java.lang.String getOutputFormat() -
setOutputFormat
public void setOutputFormat(java.lang.String val)usually one of TauP_Time.TEXT or TauP_Time.JSON. Subclasses may add additional types, for example TauP_Path.SVG.- Parameters:
val
- output format for results
-
getOutFileBase
public java.lang.String getOutFileBase() -
setOutFileBase
public void setOutFileBase(java.lang.String outFileBase) -
getOutFileExtension
public java.lang.String getOutFileExtension() -
getOutFile
public java.lang.String getOutFile() -
getWriter
public java.io.PrintWriter getWriter() throws java.io.IOException- Throws:
java.io.IOException
-
setWriter
public void setWriter(java.io.PrintWriter writer) -
printScriptBeginning
public void printScriptBeginning(java.io.PrintWriter out) throws java.io.IOExceptiona noop that allows overriding classes to print things before results are calculated. For example to set up GMT commands before drawing paths.- Parameters:
out
-- Throws:
java.io.IOException
-
printHelp
public void printHelp() -
start
- Throws:
java.io.IOException
TauModelException
TauPException
-
destroy
public void destroy() throws java.io.IOException- Throws:
java.io.IOException
-
printStdUsageHead
public void printStdUsageHead() -
printStdUsageHead
public static void printStdUsageHead(java.lang.Class toolClass) -
printStdUsage
public void printStdUsage()Prints the command line arguments common to all TauP tools. -
printStdUsageTail
public void printStdUsageTail() -
printUsage
public void printUsage() -
printNoComprendoArgs
public static void printNoComprendoArgs(java.lang.String[] noComprendoArgs) -
linearInterp
public static final double linearInterp(double xa, double ya, double xb, double yb, double x)solves the equation (yb-ya)/(xb-xa) = (y-ya)/(x-xa) for y given x. Useful for finding the pixel for a value given the dimension of the area and the range of values it is supposed to cover. Note, this does not check for xa == xb, in which case a divide by zero would occur. -
main
public static void main(java.lang.String[] args) throws java.io.FileNotFoundException, java.io.IOException, java.io.StreamCorruptedException, java.lang.ClassNotFoundException, java.io.OptionalDataExceptionAllows TauP_Time to run as an application. Creates an instance of TauP_Time. .- Throws:
java.io.FileNotFoundException
java.io.IOException
java.io.StreamCorruptedException
java.lang.ClassNotFoundException
java.io.OptionalDataException
-