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

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 --var command line option.

Command line options:


Input VTK file or glob pattern


The variables to plot, plots all if not given


Hide warnings (optional, default false)

Package reference



Convenience function that checks if a path exists and creates it if needed

Parameters:filepath – Path to a file or directory that is to be created


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.

  • name (str) – Name of the variable (will be used to reference it)
  • data (array_like) – Variable data. First dimensions must match the cell dimensions.
Returns:The cell centers of the grid.
Return type:array_like
Returns:The cell variables as key-value pairs
Return type:dict
dim = None

dimensionality of the grid


Merge two grids into a new grid instance

class dorie.utilities.grid.RegularGrid(cellCenters)[source]

Class implementing a grid interface for given cell centers on a regular grid.

class dorie.utilities.grid.StructuredVTKGrid[source]
class dorie.utilities.grid.UnstructuredVTKGrid(pointCoords, connectivity, ppc)[source]

Class for storing an unstructured grid and cell variables defined on it.

  • 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

Integrates an array v defined on each cell center across the grid.

Parameters:v – Input array of shape (ncells, dim) or scalar
Returns:Cell point coordinates x, y, z and connectivity c as (x, y, z), c
Return type:tuple

dorie.utilities.fuzzy_compare_grid, grid2, abstol=1e-07, reltol=1e-07, strict=False)[source]


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.


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.


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

Wrapper function that determines the type of the vtk files given and passes them along to the respective reader function.

  • 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)



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

Returns the first .vtr or .vtu file found in a folder.

Parameters:location – folder to be searched

Returns the last .vtr or .vtu file found in a folder.

Parameters:location – folder to be searched


Wrapper function that loops over the pvd files given and passes them along to the reader function _read_single_pvd().

Parameters:files (str or list of str) – Holds the file(s) to be read


dorie.utilities._load_all_in_folder.load(package, location)[source]


exception dorie.utilities.warnings.VTKWarning[source]