Package edu.sc.seis.TauP
Class TauBranch
- java.lang.Object
-
- edu.sc.seis.TauP.TauBranch
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
public class TauBranch extends java.lang.Object implements java.io.Serializable, java.lang.Cloneable
provides storage and methods for distance, time and tau increments for a branch. A branch is a group of layers bounded by discontinuities or reversals in slowness gradient.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int
botLayerNum
boolean
DEBUG
Turns on debugging output.protected double[]
dist
Holds distance (radians) evaluated at the ith ray parameter for this branch.protected boolean
isPWave
The type of wave for this branch, P or S.protected SlownessModel
sMod
protected double[]
tau
Holds tau evaluated at the ith ray parameter for this branch.protected double[]
time
Holds time (seconds) evaluated at the ith ray parameter for this branch.protected int
topLayerNum
-
Constructor Summary
Constructors Constructor Description TauBranch(SlownessModel sMod, boolean isPWave, double topDepth, double botDepth, double maxRayParam, double minTurnRayParam, double minRayParam, double[] dist, double[] time, double[] tau)
TauBranch(SlownessModel sMod, double topDepth, double botDepth, boolean isPWave)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TimeDist
calcTimeDist(double p)
calculates the time and distance increments for the given ray parameter.TimeDist
calcTimeDist(double p, boolean allowTurnInLayer)
TimeDist
calcTimeDist(double p, boolean allowTurnInLayer, boolean isDowngoing)
TauBranch
clone()
Returns a clone of this TauBranch object.static TauBranch
createBranch(SlownessModel sMod, double[] rayParams, double topDepth, double botDepth, boolean isPWave, boolean DEBUG)
Calculates tau for this branch, between slowness layers topLayerNum and botLayerNum, inclusive.protected TauBranch
difference(TauBranch topBranch, int indexP, int indexS, SlownessModel sMod, double[] rayParams)
generates a new tau branch by "subtracting" the given tau branch from this tau branch.double
getBotDepth()
double
getBotRayParam()
Slowness at bottom of bottom layer of branch.double[]
getDist()
double
getDist(int i)
double
getMaxRayParam()
double
getMinRayParam()
double
getMinTurnRayParam()
double[]
getTau()
double
getTau(int i)
double[]
getTime()
double
getTime(int i)
double
getTopDepth()
double
getTopRayParam()
Slowness at top of top layer of branch.protected void
insert(double rayParam, SlownessModel sMod, int index)
Inserts the distance, time, and tau increment for the slowness sample given to the branch.boolean
isHighSlowness()
java.util.List<TimeDist>
path(double rayParam, boolean downgoing, SlownessModel sMod)
java.util.List<TimeDist>
path(double rayParam, boolean downgoing, SlownessModel sMod, TimeDist prevTD)
static TauBranch
readFromStream(java.io.DataInputStream dis)
void
shiftBranch(int index)
java.lang.String
toString()
void
writeToStream(java.io.DataOutputStream dos)
-
-
-
Field Detail
-
DEBUG
public transient boolean DEBUG
Turns on debugging output.
-
sMod
protected SlownessModel sMod
-
topLayerNum
protected int topLayerNum
-
botLayerNum
protected int botLayerNum
-
isPWave
protected boolean isPWave
The type of wave for this branch, P or S.
-
dist
protected double[] dist
Holds distance (radians) evaluated at the ith ray parameter for this branch.
-
time
protected double[] time
Holds time (seconds) evaluated at the ith ray parameter for this branch.
-
tau
protected double[] tau
Holds tau evaluated at the ith ray parameter for this branch.
-
-
Constructor Detail
-
TauBranch
public TauBranch(SlownessModel sMod, boolean isPWave, double topDepth, double botDepth, double maxRayParam, double minTurnRayParam, double minRayParam, double[] dist, double[] time, double[] tau)
-
TauBranch
public TauBranch(SlownessModel sMod, double topDepth, double botDepth, boolean isPWave) throws NoSuchLayerException
- Throws:
NoSuchLayerException
-
-
Method Detail
-
getTopDepth
public double getTopDepth()
- Returns:
- the minimum (top) depth of this layer.
-
getBotDepth
public double getBotDepth()
- Returns:
- the maximum (bottom) depth of this layer.
-
getTopRayParam
public double getTopRayParam()
Slowness at top of top layer of branch.
-
getBotRayParam
public double getBotRayParam()
Slowness at bottom of bottom layer of branch.
-
getMaxRayParam
public double getMaxRayParam()
- Returns:
- the maximum ray parameter that can penetrate into this branch. Time, distance, and tau increments are undefined, set to 0.0, for ray parameters larger than this.
-
getMinTurnRayParam
public double getMinTurnRayParam()
- Returns:
- the minimum ray parameter that is turned, but not reflected, in this branch.
-
getMinRayParam
public double getMinRayParam()
- Returns:
- the minimum ray parameter that is turned or reflected in this branch.
-
getDist
public double[] getDist()
- Returns:
- an array, cloned, containing distance (radians) evaluated at the i_th ray parameter for this branch.
-
getDist
public double getDist(int i)
- Returns:
- the distance (radians) evaluated at the i_th ray parameter for this branch.
-
getTime
public double[] getTime()
- Returns:
- an array, cloned, containing time (seconds) evaluated at the i_th ray parameter for this branch.
-
getTime
public double getTime(int i)
- Returns:
- the time (seconds) evaluated at the i_th ray parameter for this branch.
-
getTau
public double[] getTau()
- Returns:
- an array, cloned, containing tau (seconds) evaluated at the i_th ray parameter for this branch.
-
getTau
public double getTau(int i)
- Returns:
- tau (seconds) evaluated at the i_th ray parameter for this branch.
-
createBranch
public static TauBranch createBranch(SlownessModel sMod, double[] rayParams, double topDepth, double botDepth, boolean isPWave, boolean DEBUG) throws SlownessModelException, TauModelException
Calculates tau for this branch, between slowness layers topLayerNum and botLayerNum, inclusive.- Throws:
NoSuchLayerException
- if a needed slowness layer cannot be found.SlownessModelException
- if there is a problem with the slowness modelTauModelException
- if the slownessmodel and taumodel are not compatible
-
calcTimeDist
public TimeDist calcTimeDist(double p) throws SlownessModelException
calculates the time and distance increments for the given ray parameter. The topDepth and botDepth must be correct as they determine the bounds on the integration/summing.- Throws:
SlownessModelException
- if the ray with ray parameter p turns within a layer instead of at the bottom.
-
calcTimeDist
public TimeDist calcTimeDist(double p, boolean allowTurnInLayer) throws SlownessModelException
- Throws:
SlownessModelException
-
calcTimeDist
public TimeDist calcTimeDist(double p, boolean allowTurnInLayer, boolean isDowngoing) throws SlownessModelException
- Throws:
SlownessModelException
-
insert
protected void insert(double rayParam, SlownessModel sMod, int index) throws SlownessModelException, TauModelException
Inserts the distance, time, and tau increment for the slowness sample given to the branch. This is used for making the depth correction to a tau model for a non-surface source.- Throws:
TauModelException
- if the tau branch is not compatable with the slowness sampling see edu.sc.seis.TauP.TauModel.depthCorrect(double)SlownessModelException
-
difference
protected TauBranch difference(TauBranch topBranch, int indexP, int indexS, SlownessModel sMod, double[] rayParams) throws SlownessModelException, TauModelException
generates a new tau branch by "subtracting" the given tau branch from this tau branch. The given tau branch is assumed to by the upper part of this branch.indexP specifies where a new ray coresponding to a P wave sample has been added, it is -1 if no ray parameter has been added to topBranch. indexS is similar to indexP except for a S wave sample. Note that although the ray parameters for indexP and indexS were for the P and S waves that turned at the source depth, both ray parameters need to be added to both P and S branches.
-
shiftBranch
public void shiftBranch(int index)
-
path
public java.util.List<TimeDist> path(double rayParam, boolean downgoing, SlownessModel sMod) throws SlownessModelException
- Throws:
SlownessModelException
-
path
public java.util.List<TimeDist> path(double rayParam, boolean downgoing, SlownessModel sMod, TimeDist prevTD) throws SlownessModelException
- Throws:
SlownessModelException
-
writeToStream
public void writeToStream(java.io.DataOutputStream dos) throws java.io.IOException
- Throws:
java.io.IOException
-
readFromStream
public static TauBranch readFromStream(java.io.DataInputStream dis) throws java.io.IOException, java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.IllegalAccessException, TauPException
- Throws:
java.io.IOException
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException
TauPException
-
clone
public TauBranch clone()
Returns a clone of this TauBranch object. Note that super.clone() handles all normal variables while the arrays need to be cloned separately to generate a new array as opposed to a new reference to the old array.- Overrides:
clone
in classjava.lang.Object
- See Also:
Cloneable
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
isHighSlowness
public boolean isHighSlowness()
-
-