[yt-users] Field existence check

David Collins dcollins at physics.ucsd.edu
Wed May 27 15:14:11 PDT 2009


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


add_field is the same one I've been using from lagos?

I have some datasets that have this field, some that don't, all being
used at the same time.  Can I sometimes add the field, sometimes not?

Thanks a bunch,

d.

>
> 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
>>
> _______________________________________________
> 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