[yt-users] selecting data by refinement level

Klaus Weide klaus at flash.uchicago.edu
Wed Jun 7 11:53:49 PDT 2017


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


More information about the yt-users mailing list