[cig-commits] r20134 - short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv205

brad at geodynamics.org brad at geodynamics.org
Tue May 15 14:53:27 PDT 2012


Author: brad
Date: 2012-05-15 14:53:26 -0700 (Tue, 15 May 2012)
New Revision: 20134

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

Modified: short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv205/tabulate_offfault.py
===================================================================
--- short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv205/tabulate_offfault.py	2012-05-15 21:41:13 UTC (rev 20133)
+++ short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv205/tabulate_offfault.py	2012-05-15 21:53:26 UTC (rev 20134)
@@ -15,7 +15,7 @@
 outdir = "scecfiles/%s_%3dm/" % (cell,dx)
 
 # ----------------------------------------------------------------------
-import tables
+import h5py
 import numpy
 import time
 
@@ -26,8 +26,8 @@
 
 tolerance = 1.0e-6
 
-h5 = tables.openFile("%s.h5" % inputRoot, 'r')
-vertices = h5.root.geometry.vertices[:]
+h5 = h5py.File("%s.h5" % inputRoot, 'r')
+vertices = h5['geometry/vertices'][:]
 ntargets = targets.shape[0]
 indices = []
 for target in targets:
@@ -42,9 +42,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/tpv205/tabulate_onfaultdata.py
===================================================================
--- short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv205/tabulate_onfaultdata.py	2012-05-15 21:41:13 UTC (rev 20133)
+++ short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv205/tabulate_onfaultdata.py	2012-05-15 21:53:26 UTC (rev 20134)
@@ -15,7 +15,7 @@
 outdir = "scecfiles/%s_%3dm/" % (cell,dx)
 
 # ----------------------------------------------------------------------
-import tables
+import h5py
 import numpy
 import time
 
@@ -57,8 +57,8 @@
 
 tolerance = 1.0e-6
 
-h5 = tables.openFile("%s.h5" % inputRoot, 'r')
-vertices = h5.root.geometry.vertices[:]
+h5 = h5py.File("%s.h5" % inputRoot, 'r')
+vertices = h5['geometry/vertices'][:]
 ntargets = targets.shape[0]
 indices = []
 for target in targets:
@@ -73,10 +73,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/tpv205/tabulate_ruptime.py
===================================================================
--- short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv205/tabulate_ruptime.py	2012-05-15 21:41:13 UTC (rev 20133)
+++ short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv205/tabulate_ruptime.py	2012-05-15 21:53:26 UTC (rev 20134)
@@ -15,7 +15,7 @@
 outdir = "scecfiles/%s_%3dm/" % (cell,dx)
 
 # ----------------------------------------------------------------------
-import tables
+import h5py
 import numpy
 import time
 
@@ -23,11 +23,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