[cig-commits] r12724 - short/3D/PyLith/trunk/playpen/euler
willic3 at geodynamics.org
willic3 at geodynamics.org
Wed Aug 27 13:13:37 PDT 2008
Author: willic3
Date: 2008-08-27 13:13:37 -0700 (Wed, 27 Aug 2008)
New Revision: 12724
Modified:
short/3D/PyLith/trunk/playpen/euler/euler.py
short/3D/PyLith/trunk/playpen/euler/transform.py
Log:
Added documentation string for scaling factor in transform.py and added a
scaling factor for euler.py.
Modified: short/3D/PyLith/trunk/playpen/euler/euler.py
===================================================================
--- short/3D/PyLith/trunk/playpen/euler/euler.py 2008-08-27 20:03:45 UTC (rev 12723)
+++ short/3D/PyLith/trunk/playpen/euler/euler.py 2008-08-27 20:13:37 UTC (rev 12724)
@@ -39,6 +39,7 @@
## @li \b bc_type Boundary condition type (dislocation or displacement).
## @li \b points_file Filename of file containing point coordinates.
## @li \b points_spatialdb Filename of output spatial database.
+ ## @li \b bc_scale Scaling factor for output BC.
## @li \b up_dir Vector defining up direction.
## @li \b normal_dir General preferred normal direction.
## @li \b euler_lat Latitude of Euler pole.
@@ -88,6 +89,9 @@
default="points.spatialdb")
pointsSpatialDB.meta['tip'] = "Filename of output spatial database."
+ bcScale = pyre.inventory.float("bc_scale", default=1.0)
+ bcScale.meta['tip'] = "Scaling factor for output BC."
+
upDir = pyre.inventory.list("up_dir", default=[0.0, 0.0, 1.0])
upDir.meta['tip'] = "Up direction."
@@ -139,7 +143,7 @@
self.numPoints = 0
self.pointsUTM = []
self.normals = []
- self.eulerPole = numpy.array([0.0, 0.0, 0.0], dtype=float64)
+ self.eulerPole = numpy.array([0.0, 0.0, 0.0], dtype=numpy.float64)
# Note that we use a mean radius since we are doing rotations on a
# spherical Earth.
self.earthRad = 6372795.477598
@@ -170,6 +174,7 @@
self.bcType = self.inventory.bcType
self.pointsFile = self.inventory.pointsFile
self.pointsSpatialDB = self.inventory.pointsSpatialDB
+ self.bcScale = self.inventory.bcScale
self.upDir = self.inventory.upDir
self.normalDir = self.inventory.normalDir
self.eulerLat = self.inventory.eulerLat
@@ -199,11 +204,11 @@
self.eulerPole[2] = self.earthRad * rot * slat
self.upVec = numpy.array([float(self.upDir[0]), float(self.upDir[1]),
- float(self.upDir[2])], dtype=float64)
+ float(self.upDir[2])], dtype=numpy.float64)
self.normalVec = numpy.array([float(self.normalDir[0]),
float(self.normalDir[1]),
- float(self.normalDir[2])], dtype=float64)
+ float(self.normalDir[2])], dtype=numpy.float64)
self.dipCutoffProj = abs(math.sin(self.dipCutoff.value))
@@ -245,12 +250,12 @@
from spatialdata.geocoords.Converter import convert
pointsLL = numpy.array(self.pointsUTM,
- dtype=float64).reshape(self.numPoints,
+ dtype=numpy.float64).reshape(self.numPoints,
self.spaceDim)
convert(pointsLL, self.destCoordSys, self.srcCoordSys)
normalsArr = numpy.array(self.normals,
- dtype=float64).reshape(self.numPoints,
+ dtype=numpy.float64).reshape(self.numPoints,
self.spaceDim)
iCount = 0
@@ -269,7 +274,7 @@
for dim in range(self.spaceDim):
f.write(' %.12e' % self.pointsUTM[iCount + dim])
for dim in range(self.spaceDim):
- f.write(' %.12e' % velocity[dim])
+ f.write(' %.12e' % self.bcScale * velocity[dim])
f.write('\n')
iCount += 3
return
@@ -357,13 +362,13 @@
pX = clat * clon
pY = clat * slon
pZ = slat
- pointPole = numpy.array([pX, pY, pZ], dtype=float64)
+ pointPole = numpy.array([pX, pY, pZ], dtype=numpy.float64)
velGlobal = numpy.cross(self.eulerPole, pointPole)
rotMatrix = self._makeRot(latPoint, lonPoint)
velNED = numpy.dot(rotMatrix, velGlobal)
# NOTE: I should rearrange the rotation matrix so this transformation
# isn't necessary.
- velENU = numpy.array([velNED[1], velNED[0], -velNED[2]], dtype=float64)
+ velENU = numpy.array([velNED[1], velNED[0], -velNED[2]], dtype=numpy.float64)
return velENU
@@ -378,7 +383,7 @@
vec1 = [ -slat * clon, -slat * slon, clat]
vec2 = [ -slon, clon, 0.0]
vec3 = [ -clat * clon, -clat * slon, -slat]
- rotMatrix = numpy.array([vec1, vec2, vec3], dtype=float64)
+ rotMatrix = numpy.array([vec1, vec2, vec3], dtype=numpy.float64)
return rotMatrix
Modified: short/3D/PyLith/trunk/playpen/euler/transform.py
===================================================================
--- short/3D/PyLith/trunk/playpen/euler/transform.py 2008-08-27 20:03:45 UTC (rev 12723)
+++ short/3D/PyLith/trunk/playpen/euler/transform.py 2008-08-27 20:13:37 UTC (rev 12724)
@@ -40,6 +40,7 @@
## @li \b data_dim Dimension of data.
## @li \b points_file Filename of file containing point coordinates.
## @li \b segs_file Filename of file containing fault segments.
+ ## @li \b slip_scale Scaling factor for fault slip.
## @li \b points_spatialdb Filename of output spatial database.
## @li \b up_dir Vector defining up direction.
## @li \b normal_dir General preferred normal direction.
@@ -163,11 +164,11 @@
self.defaultValues = self.inventory.defaultValues
self.upVec = numpy.array([float(self.upDir[0]), float(self.upDir[1]),
- float(self.upDir[2])], dtype=float64)
+ float(self.upDir[2])], dtype=numpy.float64)
self.normalVec = numpy.array([float(self.normalDir[0]),
float(self.normalDir[1]),
- float(self.normalDir[2])], dtype=float64)
+ float(self.normalDir[2])], dtype=numpy.float64)
self.dipCutoffProj = abs(math.sin(self.dipCutoff.value))
@@ -208,10 +209,10 @@
"""
normalsArr = numpy.array(self.normals,
- dtype=float64).reshape(self.numPoints,
+ dtype=numpy.float64).reshape(self.numPoints,
self.spaceDim)
- points = numpy.array(self.pointsUTM, dtype=float64).reshape(self.numPoints,
+ points = numpy.array(self.pointsUTM, dtype=numpy.float64).reshape(self.numPoints,
self.spaceDim)
iCount = 0
@@ -312,7 +313,7 @@
ts = self.segInfo[iSeg,7]
dx = sx2 - sx1
dy = sy2 - sy1
- asVec = numpy.array([dx, dy, 0.0], dtype=float64)
+ asVec = numpy.array([dx, dy, 0.0], dtype=numpy.float64)
mag = math.sqrt(numpy.dot(asVec,asVec))
asVec /= mag
horPerp = numpy.cross(self.upVec, asVec)
@@ -326,11 +327,11 @@
dipCos = math.sin(math.radians(dip))
if math.fabs(dipCos) != 1.0:
r = math.sqrt(1.0/(1.0-dipCos*dipCos))
- udVec = numpy.array([horPerp[0]/r, horPerp[1]/r, dipCos], dtype=float64)
+ udVec = numpy.array([horPerp[0]/r, horPerp[1]/r, dipCos], dtype=numpy.float64)
else:
- udVec = numpy.array([0.0, 0.0, dipCos], dtype=float64)
+ udVec = numpy.array([0.0, 0.0, dipCos], dtype=numpy.float64)
normVec = numpy.cross(asVec, udVec)
- slipVec = numpy.array([ss, ds,ts], dtype=float64)
+ slipVec = numpy.array([ss, ds,ts], dtype=numpy.float64)
rot1 = numpy.vstack((asVec, udVec, normVec))
rot = rot1.transpose()
velocity = numpy.dot(rot,slipVec)
@@ -429,7 +430,7 @@
self.numSegs += 1
iCount += 1
f.close()
- self.segInfo = numpy.array(segtmp, dtype=float64).reshape(self.numSegs, 8)
+ self.segInfo = numpy.array(segtmp, dtype=numpy.float64).reshape(self.numSegs, 8)
return
# ----------------------------------------------------------------------
More information about the cig-commits
mailing list