Package edu.sc.seis.TauP
Class VelocityModel
java.lang.Object
edu.sc.seis.TauP.VelocityModel
- All Implemented Interfaces:
Serializable,Cloneable
This class defines basic classes to store and manipulate a velocity model.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected doubleDepth (km) of the cmb (core mantle boundary).static final doublestatic final doublestatic final doubleprotected doubleDepth (km) of the iocb (inner core outer core boundary).static final Stringprotected List<VelocityLayer>expandable array to hold the layersprotected doublemaximum radius of the model (km), default 6371.0protected doubleminimum radius of the model (km), default 0.0protected Stringname of the velocity model.protected doubleDepth (km) of the moho.static final Stringprotected doublereference radius (km), usually radius of the earth, by default 6371 kilometers.protected booleanis this a spherical model? Default is true.static final Stringprotected static intthe initial length of the layer vector. -
Constructor Summary
ConstructorsConstructorDescriptionVelocityModel(String modelName, double radiusOfEarth, double mohoDepth, double cmbDepth, double iocbDepth, double minRadius, double maxRadius, boolean spherical, List<VelocityLayer> layer) VelocityModel(String modelName, double radiusOfEarth, List<NamedVelocityDiscon> namedDiscons, double minRadius, double maxRadius, boolean spherical, List<VelocityLayer> layer) -
Method Summary
Modifier and TypeMethodDescriptioncalcReflTransCoef(double depth, boolean downgoing) static ReflTranscalcReflTransCoef(double abovePVel, double aboveSVel, double aboveRho, double belowPVel, double belowSVel, double belowRho) static ReflTranscalcReflTransCoef(double abovePVel, double aboveSVel, double aboveRho, double belowPVel, double belowSVel, double belowRho, boolean downgoing) booleandoubledepthAtBottom(int layerNumber) returns the depth at the bottom of the given layer.doubledepthAtTop(int layerNumber) returns the depth at the top of the given layer.Returns a flat velocity model object equivalent to the spherical velocity model via the earth flattening transform.elevationLayer(float elevationMeters, String name) doubleevaluateAbove(double depth, VelocityModelMaterial materialProperty) returns the value of the given material property, usually P or S velocity, at the given depth.doubleevaluateAtBottom(int layerNumber, VelocityModelMaterial materialProperty) returns the value of the given material property, usually P or S velocity, at the bottom of the given layer.doubleevaluateAtTop(int layerNumber, VelocityModelMaterial materialProperty) returns the value of the given material property, usually P or S velocity, at the top of the given layer.doubleevaluateBelow(double depth, VelocityModelMaterial materialProperty) returns the value of the given material property, usually P or S velocity, at the given depth.booleanresets depths of major discontinuities to match those existing in the input velocity model.doubledouble[]doubledoubledoubleget the model name.static StringgetModelNameFromFileName(String filename) doublegetNamedDisconForDepth(double depth) intReturns the number of layers in this velocity model.doublegets radius of the earth (km), by default 6371 kilometers.doublegets radius of the earth (m), by default 6371000 meters.booleangetVelocityLayer(int layerNum) getVelocityLayerClone(int layerNum) booleanisDisconDepth(double depth) booleanisNamedDisconDepth(double depth) intlayerNumberAbove(double depth) Finds the layer containing the given depth.intlayerNumberBelow(double depth) Finds the layer containing the given depth.voidprint()voidprintGMT(PrintWriter dos) prints out the velocity model into a file in a for suitable for plotting with GMT.voidprints out the velocity model into a file in a form suitable for plotting with GMT.booleanstatic VelocityModelreadNDFile(File file) This method reads in a velocity model from a "nd" ASCII text file, the format used by Xgbm.static VelocityModelreadNDFile(Reader in, String modelName) static VelocityModelreadTVelFile(File file) This method reads in a velocity model from a "tvel" ASCII text file.static VelocityModelreadTVelFile(Reader in, String modelName) static VelocityModelreadVelocityFile(String filename, String fileType) Reads in a velocity file.replaceLayers(VelocityLayer[] newLayers, String name, boolean smoothTop, boolean smoothBot) voidsetCmbDepth(double cmbDepth) voidsetIocbDepth(double iocbDepth) voidsetMaxRadius(double maxRadius) voidsetMinRadius(double minRadius) voidsetModelName(String modelName) set the model name.voidsetMohoDepth(double mohoDepth) voidsetRadiusOfEarth(double radiusOfEarth) sets radius of the earth (km), by default 6371 kilometers.voidsetSpherical(boolean spherical) net.sf.geographiclib.GeodesicCreate a spherical geodesic with radius of the model and zero flattenning.toString()booleanvalidate()Performs internal consistency checks on the velocity model.void
-
Field Details
-
ND
- See Also:
-
TVEL
- See Also:
-
JSON
- See Also:
-
modelName
name of the velocity model. -
radiusOfEarth
protected double radiusOfEarthreference radius (km), usually radius of the earth, by default 6371 kilometers. -
namedDiscon
-
DEFAULT_MOHO
public static final double DEFAULT_MOHO- See Also:
-
DEFAULT_CMB
public static final double DEFAULT_CMB- See Also:
-
DEFAULT_IOCB
public static final double DEFAULT_IOCB- See Also:
-
mohoDepth
protected double mohoDepthDepth (km) of the moho. It can be input from velocity model (*.nd) or should be explicitly set. By default it is 35 kilometers (from Iasp91). For phase naming, the tau model will choose the closest 1st order discontinuity. Thus for most simple earth models these values are satisfactory. Take proper care if your model has a thicker crust and a discontinuity near 35 km depth. -
cmbDepth
protected double cmbDepthDepth (km) of the cmb (core mantle boundary). It can be input from velocity model (*.nd) or should be explicitly set. By default it is 2889 kilometers (from Iasp91). For phase naming, the tau model will choose the closest 1st order discontinuity. Thus for most simple earth models these values are satisfactory. -
iocbDepth
protected double iocbDepthDepth (km) of the iocb (inner core outer core boundary). It can be input from velocity model (*.nd) or should be explicitly set. By default it is 5153.9 kilometers (from Iasp91). For phase naming, the tau model will choose the closest 1st order discontinuity. Thus for most simple earth models these values are satisfactory. -
minRadius
protected double minRadiusminimum radius of the model (km), default 0.0 -
maxRadius
protected double maxRadiusmaximum radius of the model (km), default 6371.0 -
spherical
protected boolean sphericalis this a spherical model? Default is true. -
vectorLength
protected static int vectorLengththe initial length of the layer vector. -
layer
expandable array to hold the layers
-
-
Constructor Details
-
VelocityModel
public VelocityModel(String modelName, double radiusOfEarth, double mohoDepth, double cmbDepth, double iocbDepth, double minRadius, double maxRadius, boolean spherical, List<VelocityLayer> layer) -
VelocityModel
public VelocityModel(String modelName, double radiusOfEarth, List<NamedVelocityDiscon> namedDiscons, double minRadius, double maxRadius, boolean spherical, List<VelocityLayer> layer)
-
-
Method Details
-
getModelName
get the model name. -
setModelName
set the model name. -
setRadiusOfEarth
public void setRadiusOfEarth(double radiusOfEarth) sets radius of the earth (km), by default 6371 kilometers. -
getRadiusOfEarth
public double getRadiusOfEarth()gets radius of the earth (km), by default 6371 kilometers. -
getRadiusOfEarthMeters
public double getRadiusOfEarthMeters()gets radius of the earth (m), by default 6371000 meters. -
sphericalGeodesic
public net.sf.geographiclib.Geodesic sphericalGeodesic()Create a spherical geodesic with radius of the model and zero flattenning.- Returns:
- geodesic of correct radius.
-
getSphericalDistCalc
-
isDisconDepth
public boolean isDisconDepth(double depth) -
getNamedDiscons
-
getNamedDisconForDepth
-
isNamedDisconDepth
public boolean isNamedDisconDepth(double depth) -
getDisconDepths
public double[] getDisconDepths()- Returns:
- the depths of discontinuities within the velocity model
-
getMohoDepth
public double getMohoDepth()- Returns:
- depth (km) of the moho. It can be input from velocity model (*.nd) or should be explicitly set. By default it is 35 kilometers (from Iasp91). For phase naming, the tau model will choose the closest 1st order discontinuity. Thus for most simple earth models these values are satisfactory. Take proper care if your model has a thicker crust and a discontinuity near 35 km depth.
-
setMohoDepth
public void setMohoDepth(double mohoDepth) -
getCmbDepth
public double getCmbDepth()- Returns:
- depth (km) of the cmb (core mantle boundary). It can be input from velocity model (*.nd) or should be explicitly set. By default it is 2889 kilometers (from Iasp91). For phase naming, the tau model will choose the closest 1st order discontinuity. Thus for most simple earth models these values are satisfactory.
-
setCmbDepth
public void setCmbDepth(double cmbDepth) -
getIocbDepth
public double getIocbDepth()- Returns:
- the depth (km) of the iocb (inner core outer core boundary). It can be input from velocity model (*.nd) or should be explicitly set. By default it is 5153.9 kilometers (from Iasp91). For phase naming, the tau model will choose the closest 1st order discontinuity. Thus for most simple earth models these values are satisfactory.
-
setIocbDepth
public void setIocbDepth(double iocbDepth) -
getMinRadius
public double getMinRadius() -
setMinRadius
public void setMinRadius(double minRadius) -
getMaxRadius
public double getMaxRadius() -
setMaxRadius
public void setMaxRadius(double maxRadius) -
getSpherical
public boolean getSpherical() -
setSpherical
public void setSpherical(boolean spherical) -
densityIsDefault
public boolean densityIsDefault() -
QIsDefault
public boolean QIsDefault() -
getVelocityLayerClone
-
getVelocityLayer
-
getNumLayers
public int getNumLayers()Returns the number of layers in this velocity model. -
getLayers
-
layerNumberAbove
Finds the layer containing the given depth. Note this returns the upper layer if the depth happens to be at a layer boundary.- Returns:
- the layer number
- Throws:
NoSuchLayerException- occurs if no layer contains the given depth.
-
layerNumberBelow
Finds the layer containing the given depth. Note this returns the lower layer if the depth happens to be at a layer boundary.- Returns:
- the layer number
- Throws:
NoSuchLayerException- occurs if no layer contains the given depth.
-
evaluateAbove
public double evaluateAbove(double depth, VelocityModelMaterial materialProperty) throws NoSuchLayerException returns the value of the given material property, usually P or S velocity, at the given depth. Note this returns the value at the bottom of the upper layer if the depth happens to be at a layer boundary.- Returns:
- the value of the given material property
- Throws:
NoSuchLayerException- occurs if no layer contains the given depth.
-
evaluateBelow
public double evaluateBelow(double depth, VelocityModelMaterial materialProperty) throws NoSuchLayerException returns the value of the given material property, usually P or S velocity, at the given depth. Note this returns the value at the top of the lower layer if the depth happens to be at a layer boundary.- Returns:
- the value of the given material property
- Throws:
NoSuchLayerException- occurs if no layer contains the given depth.
-
evaluateAtTop
returns the value of the given material property, usually P or S velocity, at the top of the given layer.- Returns:
- the value of the given material property occurs if the material property is not recognized.
-
evaluateAtBottom
returns the value of the given material property, usually P or S velocity, at the bottom of the given layer.- Returns:
- the value of the given material property
-
depthAtTop
public double depthAtTop(int layerNumber) returns the depth at the top of the given layer.- Returns:
- the depth.
-
depthAtBottom
public double depthAtBottom(int layerNumber) returns the depth at the bottom of the given layer.- Returns:
- the depth. occurs if the material property is not recognized.
-
replaceLayers
public VelocityModel replaceLayers(VelocityLayer[] newLayers, String name, boolean smoothTop, boolean smoothBot) throws VelocityModelException - Throws:
VelocityModelException
-
elevationLayer
public VelocityModel elevationLayer(float elevationMeters, String name) throws VelocityModelException - Throws:
VelocityModelException
-
printGMT
prints out the velocity model into a file in a form suitable for plotting with GMT.- Throws:
IOException
-
printGMT
prints out the velocity model into a file in a for suitable for plotting with GMT. -
validate
public boolean validate()Performs internal consistency checks on the velocity model. -
toString
-
writeToND
- Throws:
IOException
-
print
public void print() -
getModelNameFromFileName
-
readVelocityFile
public static VelocityModel readVelocityFile(String filename, String fileType) throws IOException, VelocityModelException Reads in a velocity file. The type of file is determined by the fileType var. Calls readTVelFile or readNDFile.- Throws:
VelocityModelException- if the type of file cannot be determined.IOException
-
readTVelFile
This method reads in a velocity model from a "tvel" ASCII text file. The name of the model file for model "modelname" should be "modelname.tvel". The format of the file is: comment line - generally info about the P velocity model comment line - generally info about the S velocity model depth pVel sVel Density depth pVel sVel Density . . . The velocities are assumed to be linear between sample points. Because this type of model file doesn't give complete information we make the following assumptions: modelname - from the filename, with ".tvel" dropped if present radiusOfEarth - the largest depth in the model meanDensity - 5517.0 G - 6.67e-11 Also, because this method makes use of the string tokenizer, comments are allowed. # as well as // signify that the rest of the line is a comment. C style slash-star comments are also allowed.- Throws:
VelocityModelException- occurs if an EOL should have been read but wasn't. This may indicate a poorly formatted tvel file.IOException
-
readTVelFile
public static VelocityModel readTVelFile(Reader in, String modelName) throws IOException, VelocityModelException - Throws:
IOExceptionVelocityModelException
-
readNDFile
This method reads in a velocity model from a "nd" ASCII text file, the format used by Xgbm. The name of the model file for model "modelname" should be "modelname.nd". The format of the file is: depth pVel sVel Density Qp Qs depth pVel sVel Density Qp Qs . . . with each major boundary separated with a line with "mantle", "outer-core" or "inner-core". "moho", "cmb" and "icocb" are allowed as synonyms respectively. This feature makes phase interpretation much easier to code. Also, as they are not needed for travel time calculations, the density, Qp and Qs may be omitted.The velocities are assumed to be linear between sample points. Because this type of model file doesn't give complete information we make the following assumptions:
modelname - from the filename, with ".nd" dropped, if present
radiusOfEarth - the largest depth in the model
Also, because this method makes use of the string tokenizer, comments are allowed. # as well as // signify that the rest of the line is a comment. C style slash-star comments are also allowed.
- Throws:
VelocityModelException- occurs if an EOL should have been read but wasn't. This may indicate a poorly formatted model file.IOException
-
readNDFile
public static VelocityModel readNDFile(Reader in, String modelName) throws IOException, VelocityModelException - Throws:
IOExceptionVelocityModelException
-
fixDisconDepths
resets depths of major discontinuities to match those existing in the input velocity model. The initial values are set such that if there is no discontinuity within the top 65 km then the moho is set to 0.0. Similarly, if there are no discontinuities at all then the cmb is set to the radius of the earth. Similarly for the iocb, except it must be a fluid to solid boundary and deeper than 100km to avoid problems with shallower fluid layers, eg oceans. Generally this is only needed for the .tvel model format as it does not have a means to name discontinuities.- Throws:
VelocityModelException
-
earthFlattenTransform
Returns a flat velocity model object equivalent to the spherical velocity model via the earth flattening transform.- Returns:
- the flattened VelocityModel object.
-
calcReflTransCoefFreeSurface
- Throws:
VelocityModelException
-
calcReflTransCoef
- Throws:
VelocityModelException
-
calcReflTransCoef
public static ReflTrans calcReflTransCoef(double abovePVel, double aboveSVel, double aboveRho, double belowPVel, double belowSVel, double belowRho) throws VelocityModelException - Throws:
VelocityModelException
-
calcReflTransCoef
public static ReflTrans calcReflTransCoef(double abovePVel, double aboveSVel, double aboveRho, double belowPVel, double belowSVel, double belowRho, boolean downgoing) throws VelocityModelException - Throws:
VelocityModelException
-