Skip to content

Commit a9ad4e2

Browse files
committed
(DOC) updating documentation for 3d visualisation
1 parent 541f050 commit a9ad4e2

File tree

1 file changed

+20
-33
lines changed

1 file changed

+20
-33
lines changed

LoopStructural/visualisation/model_visualisation.py

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -358,21 +358,28 @@ def add_isosurface(self, geological_feature, value = None, isovalue=None,
358358
vmax = kwargs.get('vmax', max_property_val)
359359
surf.colourmap(cmap, range=(vmin, vmax)) # nodes.shape[0]))
360360

361-
def add_scalar_field(self, geological_feature, **kwargs):
362-
"""
361+
def add_scalar_field(self, geological_feature, name=None, cmap='rainbow', vmin=None, vmax = None, **kwargs):
362+
"""Add a block the size of the model area painted with the scalar field value
363363
364364
Parameters
365365
----------
366366
geological_feature : GeologicalFeature
367367
the geological feature to colour the scalar field by
368-
kwargs
369-
kwargs for lavavu
370-
371-
Returns
372-
-------
368+
name : string, optional
369+
Name of the object for lavavu, needs to be unique for the viewer object, by default uses feature name
370+
cmap : str, optional
371+
mpl colourmap reference, by default 'rainbow'
372+
vmin : double, optional
373+
minimum value of the colourmap, by default None
374+
vmax : double, optional
375+
maximum value of the colourmap, by default None
376+
"""
377+
if name == None:
378+
if geological_feature is None:
379+
name = 'unnamed scalar field'
380+
else:
381+
name = geological_feature.name + '_scalar_field'
373382

374-
"""
375-
name = kwargs.get('name', geological_feature.name + '_scalar_field')
376383
points, tri = create_box(self.bounding_box,self.nsteps)
377384

378385
surf = self.lv.triangles(name)
@@ -381,13 +388,13 @@ def add_scalar_field(self, geological_feature, **kwargs):
381388
val =geological_feature.evaluate_value(self.model.scale(points))
382389
surf.values(val, geological_feature.name)
383390
surf["colourby"] = geological_feature.name
384-
cmap = kwargs.get('cmap',lavavu.cubehelix(100))
385-
386391
logger.info("Adding scalar field of %s to viewer. Min: %f, max: %f" % (geological_feature.name,
387392
geological_feature.min(),
388393
geological_feature.max()))
389-
vmin = kwargs.get('vmin', np.nanmin(val))
390-
vmax = kwargs.get('vmax', np.nanmax(val))
394+
if vmin == None:
395+
vmin =np.nanmin(val)
396+
if vmax == None:
397+
vmax = np.nanmax(val)
391398
surf.colourmap(cmap, range=(vmin, vmax))
392399

393400
def add_model(self, cmap = None, **kwargs):
@@ -549,26 +556,6 @@ def mask(x):
549556
region = kwargs.pop('region',None)
550557
self.add_isosurface(f,isovalue=0,region=mask,colour=fault_colour[0],**kwargs)
551558

552-
# def add_model_data(self, cmap='tab20',**kwargs):
553-
# from matplotlib import cm
554-
# n_units = 0 #count how many discrete colours
555-
# for g in self.model.stratigraphic_column.keys():
556-
# for u in self.model.stratigraphic_column[g].keys():
557-
# n_units+=1
558-
# tab = cm.get_cmap(cmap,n_units)
559-
# ci = 0
560-
561-
# for g in self.model.stratigraphic_column.keys():
562-
# if g in self.model.feature_name_index:
563-
# feature = self.model.features[self.model.feature_name_index[g]]
564-
# for u, vals in self.model.stratigraphic_column[g].items():
565-
# self.add_isosurface(feature, isovalue=vals['max'],name=u,colour=tab.colors[ci,:],**kwargs)
566-
# ci+=1
567-
# if faults:
568-
# for f in self.model.features:
569-
# if f.type == 'fault':
570-
# self.add_isosurface(f,isovalue=0,**kwargs)
571-
572559
def add_vector_field(self, geological_feature, **kwargs):
573560
"""
574561

0 commit comments

Comments
 (0)