<div dir="ltr">Hi Matt,<div><br></div><div>So the fix would be to get the field_info via _get_field_info in __call__ for the derived quantity?</div><div><br></div><div>-Natan</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">

On Tue, Apr 1, 2014 at 5:04 PM, Matthew Turk <span dir="ltr"><<a href="mailto:matthewturk@gmail.com" target="_blank">matthewturk@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hi Nathan,<br>
<br>
This was by design -- whether that was right or not -- because I<br>
wanted to allow all of the objects to be created without requiring an<br>
index, until data was accessed.  Specifically this fails because<br>
TotalMass accesses field_info directly instead of via _get_field_info.<br>
<br>
-Matt<br>
<div class="HOEnZb"><div class="h5"><br>
On Tue, Apr 1, 2014 at 8:02 PM, Nathan Goldbaum<br>
<<a href="mailto:issues-reply@bitbucket.org">issues-reply@bitbucket.org</a>> wrote:<br>
> New issue 825: Creating an all_data object does not generate the field_info object.<br>
> <a href="https://bitbucket.org/yt_analysis/yt/issue/825/creating-an-all_data-object-does-not" target="_blank">https://bitbucket.org/yt_analysis/yt/issue/825/creating-an-all_data-object-does-not</a><br>
><br>
> Nathan Goldbaum:<br>
><br>
> The following script and traceback illustrates the issue:<br>
><br>
><br>
> ```<br>
> #!python<br>
><br>
> import yt<br>
><br>
> ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')<br>
><br>
> ad = ds.all_data()<br>
><br>
> print ad.quantities.total_mass()<br>
> ```<br>
><br>
><br>
> ```<br>
>   File "test.py", line 7, in <module><br>
>     print ad.quantities.total_mass()<br>
>   File "/Users/goldbaum/Documents/yt-hg/yt/data_objects/derived_quantities.py", line 188, in __call__<br>
>     fi = self.data_source.pf.field_info<br>
> AttributeError: 'EnzoDataset' object has no attribute 'field_info'<br>
><br>
> ```<br>
><br>
> Adding a call to ds.index before the call to the `total_mass` derived quantity eliminates the error.<br>
><br>
><br>
><br>
> _______________________________________________<br>
> yt-dev mailing list<br>
> <a href="mailto:yt-dev@lists.spacepope.org">yt-dev@lists.spacepope.org</a><br>
> <a href="http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org</a><br>
_______________________________________________<br>
yt-dev mailing list<br>
<a href="mailto:yt-dev@lists.spacepope.org">yt-dev@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org</a><br>
</div></div></blockquote></div><br></div>