discretize.utils.mesh_builder_xyz(xyz, h, padding_distance=[[0, 0], [0, 0], [0, 0]], base_mesh=None, depth_core=None, expansion_factor=1.3, mesh_type='tensor')[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 TensorMesh or TreeMesh, the core cells will be centered on the underlying mesh to reduce interpolation errors.

xyz(n, dim) numpy.ndarray

Location points

h(dim ) list

Cell size(s) for the core mesh

padding_distancelist, optional

Padding distances [[W,E], [N,S], [Down,Up]]

base_meshdiscretize.TensorMesh or discretize.TreeMesh, optional

discretize mesh used to center the core mesh

depth_corefloat, 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

discretize.TensorMesh or discretize.TreeMesh

Mesh of type specified by mesh_type


>>> import discretize
>>> import matplotlib.pyplot as plt
>>> import numpy as np
>>> xy_loc = np.random.randn(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)