discretize.utils.mesh_builder_xyz#
- discretize.utils.mesh_builder_xyz(xyz, h, padding_distance=None, base_mesh=None, depth_core=None, expansion_factor=1.3, mesh_type='tensor', tree_diagonal_balance=None)[source]#
Generate a tensor or tree mesh using a cloud of points.
For a cloud of (x,y[,z]) locations and specified minimum cell widths (hx,hy,[hz]), this function creates a tensor or a tree mesh. The lateral extent of the core region is determine by the cloud of points. Other properties of the mesh can be defined automatically or by the user. If base_mesh is an instance of
TensorMeshorTreeMesh, the core cells will be centered on the underlying mesh to reduce interpolation errors.- Parameters:
- xyz(
n,dim)numpy.ndarray Location points
- h(
dim)list Cell size(s) for the core mesh
- padding_distance
list,optional Padding distances [[W,E], [N,S], [Down,Up]], default is no padding.
- base_mesh
discretize.TensorMeshordiscretize.TreeMesh,optional discretize mesh used to center the core mesh
- depth_core
float,optional Depth of core mesh below xyz
- expansion_factorfloat.
optional Expansion factor for padding cells. Ignored if mesh_type = tree
- mesh_type{‘tensor’, ‘tree’}
Specify output mesh type
- tree_diagonal_balancebool,
optional Whether to diagonally balance the tree mesh, None will use the TreeMesh default behavoir.
- xyz(
- Returns:
discretize.TensorMeshordiscretize.TreeMeshMesh of type specified by mesh_type
Examples
>>> import discretize >>> import matplotlib.pyplot as plt >>> import numpy as np >>> rng = np.random.default_rng(87142)
>>> xy_loc = rng.standard_normal((8,2)) >>> mesh = discretize.utils.mesh_builder_xyz( ... xy_loc, [0.1, 0.1], depth_core=0.5, ... padding_distance=[[1,2], [1,0]], ... mesh_type='tensor', ... )
>>> axs = plt.subplot() >>> mesh.plot_image(mesh.cell_volumes, grid=True, ax=axs) >>> axs.scatter(xy_loc[:,0], xy_loc[:,1], 15, c='w', zorder=3) >>> axs.set_aspect('equal') >>> plt.show()
(
Source code,png,pdf)