[yt-users] writing out covering grid.

Dave Semeraro semeraro at tacc.utexas.edu
Tue Oct 20 10:45:20 PDT 2015


Ok that didn’t work.

>>> f = h5py.File("density","w")
>>> f.create_dataset("/density",cg["Density"])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/work/01197/semeraro/maverick/yt-x86_64/lib/python2.7/site-packages/h5py-2.3.1-py2.7-linux-x86_64.egg/h5py/_hl/group.py", line 94, in create_dataset
    dsid = dataset.make_new_dset(self, shape, dtype, data, **kwds)
  File "/work/01197/semeraro/maverick/yt-x86_64/lib/python2.7/site-packages/h5py-2.3.1-py2.7-linux-x86_64.egg/h5py/_hl/dataset.py", line 112, in make_new_dset
    sid = h5s.create_simple(shape, maxshape)
  File "h5s.pyx", line 91, in h5py.h5s.create_simple (h5py/h5s.c:1377)
  File "utils.pyx", line 132, in h5py.utils.convert_tuple (h5py/utils.c:2023)
TypeError: Can't convert element 0 ([[ 0.11706294  0.11706294  0.11706294 ...,  0.03951106  0.03951106

> -----Original Message-----
> From: yt-users [mailto:yt-users-bounces at lists.spacepope.org] On Behalf Of
> Matthew Turk
> Sent: Tuesday, October 20, 2015 12:33 PM
> To: Discussion of the yt analysis package <yt-users at lists.spacepope.org>
> Subject: Re: [yt-users] writing out covering grid.
> 
> Hi Dave,
> 
> (Nice to hear from you!)  Yes, it's possible, although I have a suspicion why you
> want to.  ;-)  You can do this with h5py much more
> easily:
> 
> import h5py
> f = h5py.File("something", "w")
> f.create_dataset("/density", cg["Density"])
> f.close()
> 
> If you do it with cg["density"] it'll be in CGS, not code units.
> 
> -Matt
> 
> On Tue, Oct 20, 2015 at 10:30 AM, Dave Semeraro
> <semeraro at tacc.utexas.edu> wrote:
> > Hello,
> >
> >
> >
> > I have created a covering grid from a sample Enzo dataset. I would
> > like to write the “density” field to a file. I am doing the following
> > but getting an error.
> >
> >
> >
> > cg = ds.covering_grid(3,[0.,0.,0.],ds.domain_dimensions*2**2)
> >
> >
> >
> > cg.write_out("spoot","Density")
> >
> >
> >
> > Traceback (most recent call last):
> >
> >   File "<stdin>", line 1, in <module>
> >
> >   File
> > "/work/01197/semeraro/maverick/yt-x86_64/src/yt-hg/yt/data_objects/dat
> > a_containers.py",
> > line 399, in write_out
> >
> >     field_data = np.array([self.field_data[field] for field in
> > field_order])
> >
> > KeyError: 'x'
> >
> >
> >
> > Is it possible to write out the single field to a file from a covering grid?
> >
> >
> >
> > DAve
> >
> >
> > _______________________________________________
> > yt-users mailing list
> > yt-users at lists.spacepope.org
> > http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
> >
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org


More information about the yt-users mailing list