2.6.3. dispatch module

The dispatch.snapshot() procedure returns an instance of the snapshot class, where many of the Fortran data type attributes from the source code are available as Python object attributes. One important attribute is snapshot.patches; a list of patch objects (p), carrying attributes (e.g. p.size) that generally have the same name as the corresponding variables in the code. In addition p.var(iv) is a function that returns a data cube of binary data from the patch. The argument iv takes value that select the memory variable; e.g. iv='d'|'logd'|'ux'|'uy'|'uz'|'e'|'bx'|'by'|'bz'|...

Try for example:

import dispatch
help(dispatch)
help(dispatch.snapshot)
sn=dispatch.snapshot(<TAB>

To read the 1st snapshot from data/, data/run, and ../data/run, do:

sn=dispatch.snapshot(1)
sn=dispatch.snapshot(1,run='run')
sn=dispatch.snapshot(1,'run',data='../data')
p=sn.patches[0]

To see what else is offered, do:

vars(sn)
vars(p)