[cig-commits] [commit] master: add precision in seg2flt.py floating point output. (b9b8c69)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Wed Jun 4 20:04:01 PDT 2014
Repository : https://github.com/geodynamics/relax
On branch : master
Link : https://github.com/geodynamics/relax/compare/f824f9365a21ba8760de2e40f714706247f2a84e...5dc0660d5364cadb5bdb50a243c0bbbcfedad4e9
>---------------------------------------------------------------
commit b9b8c69283e3c0d695bf7a51c3ba626746887cb2
Author: Sylvain Barbot <sbarbot at ntu.edu.sg>
Date: Tue May 20 08:40:36 2014 -0700
add precision in seg2flt.py floating point output.
>---------------------------------------------------------------
b9b8c69283e3c0d695bf7a51c3ba626746887cb2
examples/turkey/van11/faults/elliott+13_km.flt | 1 -
util/seg2flt.py | 8 ++++----
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/examples/turkey/van11/faults/elliott+13_km.flt b/examples/turkey/van11/faults/elliott+13_km.flt
index 3aba6c1..7cbf4fd 100644
--- a/examples/turkey/van11/faults/elliott+13_km.flt
+++ b/examples/turkey/van11/faults/elliott+13_km.flt
@@ -647,7 +647,6 @@
646 0.0930 15.9501 -12.2691 24.3097 1.0000 1.0808 253.0000 40.0000 0.0000
647 0.1100 15.6577 -13.2254 24.3097 1.0000 1.0808 253.0000 40.0000 0.0000
648 0.0800 15.3653 -14.1817 24.3097 1.0000 1.0808 253.0000 40.0000 0.0000
-# n slip x1 x2 x3 length width strike dip rake
649 0.0000 -8.6549 -8.0935 0.0000 1.0000 0.8583 253.0000 54.0000 0.0000
650 0.0120 -8.9473 -9.0498 0.0000 1.0000 0.8583 253.0000 54.0000 0.0000
651 0.1380 -9.2397 -10.0061 0.0000 1.0000 0.8583 253.0000 54.0000 0.0000
diff --git a/util/seg2flt.py b/util/seg2flt.py
index e4f5987..60bd6c2 100755
--- a/util/seg2flt.py
+++ b/util/seg2flt.py
@@ -65,7 +65,7 @@ def seg2flt(index,x1o,x2o,x3o,L,W,strike,dip,rake,lo,wo,alphal,alphaw,slip=None)
lt=lo*alphal**j
Nl=int(ceil(L/lt))
- lt=L/Nl
+ lt=float(L)/float(Nl)
# loop in strike direction
for i in range(Nl):
@@ -74,7 +74,7 @@ def seg2flt(index,x1o,x2o,x3o,L,W,strike,dip,rake,lo,wo,alphal,alphaw,slip=None)
x3=x3o+i*lt*Sv[2]+sum(w.take(range(j+1)))*Dv[2]
index=index+1
if slip is None:
- savetxt(stdout,[[index,x1,x2,x3,lt,w[j+1],strike,dip,rake]],delimiter=" ",fmt="%4i %8.4f %8.4f %8.4f %8.3f %8.3f %8.2f %5.2f %4.1f")
+ savetxt(stdout,[[index,x1,x2,x3,lt,w[j+1],strike,dip,rake]],delimiter=" ",fmt="%4i %9.4f %9.4f %9.4f %9.4f %9.4f %8.2f %5.2f %4.1f")
else:
savetxt(stdout,[[index,slip,x1,x2,x3,lt,w[j+1],strike,dip,rake]],delimiter=" ",fmt="%4i %+10.3e %8.4f %8.4f %8.4f %8.3f %8.3f %8.2f %5.2f %4.1f")
@@ -97,9 +97,9 @@ def main():
fid=open(fname, 'r')
if isWithSlip:
- print '# nb slip x1 x2 x3 length width strike dip rake'
+ print '# n slip x1 x2 x3 length width strike dip rake'
else:
- print '# nb x1 x2 x3 length width strike dip rake'
+ print '# n x1 x2 x3 length width strike dip rake'
k=0
for line in iter(fid.readlines()):
More information about the CIG-COMMITS
mailing list