[cig-commits] r20138 - short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv16

brad at geodynamics.org brad at geodynamics.org
Tue May 15 15:11:15 PDT 2012


Author: brad
Date: 2012-05-15 15:11:15 -0700 (Tue, 15 May 2012)
New Revision: 20138

Modified:
   short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv16/tabulate_offfaultdata.py
   short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv16/tabulate_onfaultdata.py
   short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv16/tabulate_ruptime.py
Log:
Switched from tables to h5py.

Modified: short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv16/tabulate_offfaultdata.py
===================================================================
--- short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv16/tabulate_offfaultdata.py	2012-05-15 22:07:16 UTC (rev 20137)
+++ short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv16/tabulate_offfaultdata.py	2012-05-15 22:11:15 UTC (rev 20138)
@@ -18,7 +18,7 @@
 outputRoot = "scecfiles/%s_%s_%03dm/" % (sim,cell,dx)
 
 # ----------------------------------------------------------------------
-import tables
+import h5py
 import numpy
 import time
 
@@ -37,8 +37,8 @@
                        [+6000.0, +9000.0,      0.0]]) 
 
 
-h5 = tables.openFile("%s.h5" % (inputRoot), 'r')
-vertices = h5.root.geometry.vertices[:]
+h5 = h5py.File("%s.h5" % (inputRoot), 'r', driver="sec2")
+vertices = h5['geometry/vertices'][:]
 ntargets = targets.shape[0]
 indices = []
 tolerance = 1.0e-6
@@ -52,9 +52,9 @@
 print "Coordinates of selected points:\n",vertices[indices,:]
 
 # Get datasets
-disp = h5.root.vertex_fields.displacement[:]
-vel = h5.root.vertex_fields.velocity[:]
-timeStamps =  h5.root.time[:].ravel()
+disp = h5['vertex_fields/displacement'][:]
+vel = h5['vertex_fields/velocity'][:]
+timeStamps =  h5['time'][:].ravel()
 nsteps = timeStamps.shape[0]
 dt = timeStamps[1] - timeStamps[0]
 

Modified: short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv16/tabulate_onfaultdata.py
===================================================================
--- short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv16/tabulate_onfaultdata.py	2012-05-15 22:07:16 UTC (rev 20137)
+++ short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv16/tabulate_onfaultdata.py	2012-05-15 22:11:15 UTC (rev 20138)
@@ -16,7 +16,7 @@
 outdir = "scecfiles/%s_%s_%03dm/" % (sim,cell,dx)
 
 # ----------------------------------------------------------------------
-import tables
+import h5py
 import numpy
 import time
 
@@ -29,8 +29,8 @@
                        [ 0.0, +9000.0,  -9000.0]]) 
 tolerance = 1.0e-6
 
-h5 = tables.openFile("%s.h5" % inputRoot, 'r')
-vertices = h5.root.geometry.vertices[:]
+h5 = h5py.File("%s.h5" % inputRoot, 'r', driver="sec2")
+vertices = h5['geometry/vertices'][:]
 ntargets = targets.shape[0]
 indices = []
 for target in targets:
@@ -45,10 +45,10 @@
 
 
 # Get datasets
-slip = h5.root.vertex_fields.slip[:]
-slip_rate = h5.root.vertex_fields.slip_rate[:]
-traction = h5.root.vertex_fields.traction[:]
-timeStamps =  h5.root.time[:].ravel()
+slip = h5['vertex_fields/slip'][:]
+slip_rate = h5['vertex_fields/slip_rate'][:]
+traction = h5['vertex_fields/traction'][:]
+timeStamps =  h5['time'][:].ravel()
 nsteps = timeStamps.shape[0]
 dt = timeStamps[1] - timeStamps[0]
 

Modified: short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv16/tabulate_ruptime.py
===================================================================
--- short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv16/tabulate_ruptime.py	2012-05-15 22:07:16 UTC (rev 20137)
+++ short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv16/tabulate_ruptime.py	2012-05-15 22:11:15 UTC (rev 20138)
@@ -16,7 +16,7 @@
 outdir = "scecfiles/%s_%s_%03dm/" % (sim,cell,dx)
 
 # ----------------------------------------------------------------------
-import tables
+import h5py
 import numpy
 import time
 
@@ -24,11 +24,11 @@
 threshold = 0.001 # threshold for detecting slip has started
 maxTime = 1.0e+10 # Large value for default rupture time
 
-h5 = tables.openFile("%s.h5" % inputRoot, 'r')
-vertices = h5.root.geometry.vertices[:]
-slip = h5.root.vertex_fields.slip[:]
-slipRate = h5.root.vertex_fields.slip_rate[:]
-timeStamps =  h5.root.time[:].ravel()
+h5 = h5py.File("%s.h5" % inputRoot, 'r', driver="sec2")
+vertices = h5['geometry/vertices'][:]
+slip = h5['vertex_fields/slip'][:]
+slipRate = h5['vertex_fields/slip_rate'][:]
+timeStamps =  h5['time'][:].ravel()
 dt = timeStamps[1] - timeStamps[0]
 
 h5.close()



More information about the CIG-COMMITS mailing list