gstools.field.base¶
GStools subpackage providing a base class for spatial fields.
The following classes are provided
Field (model[, mean]) |
A field base class for random and kriging fields ect. |
-
class
gstools.field.base.
Field
(model, mean=0.0)[source]¶ A field base class for random and kriging fields ect.
Parameters: Attributes: Methods
__call__
(**kwargs)Generate the field. mesh
(mesh[, points, direction, name])Generate a field on a given meshio or ogs5py mesh. plot
([field, fig, ax])Plot the spatial random field. structured
(*args, **kwargs)Generate a field on a structured mesh. to_pyvista
([field_select, fieldname])Create a VTK/PyVista grid of the stored field. unstructured
(*args, **kwargs)Generate a field on an unstructured mesh. vtk_export
(filename[, field_select, fieldname])Export the stored field to vtk. -
mesh
(mesh, points='centroids', direction='xyz', name='field', **kwargs)[source]¶ Generate a field on a given meshio or ogs5py mesh.
Parameters: - mesh (meshio.Mesh or ogs5py.MSH) – The given meshio or ogs5py mesh
- points (
str
, optional) – The points to evaluate the field at. Either the “centroids” of the mesh cells (calculated as mean of the cell vertices) or the “points” of the given mesh. Default: “centroids” - direction (
str
, optional) – Here you can state which direction should be choosen for lower dimension. For example, if you got a 2D mesh in xz direction, you have to pass “xz” Default: “xyz” - name (
str
, optional) – Name to store the field in the given mesh as point_data or cell_data. Default: “field” - **kwargs – Keyword arguments forwareded to Field.__call__.
Notes
This will store the field in the given mesh under the given name, if a meshio mesh was given.
See: https://github.com/nschloe/meshio
See:
Field.__call__
-
plot
(field='field', fig=None, ax=None)[source]¶ Plot the spatial random field.
Parameters: - field (
str
, optional) – Field that should be plotted. Can be: “field”, “raw_field”, “krige_field”, “err_field” or “krige_var”. Default: “field” - fig (
Figure
orNone
) – Figure to plot the axes on. If None, a new one will be created. Default: None - ax (
Axes
orNone
) – Axes to plot on. If None, a new one will be added to the figure. Default: None
- field (
-
structured
(*args, **kwargs)[source]¶ Generate a field on a structured mesh.
See
Field.__call__
-
to_pyvista
(field_select='field', fieldname='field')[source]¶ Create a VTK/PyVista grid of the stored field.
Parameters:
-
unstructured
(*args, **kwargs)[source]¶ Generate a field on an unstructured mesh.
See
Field.__call__
-
vtk_export
(filename, field_select='field', fieldname='field')[source]¶ Export the stored field to vtk.
Parameters: - filename (
str
) – Filename of the file to be saved, including the path. Note that an ending (.vtr or .vtu) will be added to the name. - field_select (
str
, optional) – Field that should be stored. Can be: “field”, “raw_field”, “krige_field”, “err_field” or “krige_var”. Default: “field” - fieldname (
str
, optional) – Name of the field in the VTK file. Default: “field”
- filename (
-