[yt-users] derived field and TotalQuantity from two sources possible?
Brian O'Shea
bwoshea at gmail.com
Mon Jul 18 15:17:17 PDT 2011
Hi Geoffrey,
A question: is this actually an Enzo dataset (as in, .cpuNNNN files, with
the parameter, hierarchy, etc. files as well), or are you talking about
monolothic HDF5 files containing a single field that was created by some
third party? If it's the latter, you're better off just using, say, h5py to
read each file in separately, and divide them by each other. I don't think
that the yt machinery is designed for brick-of-bytes HDF5 files (though I
may very well be wrong).
--B
On Mon, Jul 18, 2011 at 5:27 PM, <gso at physics.ucsd.edu> wrote:
> Hi,
>
> I was wondering if it is possible to specify two different sources of
> input to create a derived field. Currently with a single source, I have a
> derived field defined as:
>
> def _HII_HFraction(field, data):
> return data["HII_Density"]/(data["HI_Density"]+data["HII_Density"])
>
> add_field("HII_HFraction", function=_HII_HFraction,
> units=r"\frac{\rho_{HII}}{\rho_H}")
>
> And I can access the total quantity in parallel
>
> pf=load(file)
>
> dd = pf.h.all_data()
>
> dd.quantities["TotalQuantity"]("HII_HFraction")[0]
>
> But I'm dealing with
>
> pf1=load(file1)
> pf2=load(file2)
>
> pf1 has the HI_Density field data and pf2 has the HII_Density field data.
> Is there a way to create a derived field and use TotalQuantity to operate
> on the data in parallel?
>
> From
> G.S.
>
> PS. I guess my alternative is to glue the two HDF5 files into one, but
> want to avoid it if possible.
>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20110718/1990a5a5/attachment.html>
More information about the yt-users
mailing list