Skip to content

Voxels🍋

Voxel 🍋

Bases: GridObject

A Voxel is grid of regular cells, i-e: - all cells have the same size and geometry - cells are contiguous

Parameters:

Name Type Description Default
name str

object name.

required
shape Optional[IntArray]

number of cells respectively along U, V, W axes.

None
origin Vector

3D point where voxel starts from.

[0.0, 0.0, 0.0]
axis Union[List[Vector], np.ndarray]

direction and size along the axis. Axis are ordered by row, i-e

axis = [
    u,  # vector u, e.g. [1, 0, 0]
    v,  # vector v, e.g. [0, 1, 0]
    w   # vector w, e.g. [0, 0, 1]
]
See example below.

[[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]
extra_coord_labels List[str]

labels corresponding to extra coordinates beyond the grid axes. For example, 4D cube would have an extra-dimension T beyond (U, V, W):

vx = Voxel(
    "test",
    [4, 3, 2, 2],
    axis=[[1, 0, 0], [0, 1, 0], [0, 0, 1], [0, 0, 0]],
    extra_coord_labels=["T"]
)

[]

Raises:

Type Description
ValueError

Object name is not provided

ValueError

Number of dimensions is not equal to number of axis

ValueError

Dimension along any axis is negative

ValueError

Origin or any cell vector doesn't have 3 components X, Y, Z

Info

Note that the grid may not be cartesian. By default, Voxel is 3D however it does support multiple dimensions (2D, 3D, 4D, etc.).

Example

import geolime as geo

u = [2, 0, 0]
v = [0, 2, 0]
w = [0, 0, 5]

vx = geo.Voxel("MyGridObj", [4, 3, 2], axis=[u, v, w])