[CIG-SHORT] Principle stress

Matthew Knepley knepley at mcs.anl.gov
Wed Dec 4 16:31:58 PST 2013


On Wed, Dec 4, 2013 at 6:00 PM, Ma, Xiao <xiaoma5 at illinois.edu> wrote:

>  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
>

Xiao, this is really an h5py question. I suggest working through some of
their examples
to become familiar with HDF5 and their interface.

  Thanks,

      Matt


>  _______________________________________________________________
> 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
>
> _______________________________________________
> CIG-SHORT mailing list
> CIG-SHORT at geodynamics.org
> http://geodynamics.org/cgi-bin/mailman/listinfo/cig-short
>



-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://geodynamics.org/pipermail/cig-short/attachments/20131204/154e9578/attachment.html>


More information about the CIG-SHORT mailing list