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], 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.
  • Number of dimensions is not equal to number of axis.
  • Dimension along any axis is negative.
  • 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])

convert_to_gis_object(name, properties=None, agg_methods=[AggregationMethod.SUM, AggregationMethod.MIN, AggregationMethod.MAX, AggregationMethod.MEAN], region=None, region_agg=None) 🍋

Create a new GISObject from the GeoRefObject. The original GeoRefObject is not modified.

Parameters:

Name Type Description Default
name str

name of the GISObject to create.

required
properties Optional[List[str]]

list of properties name to transfer to the GIS Object. Setting to None or empty list will select all existing properties.

None
agg_methods List[Union[AggregationMethod, Callable]]

aggregation data methods. See Pandas - Group By to find out supported methods.

[SUM, MIN, MAX, MEAN]
region Optional[str]

Object region or condition to select data from.

None
region_agg Optional[RegionAggregationMethod]

Aggregation region method.

None

Returns:

Type Description
GISObject

GeoLime GISObject.

Raises:

Type Description
ValueError

'X' or 'Y' are part of the properties.

AttributeError

One of the aggregation methods is not supported.

downscale(name, discr) 🍋

Downscale the Voxel by a given discretisation.

Parameters:

Name Type Description Default
name str

name of the newly created Voxel.

required
discr Vector

Discretisation of the new Voxel.

required

Returns:

Type Description
Voxel

Voxel object downscaled.

Raises:

Type Description
ValueError
  • discr must have the shape of the voxel dimension.
  • discr must be composed of integers.

Last update: 2022-01-06