<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Dec 4, 2013 at 6:00 PM, Ma, Xiao <span dir="ltr"><<a href="mailto:xiaoma5@illinois.edu" target="_blank">xiaoma5@illinois.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div>
<div style="direction:ltr;font-size:10pt;font-family:Tahoma">Hi,
<div>Thanks for the help. hoever I still can't get this done I got these error from python</div>
<div>
<div>Traceback (most recent call last):</div>
<div>  File "<stdin>", line 1, in <module></div>
<div>  File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 523, in runfile</div>
<div>    execfile(filename, namespace)</div>
<div>  File "C:\Users\Max\Desktop\New folder (2)\model82\pricstress.py", line 19, in <module></div>
<div>    field = h5.create_dataset('cell_fields/pstress',data=pstress[:,:])</div>
<div>  File "C:\Python27\lib\site-packages\h5py\_hl\group.py", line 71, in create_dataset</div>
<div>    dsid = dataset.make_new_dset(self, shape, dtype, data, **kwds)</div>
<div>  File "C:\Python27\lib\site-packages\h5py\_hl\dataset.py", line 91, in make_new_dset</div>
<div>    dset_id = h5d.create(<a href="http://parent.id" target="_blank">parent.id</a>, None, tid, sid, dcpl=dcpl)</div>
<div>  File "h5d.pyx", line 75, in h5py.h5d.create (h5py\h5d.c:1567)</div>
<div>ValueError: unable to create dataset (Dataset: Unable to initialize object</div></div></div></div></blockquote><div><br></div><div>Xiao, this is really an h5py question. I suggest working through some of their examples</div>
<div>to become familiar with HDF5 and their interface.</div><div><br></div><div>  Thanks,</div><div><br></div><div>      Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div style="direction:ltr;font-size:10pt;font-family:Tahoma"><div>
</div>
<div>_______________________________________________________________</div>
<div>Here is what I am coding :</div>
<div>
<div>import numpy</div>
<div>import h5py</div>
<div>import matplotlib.pyplot as plt</div>
<div># Load in change in tractions from coseismic simulation</div>
<div>h5 = h5py.File("output/stress.h5", 'r', driver="sec2")</div>
<div><br>
</div>
<div>vertices = h5['geometry/vertices'][:]</div>
<div>#tractions_change = h5['vertex_fields/traction_change'][0,:,:]</div>
<div>stress=h5['cell_fields/stress'][:]</div>
<div>#h5.close()</div>
<div>pstress=(stress[:,:,0]+stress[:,:,1])/2+numpy.sqrt(((stress[:,:,0]-stress[:,:,1])/2)**2+(stress[:,:,2])**2)</div>
<div>field = h5.create_dataset('cell_fields/pstress',data=pstress[:,:])</div>
<div>field.attrs['vector_field_type']='other'</div>
<div>h5.close()</div>
</div>
<div>______________________________________________________________</div>
<div>Thank you so much </div>
<div>Best wishes,</div>
<div>Xiao</div>
</div>
</div>

<br>_______________________________________________<br>
CIG-SHORT mailing list<br>
<a href="mailto:CIG-SHORT@geodynamics.org">CIG-SHORT@geodynamics.org</a><br>
<a href="http://geodynamics.org/cgi-bin/mailman/listinfo/cig-short" target="_blank">http://geodynamics.org/cgi-bin/mailman/listinfo/cig-short</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener
</div></div>