[cig-commits] r20137 - short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv210-2d

brad at geodynamics.org brad at geodynamics.org
Tue May 15 15:07:17 PDT 2012


Author: brad
Date: 2012-05-15 15:07:16 -0700 (Tue, 15 May 2012)
New Revision: 20137

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

Modified: short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv210-2d/tabulate_offfaultdata.py
===================================================================
--- short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv210-2d/tabulate_offfaultdata.py	2012-05-15 22:04:49 UTC (rev 20136)
+++ short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv210-2d/tabulate_offfaultdata.py	2012-05-15 22:07:16 UTC (rev 20137)
@@ -16,7 +16,7 @@
 outdir = "scecfiles/%s_%s_%03dm/" % (sim,cell,dx)
 
 # ----------------------------------------------------------------------
-import tables
+import h5py
 import numpy
 import time
 
@@ -35,8 +35,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 @@
 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/tpv210-2d/tabulate_onfaultdata.py
===================================================================
--- short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv210-2d/tabulate_onfaultdata.py	2012-05-15 22:04:49 UTC (rev 20136)
+++ short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv210-2d/tabulate_onfaultdata.py	2012-05-15 22:07:16 UTC (rev 20137)
@@ -16,7 +16,7 @@
 outdir = "scecfiles/%s_%s_%03dm/" % (sim,cell,dx)
 
 # ----------------------------------------------------------------------
-import tables
+import h5py
 import numpy
 import time
 
@@ -31,8 +31,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:
@@ -46,10 +46,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]
 



More information about the CIG-COMMITS mailing list