[yt-users] selecting data by refinement level

Matthew Turk matthewturk at gmail.com
Wed Jun 7 11:56:51 PDT 2017


Great!  As a quick note, you can use `.d` as shorthand for
`to_ndarray()`.  The YTArray it returns is a subclass of ndarray, so
should in general be usable in both ways; as you probably figured out,
if you do any manipulation of individual elements it adds overhead and
(often frustrating, but hopefully ultimately helpful), restrictions on
combining incorrect units unless you look at it as a strict ndarray.

On Wed, Jun 7, 2017 at 1:53 PM, Klaus Weide <klaus at flash.uchicago.edu> wrote:
> On Wed, 7 Jun 2017, Matthew Turk wrote:
>
>> Hi Klaus,
>>
>> Whoops, I said "grid_collection" but I meant "data_collection".
>
> Thanks Matt. I have not tried the 'collection of grids' approach yet, but
> the following does what I want:
>
>         ds = yt.load(dump_path)
>
>         ad = ds.all_data()
>         if fine_only:
>             maxreflevel = ad.index.grid_levels.max()
>             print '*** Filtering data so that only FLASH refinement level {} cells are used'.format(maxreflevel+1)
>             ad.min_level = maxreflevel
>             ad.max_level = maxreflevel
>             print 'These cover a volume of %s' % ad['cell_volume'].sum()
>         # .....
>         data = {}
>         data['dens'] = ad['dens'].to_ndarray()
>         # .....
>
>
> Klaus
> _______________________________________________
> 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