Skip to content

Instantly share code, notes, and snippets.

@chrishavlin
Created February 24, 2022 21:31
Show Gist options
  • Save chrishavlin/2adeea748e1f2a4870214bfe11e8954a to your computer and use it in GitHub Desktop.
Save chrishavlin/2adeea748e1f2a4870214bfe11e8954a to your computer and use it in GitHub Desktop.
import yt
from yt_idv import render_context
from yt_idv.scene_data.block_collection import BlockCollection
from yt_idv.scene_components.blocks import BlockRendering
ds = yt.load('m1.0_p16_b2.0_300k_plt50/multitidal_hdf5_plt_cnt_0200')
ad = ds.all_data()
rc = render_context(height=800, width=800, gui=True)
sg = rc.add_scene(ds, None)
# manually build the block collection, with scale=True
ad_block_data = BlockCollection(data_source=ad, scale=True)
ad_block_data.add_data("density", no_ghost=True)
# now a rendering context with the block collection
ad_block_rendering = BlockRendering(data = ad_block_data)
# add it to the scene
sg.data_objects.append(ad_block_data)
sg.components.append(ad_block_rendering)
rc.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment