Tools for data on structured grids
Griddle deals with data fields on collections of mapped, structured grids. It enables reading, writing, and plotting of such data, including time series. It interfaces to:
The main data structure is a Solution.
Griddle.plot
facilitates plotting of data fields, and especially time series
of data fields, on collections of mapped, structured grids.
It is largely an adaptation of clawpack.visclaw
.
For examples, see this IPython notebook.
The main output functionalities are:
Plot figures on screen or in the notebook. To plot a particular frame:
griddle.plot_frame(plot_spec, frame_num)
Plot an animation in the IPython notebook:
griddle.animate(plot_spec)
Write image files to disk
griddle.write_plots(plot_spec,path='./_plots/',file_format='png')
Launch an interactive plotting command loop:
ip = griddle.Iplotsol(plot_spec)
ip.plotloop()
Web galleries of plots (using sigal):
griddle.make_plot_gallery(plot_spec)
plot_spec
The user must provide a plot_spec
, which is a list of Python dictionaries.
For examples, see griddle/test.py
.
Each dict must specify the data to be plotted in one of the following ways:
plot_spec[i]['data']
: a list of Solution
objectsplot_spec[i]['data_path']
: a directory containing Solution filesEach item must specify which values to plot in one of the following ways:
plot_spec[i]['field'] = j
where j
is the index of the field (an integer)plot_spec[i]['field'] = fun
where fun
is a function that takes a State asEach item must specify the type of plot to be made, via the key
plot_type
. The following plot types are currently supported:
Other properties may be specified for each item in plot_spec
:
Some of the key differences are: