2.6.6.2. Data access demo

Python packages

[1]:
import dispatch
import dispatch.select
import dispatch.graphics

Data and run directories (relative to ../notebooks)

[2]:
data='../data'
run='512m32_hllc'
io=10

Using, from DISPATCH Python packages, dispatch.snapshot() to read in metadata, dispatch.select.uni_gridplane() to get an array with a slice, and dispatch.graphics.imshow() to render it:

[3]:
s=dispatch.snapshot(io,run,data)
slc=dispatch.select.unigrid_plane(s)
import matplotlib.pyplot as pl
pl.figure(figsize=(10,10))
dispatch.graphics.imshow(slc,vmin=-5,vmax=5)
pl.title('t={:.2f}'.format(s.time));

timer:
snapshot metadata:   0.008 sec
         _patches:  11.706 sec
../../../_images/ug_python_notebooks_dg_slice_512_6_1.png