[cig-commits] r20152 - short/3D/PyLith/benchmarks/trunk/quasistatic/sceccrustdeform/savageprescott

brad at geodynamics.org brad at geodynamics.org
Wed May 16 10:39:58 PDT 2012


Author: brad
Date: 2012-05-16 10:39:57 -0700 (Wed, 16 May 2012)
New Revision: 20152

Modified:
   short/3D/PyLith/benchmarks/trunk/quasistatic/sceccrustdeform/savageprescott/plot_profiles.py
   short/3D/PyLith/benchmarks/trunk/quasistatic/sceccrustdeform/savageprescott/plot_soln.py
Log:
Switched from tables to h5py.

Modified: short/3D/PyLith/benchmarks/trunk/quasistatic/sceccrustdeform/savageprescott/plot_profiles.py
===================================================================
--- short/3D/PyLith/benchmarks/trunk/quasistatic/sceccrustdeform/savageprescott/plot_profiles.py	2012-05-16 16:45:56 UTC (rev 20151)
+++ short/3D/PyLith/benchmarks/trunk/quasistatic/sceccrustdeform/savageprescott/plot_profiles.py	2012-05-16 17:39:57 UTC (rev 20152)
@@ -7,7 +7,7 @@
 #
 # Plot slip profiles over cycles.
 #
-# PREREQUISITES: matplotlib, numpy, tables
+# PREREQUISITES: matplotlib, numpy, h5py
 
 style = "lightbg"
 fontsize = 8
@@ -93,11 +93,11 @@
 
   def __init__(self, cell, dx):
     filename = "output/%s_%s-groundsurf.h5" % (cell.lower(), dx)
-    import tables
-    h5 = tables.openFile(filename, "r")
-    time = h5.root.time[:]
-    vertices = h5.root.geometry.vertices[:]
-    disp = h5.root.vertex_fields.displacement[:]
+    import h5py
+    h5 = h5py.File(filename, "r", driver="sec2")
+    time = h5['time'][:]
+    vertices = h5['geometry/vertices'][:]
+    disp = h5['vertex_fields/displacement'][:]
     h5.close()
     indices = numpy.bitwise_and(numpy.fabs(vertices[:,1]) < 1.0,
                                 vertices[:,0] >= 0.0)

Modified: short/3D/PyLith/benchmarks/trunk/quasistatic/sceccrustdeform/savageprescott/plot_soln.py
===================================================================
--- short/3D/PyLith/benchmarks/trunk/quasistatic/sceccrustdeform/savageprescott/plot_soln.py	2012-05-16 16:45:56 UTC (rev 20151)
+++ short/3D/PyLith/benchmarks/trunk/quasistatic/sceccrustdeform/savageprescott/plot_soln.py	2012-05-16 17:39:57 UTC (rev 20152)
@@ -7,6 +7,10 @@
 #
 # ======================================================================
 #
+#
+# Plot solution over domain.
+#
+# PREREQUISITES: Myavi2, numpy, h5py
 
 cell = "hex8"
 resolution = "6.7km"
@@ -162,20 +166,20 @@
 
   def _readData(self):
     from tvtk.api import tvtk
-    import tables
+    import h5py
     import numpy
 
     filename = "output/%s_%s.h5" % (cell, resolution)
-    h5 = tables.openFile(filename, 'r')
+    h5 = h5py.File(filename, 'r', driver="sec2")
 
     elastThick = 40.0e+3
     eqslip = 4.0
 
-    cells = h5.root.topology.cells[:]
+    cells = h5['topology/cells'][:]
     (ncells, ncorners) = cells.shape
-    vertices = h5.root.geometry.vertices[:] / elastThick
+    vertices = h5['geometry/vertices'][:] / elastThick
     (nvertices, spaceDim) = vertices.shape
-    disp = h5.root.vertex_fields.displacement[tindex,:,:] / eqslip
+    disp = h5['vertex_fields/displacement'][tindex,:,:] / eqslip
     h5.close()
     
     if cell == "tet4":



More information about the CIG-COMMITS mailing list