[cig-commits] r20136 - short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv210

brad at geodynamics.org brad at geodynamics.org
Tue May 15 15:04:50 PDT 2012


Author: brad
Date: 2012-05-15 15:04:49 -0700 (Tue, 15 May 2012)
New Revision: 20136

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

Modified: short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv210/tabulate_offfaultdata.py
===================================================================
--- short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv210/tabulate_offfaultdata.py	2012-05-15 21:56:59 UTC (rev 20135)
+++ short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv210/tabulate_offfaultdata.py	2012-05-15 22:04:49 UTC (rev 20136)
@@ -16,7 +16,7 @@
 outdir = "scecfiles/%s_%s_%03dm/" % (sim,cell,dx)
 
 # ----------------------------------------------------------------------
-import tables
+import h5py
 import numpy
 import time
 
@@ -33,8 +33,8 @@
 
 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:
@@ -49,9 +49,9 @@
 
 
 # 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/tpv210/tabulate_onfaultdata.py
===================================================================
--- short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv210/tabulate_onfaultdata.py	2012-05-15 21:56:59 UTC (rev 20135)
+++ short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv210/tabulate_onfaultdata.py	2012-05-15 22:04:49 UTC (rev 20136)
@@ -16,7 +16,7 @@
 outdir = "scecfiles/%s_%s_%03dm/" % (sim,cell,dx)
 
 # ----------------------------------------------------------------------
-import tables
+import h5py
 import numpy
 import time
 
@@ -36,8 +36,8 @@
 
 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:
@@ -52,10 +52,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/tpv210/tabulate_ruptime.py
===================================================================
--- short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv210/tabulate_ruptime.py	2012-05-15 21:56:59 UTC (rev 20135)
+++ short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv210/tabulate_ruptime.py	2012-05-15 22:04:49 UTC (rev 20136)
@@ -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