dorie.utilities¶
What is dorie.utilities?¶
This package bundles some useful python modules that are being used by the other DORiE python packages.
The dorie.utilities scripts¶
-
plot_vtk.py
Plots the given, ASCII encoded, VTK file(s).
This script accepts a VTK file or glob pattern, parses it, invokes
dorie.utilities.vtk_plotter
on each of them, and implements special handling of warnings and exceptions to keep the output as clean as possible.The variables to be plotted may be specified using the
plot_vtk.py --var
command line option.Command line options:
-
--vtk
¶
Input VTK file or glob pattern
-
--var
¶
The variables to plot, plots all if not given
-
--Wn
¶
Hide warnings (optional, default false)
-
Package reference¶
dorie.utilities.grid¶
-
class
dorie.utilities.grid.
BaseGrid
[source]¶ Base class for grids. Implements a simple data and grid cell interface.
-
add_data
(name, data)[source]¶ Used for attaching data to the grid.
Parameters: - name (str) – Name of the variable (will be used to reference it)
- data (array_like) – Variable data. First dimensions must match the cell dimensions.
-
dim
= None¶ dimensionality of the grid
-
-
class
dorie.utilities.grid.
RegularGrid
(cellCenters)[source]¶ Class implementing a grid interface for given cell centers on a regular grid.
-
class
dorie.utilities.grid.
UnstructuredVTKGrid
(pointCoords, connectivity, ppc)[source]¶ Class for storing an unstructured grid and cell variables defined on it.
Parameters: - pointCoords (array_like of shape (npoints,dim)) – Coordinates of the grid points
- connectivity (array_like) – For each cell, the indices of the points that make up the cell
- ppc (3, 4, 8) – Points per grid cell
- dim (int) – Real dimension of the grid
dorie.utilities.vtktools.vtkfile¶
-
class
dorie.utilities.vtktools.vtkfile.
VTKFile
(path)[source]¶ This class does most of the heavy lifting when it comes to reading and operating on ASCII or base64 encoded VTK files.
-
plot
(variables=None)[source]¶ Method to plot the contents of a VTK file. Makes use of matplotlib’s PolyCollection to plot each grid cell. Vector quantites are shown as quiver plots.
Note
Currently works for any 2-dimensional grid that has a usable triangulation method (i.e., all unstructured VTK grids).
Parameters: variables (list of str or None) – Specifies the variables that should be plotted Returns: List of created figure instances
-
read
(variables=None)[source]¶ Wrapper function that determines the type of the vtk files given and passes them along to the respective reader function.
Parameters: - files (str or list of str) – Holds the file(s) to be read
- variables (list of str or None) – CellData variables that should be returned (None reads all variables, but consumes more memory)
-
dorie.utilities.vtktools.vtk_grabber¶
-
dorie.utilities.vtktools.vtk_grabber.
grab_all
(location)[source]¶ Reads the file names of all files ending in .vtr and .vtu in a folder and returns them in a sorted list.
Parameters: location – folder to be searched