InterpolateXDMF API reference documentation!
InterpolateXDMF is a python package for easy accessing XDMF/HDF5 files as outputed by Finite Element software like OpenGeoSys. It uses the VTK python wrapper and linear interpolation between time steps and grid points access any points in and and time within the simulation domain.
- Copyright (c) 2012-2022, OpenGeoSys Community (http://www.opengeosys.org)
- Distributed under a Modified BSD License.
See accompanying file LICENSE or http://www.opengeosys.org/project/license
- class InterpolateXDMF.InterpolateXDMF.VTUIOObject(obj, points, h5_data, nneighbors=20, dim=3, one_d_axis=0, two_d_planenormal=2, interpolation_backend='scipy')
Bases:
VTUIO
- delete_cell_field()
delete cell field(s) and write data to disk
- Parameters:
fieldnames (str or list) –
ofilename (str) –
- delete_point_field()
delete point field(s) and write data to disk
- Parameters:
fieldnames (str or list) –
ofilename (str) –
- func_to_field()
Add a field to the vtu file (which will be saved directly as “ofilename” by providing a three argument function(x,y,z)
- Parameters:
function (function) –
fieldname (str) –
ofilename (str) –
cell (bool) –
- func_to_m_dim_field()
Add a multidimensional field to the vtu file (which will be saved directly as “ofilename” by providing am array of three argument functions.
- Parameters:
functionarray (array of objects) –
fieldname (str) –
ofilename (str) –
- get_cell_field(fieldname)
Return vtu point field as numpy array.
- Parameters:
fieldname (str) –
- get_cell_field_names()
Get names of all cell fields in the vtu file.
- get_point_field(fieldname)
Return vtu cell field as numpy array.
- Parameters:
fieldname (str) –
- get_point_field_names()
Get names of all point fields in the vtu file.
- point_data_to_cell_data()
convert pointdata to cell data of field “fieldname”
- Parameters:
fieldname (str) –
ofilename (str) –
- write()
Write data as file “filename”.
- Parameters:
filename (str) –
- write_cell_field()
Write a field (numpy array of correct size) to field “fieldname” as file “ofilename”.
- Parameters:
field (array) –
fieldname (str) –
ofilename (str) –
- write_point_field()
Write a field (numpy array of correct size) to field “fieldname” as file “ofilename”.
- Parameters:
field (array) –
fieldname (str) –
ofilename (str) –
- class InterpolateXDMF.InterpolateXDMF.XDMFReader(filename, nneighbors=20, dim=3, one_d_axis=0, two_d_planenormal=2, interpolation_backend='scipy')
Bases:
object
Interface for XDMF data
- Parameters:
filename (str) –
nneighbors (int, optional) – default: 20
dim (int, optional) – default: 3
one_d_axis (int) – between 0 and 2, default: 0
two_d_planenormal (int) – between 0 and 2, default: 2
interpolation_backend (str) – scipy or vtk
- property cell_center_points
Method for obtaining cell center points
- property data_arrays
- get_cell_field(fieldname, timestep=0)
Return vtu cell field as numpy array.
- Parameters:
fieldname (str) –
timestep (int) –
- get_cell_field_names(timestep=0)
Get names of all cell fields in the vtu file. :param timestep: default: 0 :type timestep: int, optional
- get_point_field(fieldname, timestep=0)
Return vtu point field as numpy array.
- Parameters:
fieldname (str) –
timestep (int) –
- get_point_field_names(timestep=0)
Get names of all point fields in the vtu file.
- Parameters:
timestep (int, optional) – default: 0
- property header
- read_aggregate(fieldname, agg_fct, data_type='point', pointsetarray=None)
Return time series data of an aggregate function for field “fieldname”.
- Parameters:
fieldname (str or list) –
agg_fct (str,) – can be: “min”, “max” or “mean”
data_type (str optional) – “point” or “cell”
pointsetarray (str, list or numpy.ndarray) – defines a submesh if str pointsetarray is construed as filename containing the mesh
- read_set_data(time, fieldname, pointsetarray=None, data_type='point', interpolation_method='linear')
Get data of field “fieldname” at time “time” alon a given “pointsetarray”.
- Parameters:
time (float) –
fieldname (str) –
pointsetarray (list, numpy.ndarray or str) – containing a list of 3-tuples
interpolation_method (str) – default: ‘linear’
- read_time_series(fieldname, pts=None, data_type='point', interpolation_method='linear')
Return time series data of field “fieldname” at points pts. Also a list of fieldnames can be provided as “fieldname”
- Parameters:
fieldname (str) –
pts (dict, optional) –
data_type (str optional) – “point” or “cell”
interpolation_method (str, optional) – default: ‘linear
- read_time_slice(time, fieldname)
Print field “fieldname” at time “time”.
- Parameters:
time (float) –
fieldname (str) –
- write_pvd(filename)
Writes data to PVD/VTU
- Parameters:
filename (str) –