[CIG-SHORT] Principle stress

Ma, Xiao xiaoma5 at illinois.edu
Wed Dec 4 16:00:19 PST 2013


Hi,
Thanks for the help. hoever I still can't get this done I got these error from python
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 523, in runfile
    execfile(filename, namespace)
  File "C:\Users\Max\Desktop\New folder (2)\model82\pricstress.py", line 19, in <module>
    field = h5.create_dataset('cell_fields/pstress',data=pstress[:,:])
  File "C:\Python27\lib\site-packages\h5py\_hl\group.py", line 71, in create_dataset
    dsid = dataset.make_new_dset(self, shape, dtype, data, **kwds)
  File "C:\Python27\lib\site-packages\h5py\_hl\dataset.py", line 91, in make_new_dset
    dset_id = h5d.create(parent.id, None, tid, sid, dcpl=dcpl)
  File "h5d.pyx", line 75, in h5py.h5d.create (h5py\h5d.c:1567)
ValueError: unable to create dataset (Dataset: Unable to initialize object
_______________________________________________________________
Here is what I am coding :
import numpy
import h5py
import matplotlib.pyplot as plt
# Load in change in tractions from coseismic simulation
h5 = h5py.File("output/stress.h5", 'r', driver="sec2")

vertices = h5['geometry/vertices'][:]
#tractions_change = h5['vertex_fields/traction_change'][0,:,:]
stress=h5['cell_fields/stress'][:]
#h5.close()
pstress=(stress[:,:,0]+stress[:,:,1])/2+numpy.sqrt(((stress[:,:,0]-stress[:,:,1])/2)**2+(stress[:,:,2])**2)
field = h5.create_dataset('cell_fields/pstress',data=pstress[:,:])
field.attrs['vector_field_type']='other'
h5.close()
______________________________________________________________
Thank you so much
Best wishes,
Xiao
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://geodynamics.org/pipermail/cig-short/attachments/20131205/537c5ce5/attachment-0001.html>


More information about the CIG-SHORT mailing list