Hi Dave,
Quick followup. I realized we do this already for Gas_Energy and
Total_Energy, as you can see in yt/lagos/EnzoFields.py on line 71.
Note that this might get sticky if you are deriving from StaticOutput
or EnzoStaticOutput with a new field container and want these to be
communicated up and down the hierarchy of possibilities. I think that
is probably an extreme corner case, though.
So, in short, it should work well, and if it doesn't, it is a bug and
it should be fixed.
-Matt
On Wed, May 27, 2009 at 3:39 PM, Matthew Turk
Hi Dave,
It should be the same call to add field. However, the more I think about it, the more I think it will default to using the data field over the derived field, and so you should be safe adding it as a derived field in *all* cases. I have conducted a few experiments and this seems to be true over here.
You should check this by adding a field that supplies bad values, or raises an exception. However, from my reading of the AMRGridPatch.get_data function, I believe it will first try the data reader and then fall back to generating it on the fly. hierarchy.field_list *only* contains fields it finds in the data files, and that is what the grid type checks against. AMRData.get_data also checks against this list and will generate the field if it is not there.
Can you give it a shot, let us know if this is not the case?
-Matt
On May 27, 2009, at 3:14 PM, David Collins
wrote: 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
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@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 (1)
-
Matthew Turk