LoopStructural.visualisation.VtkExporter#
- class LoopStructural.visualisation.VtkExporter(model, file_name, bounding_box=None, nsteps=None, **kwargs)#
Bases:
BaseModelPlotter
- Parameters:
model –
- __init__(model, file_name, bounding_box=None, nsteps=None, **kwargs)#
- Parameters:
model –
Methods
__init__
(model, file_name[, bounding_box, ...])- param model:
add_box
(bounding_box, name[, colour])Adds a box to the viewer defined by a bounding box
add_data
(feature[, disks, vectors])Plot the data linked to the feature, can choose whether to plot all data types using value and grad kwargs
add_dtm
([name, colour, paint_with])add_fault
(fault[, step])add_fault_displacements
([cmap])Add a block model painted by the fault displacement magnitude
add_fold
(fold, **kwargs)Draw the vector components of the fold at the locations
add_isosurface
(geological_feature[, value, ...])Plot the surface of a geological feature
add_model
([cmap])Add a block model painted by stratigraphic id to the viewer
add_model_surfaces
([strati, faults, cmap, ...])Add surfaces for all of the interfaces in the model
add_points
(points, name, **kwargs)Plot points location in the lavavu viewer
add_scalar_field
(geological_feature[, name, ...])Add a block the size of the model area painted with the scalar field value
add_section
([geological_feature, axis, ...])Plot a section/map thru the model and paint with a geological feature
add_structural_frame
(frame[, step, data])add_support_box
(geological_feature[, paint])add_value_data
(position, value, name, **kwargs)Plot points data with a value component
add_vector_data
(location, vector, name[, ...])Plot point data with a vector component into the lavavu viewer
add_vector_field
(geological_feature, **kwargs)Plot the gradient of a geological feature at given locations
unfault_grid
(feature[, grid])Attributes
model
The number of elements to use for evaluating the isosurface
nsteps
- add_box(bounding_box, name, colour='red', **kwargs)#
Adds a box to the viewer defined by a bounding box
- Parameters:
bounding_box (np.array) – [[xmin,ymin,zmin], [xmax,ymax,zmax]]
name (string) – name of object in viewer
colour (mpl readable colour format) – [description], by default ‘red’
- add_data(feature, disks=False, vectors=False, **kwargs)#
Plot the data linked to the feature, can choose whether to plot all data types using value and grad kwargs
- Parameters:
feature –
kwargs –
- add_fault_displacements(cmap='rainbow', **kwargs)#
Add a block model painted by the fault displacement magnitude
Calls fault.displacementfeature.evaluate_value(points) for all faults
- Parameters:
cmap (matplotlib cmap, optional) – colourmap name or object from mpl
Notes
It is sensible to increase the viewer step sizes before running this function to increase the resolution of the model as its not possible to interpolate a discrete colourmap and this causes the model to look like a lego block. You can update the model resolution by changing the attribute nsteps >>> viewer.nsteps = np.array([100,100,100])
- add_fold(fold, **kwargs)#
Draw the vector components of the fold at the locations
- Parameters:
object (fold - fold) –
xyz (locations - numpy array of) –
- add_isosurface(geological_feature, value=None, isovalue=None, paint_with=None, slices=None, colour='red', nslices=None, cmap=None, filename=None, names=None, colours=None, opacity=None, function=None, **kwargs)#
Plot the surface of a geological feature
- Parameters:
geological_feature (GeologicalFeature) – [description]
value (float, optional) – value of the scalar field to isosurface
isovalue (float, optional) – value of the scalar field to isosurface, by default None
paint_with (GeologicalFeature, optional) – a geological feature to paint the surface with its evaluate_value results, by default None
slices (list, optional) – values to isosurface, by default None
colour (string, optional) – matplotlib color, by default None
nslices (int, optional) – number of slices to evenly distribute in the model, by default None
cmap (string, optional) – matplotlib colormap, by default None
names (list, optional) – list of names same length as slices
colours (list, optional) – list of colours same length as slices
opacity (double, optional) – change the opacity of the surface(s)
callback_function – called with verts, tri and surface name - e.g. callback_function(verts,tri,name)
- Returns:
[type] – [description]
- add_model(cmap=None, **kwargs)#
Add a block model painted by stratigraphic id to the viewer
Calls self.model.evaluate_model() for a cube surrounding the model.
- Parameters:
cmap (matplotlib cmap, optional) – colourmap name or object from mpl
Notes
It is sensible to increase the viewer step sizes before running this function to increase the resolution of the model as its not possible to interpolate a discrete colourmap and this causes the model to look like a lego block. You can update the model resolution by changing the attribute nsteps >>> viewer.nsteps = np.array([100,100,100])
- add_model_surfaces(strati=True, faults=True, cmap=None, fault_colour='black', displacement_cmap=None, **kwargs)#
Add surfaces for all of the interfaces in the model
- Parameters:
strati (bool, optional) – whether to draw stratigraphy
faults (bool, optional) – whether to draw faults, by default True
cmap (string) – matplotlib cmap
fault_colour (string) – colour string for faults
displacement_cmap (string/None) – if string is specified uses this cmap to colour faults by displacement
Notes
Other parameters are passed to self.add_isosurface()
- add_points(points, name, **kwargs)#
Plot points location in the lavavu viewer
- Parameters:
points (numpy array of the points locations) –
name (string name of the object for lavavu) –
**kwargs (lavavu points kwargs) –
- add_scalar_field(geological_feature, name=None, cmap='rainbow', vmin=None, vmax=None, opacity=None, paint_with=None, **kwargs)#
Add a block the size of the model area painted with the scalar field value
- Parameters:
geological_feature (GeologicalFeature) – the geological feature to colour the scalar field by
name (string, optional) – Name of the object for lavavu, needs to be unique for the viewer object, by default uses feature name
cmap (str, optional) – mpl colourmap reference, by default ‘rainbow’
vmin (double, optional) – minimum value of the colourmap, by default None
vmax (double, optional) – maximum value of the colourmap, by default None
opacity (double, optional) – change the opacity of the block
- add_section(geological_feature=None, axis='x', value=None, paint_with=None, name=None, **kwargs)#
Plot a section/map thru the model and paint with a geological feature
- Parameters:
geological_feature (Geological feature) – The feature to paint the section with
axis (string) – which axis, x,y,z
value (float) – Where to make the section
kwargs – additional kwargs passes to lavavu for colourmaps etc
- add_value_data(position, value, name, **kwargs)#
Plot points data with a value component
- Parameters:
position (numpy array N,3 for xyz locations) –
value (N array of values) –
name (string name of the object for lavavu) –
kwargs (kwargs to pass to lavavu) –
- add_vector_data(location, vector, name, normalise=True, symbol_type='arrow', **kwargs)#
Plot point data with a vector component into the lavavu viewer
- Parameters:
position (numpy array N,3 for xyz locations) –
vector (numpy array of vector N,3) –
name (string name for the object in lavavu) –
lavavu (kwargs to pass to) –
- add_vector_field(geological_feature, **kwargs)#
Plot the gradient of a geological feature at given locations
- Parameters:
geological_feature (Geological Feature to evaluate gradient) –
locations (((N,3)) array of evaluation locations) –
kwargs (kwargs for lavavu vector) –
- property nelements: int#
The number of elements to use for evaluating the isosurface
- Returns:
nelements (int) – number of elements to use for isosurfacing