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/data_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
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
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/data_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@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
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@lists.spacepope.org] On Behalf Of Matthew Turk Sent: Tuesday, October 20, 2015 12:33 PM To: Discussion of the yt analysis package
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
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@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Oops, make that:
f.create_dataset("/density", data=cg["Density"])
On Tue, Oct 20, 2015 at 10:45 AM, Dave Semeraro
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@lists.spacepope.org] On Behalf Of Matthew Turk Sent: Tuesday, October 20, 2015 12:33 PM To: Discussion of the yt analysis package
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
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@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Also in the next major release of yt there will be much richer support for
saving derived data and working with it locally using the new ytdata
frontend that Britton Smith has put in. If you're interested in playing
with that, I'm sure feedback would be very much appreciated. I can give you
more information offline about how to set up a development version of yt
including Britton's pull request.
https://bitbucket.org/yt_analysis/yt/pull-requests/1788/adding-ytdata-fronte...
On Tue, Oct 20, 2015 at 10:55 AM, Matthew Turk
Oops, make that:
f.create_dataset("/density", data=cg["Density"])
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",
On Tue, Oct 20, 2015 at 10:45 AM, Dave Semeraro
wrote: 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@lists.spacepope.org] On Behalf Of Matthew Turk Sent: Tuesday, October 20, 2015 12:33 PM To: Discussion of the yt analysis package
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
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@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
That did it. Thanks Matt.
-----Original Message----- From: yt-users [mailto:yt-users-bounces@lists.spacepope.org] On Behalf Of Matthew Turk Sent: Tuesday, October 20, 2015 12:56 PM To: Discussion of the yt analysis package
Subject: Re: [yt-users] writing out covering grid. Oops, make that:
f.create_dataset("/density", data=cg["Density"])
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-
On Tue, Oct 20, 2015 at 10:45 AM, Dave Semeraro
wrote: 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@lists.spacepope.org] On Behalf Of Matthew Turk Sent: Tuesday, October 20, 2015 12:33 PM To: Discussion of the yt analysis package
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
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@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (3)
-
Dave Semeraro
-
Matthew Turk
-
Nathan Goldbaum