[yt-users] add_gradient_field

Nathan Goldbaum nathan12343 at gmail.com
Thu Feb 2 07:47:28 PST 2017


Hi John,

I'm not able to reproduce this behavior. Using the following test script:

http://paste.yt-project.org/show/7012/

I get the following output:

http://paste.yt-project.org/show/7013/

This is using the latest development version of yt.

Can you let me know which yt version you are using?

-Nathan

On Thu, Feb 2, 2017 at 6:22 AM, John Regan <johnanthonyregan at gmail.com>
wrote:

> Hi All,
>
> Just wondering why the snippet of code below fails:
>
> ds = yt.load("......./galaxy0030/galaxy0030")
>
> dd = ds.all_data()
> grad_fields = ds.add_gradient_fields(("gas","gravitational_potential"))
> #for i in sorted(ds.derived_field_list):
> #    print(i)
> print dd["gravitational_potential_gradient_x"]
>
>
> I see the gradient field (4 in total) have been added to the field list
> but I can't access the field.
>
> Error:
> TypeError: only length-1 arrays can be converted to Python scalars
>
> Cheers,
> John
>
> _______________________________________________
> 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/20170202/04368981/attachment.htm>


More information about the yt-users mailing list