<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 7, 2017 at 11:56 AM, 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">Great!  As a quick note, you can use `.d` as shorthand for<br>
`to_ndarray()`.  The YTArray it returns is a subclass of ndarray, so<br>
should in general be usable in both ways; as you probably figured out,<br>
if you do any manipulation of individual elements it adds overhead and<br>
(often frustrating, but hopefully ultimately helpful), restrictions on<br>
combining incorrect units unless you look at it as a strict ndarray.<br></blockquote><div><br></div><div>One tiny note:</div><div><br></div><div>YTArray.d is short for YTArray.ndarray_view(), which returns a view onto the array. This doesn't copy the underlying data.</div><div><br></div><div>YTArray.to_ndarray() is equivalend to YTArray.value or YTArray.v, whcih returns an ndarray containing a copy of the underlying array data. Getting a copy sometimes adds overhead.</div><div><br></div><div>Choosing whether or now you want a copy comes down to what exactly you are doing, since copying adds overhead, but it also prevents silently overwriting data in an unexpected, nonlocal fashion.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
On Wed, Jun 7, 2017 at 1:53 PM, Klaus Weide <<a href="mailto:klaus@flash.uchicago.edu">klaus@flash.uchicago.edu</a>> wrote:<br>
> On Wed, 7 Jun 2017, Matthew Turk wrote:<br>
><br>
>> Hi Klaus,<br>
>><br>
>> Whoops, I said "grid_collection" but I meant "data_collection".<br>
><br>
> Thanks Matt. I have not tried the 'collection of grids' approach yet, but<br>
> the following does what I want:<br>
><br>
>         ds = yt.load(dump_path)<br>
><br>
>         ad = ds.all_data()<br>
>         if fine_only:<br>
>             maxreflevel = ad.index.grid_levels.max()<br>
>             print '*** Filtering data so that only FLASH refinement level {} cells are used'.format(maxreflevel+1)<br>
>             ad.min_level = maxreflevel<br>
>             ad.max_level = maxreflevel<br>
>             print 'These cover a volume of %s' % ad['cell_volume'].sum()<br>
>         # .....<br>
>         data = {}<br>
>         data['dens'] = ad['dens'].to_ndarray()<br>
>         # .....<br>
><br>
><br>
> Klaus<br>
> ______________________________<wbr>_________________<br>
> yt-users mailing list<br>
> <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
> <a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/<wbr>listinfo.cgi/yt-users-<wbr>spacepope.org</a><br>
______________________________<wbr>_________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/<wbr>listinfo.cgi/yt-users-<wbr>spacepope.org</a><br>
</div></div></blockquote></div><br></div></div>