[yt-users] Field existence check

Matthew Turk matthewturk at gmail.com
Wed May 27 14:50:01 PDT 2009


Hi Dave,

You should be able to do this by looking at the "field_list" property
of the hierarchy object.

i.e.,

pf = load("my_data")
if not "DavesField" in pf.h.field_list:
    add_field(...)

Hope that helps!

-Matt

On Wed, May 27, 2009 at 2:45 PM, david collins <antpuncher at gmail.com> wrote:
> Hi--
>
> I have a derived quantity that I only write to disk in some
> simulations.  Is there a way to check for the existence of a field in
> the data set, so that if it doesn't exist I can derive it?
>
> Thanks,
> d.
> _______________________________________________
> 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