omfpandas.blockmodels.geometry.RegularGeometry

class omfpandas.blockmodels.geometry.RegularGeometry(corner, axis_u, axis_v, axis_w, block_size, shape=None)[source]

Regular geometry data class.

Regular Geometry applies to an omf.v1 VolumeElement or an omf.v2 RegularBlockModel.

__init__(corner, axis_u, axis_v, axis_w, block_size, shape=None)[source]

Methods

__init__(corner, axis_u, axis_v, axis_w, ...)

from_element(element)

from_extents(extents, block_size[, axis_u, ...])

Create a RegularGeometry from extents.

from_json(json_str)

Deserialize a JSON string to a full geometry object.

from_multi_index(index[, axis_u, axis_v, axis_w])

nearest_centroid_lookup(x, y, z)

Find the nearest centroid for provided x, y, z points.

to_encoded_index()

Convert a RegularGeometry to an encoded integer index

to_json()

Convert the full geometry to a JSON string.

to_json_file(json_filepath)

Write the Geometry to a JSON file.

to_multi_index()

Convert a RegularGeometry to a MultiIndex.

to_summary_json()

Convert the geometry to a JSON string.

Attributes

bounding_box

centroid_u

centroid_v

centroid_w

extents

is_regular

num_cells

shape

summary

block_size

corner

axis_u

axis_v

axis_w

classmethod from_extents(extents, block_size, axis_u=(1, 0, 0), axis_v=(0, 1, 0), axis_w=(0, 0, 1))[source]

Create a RegularGeometry from extents.

Return type:

RegularGeometry

classmethod from_json(json_str)[source]

Deserialize a JSON string to a full geometry object.

Return type:

RegularGeometry

nearest_centroid_lookup(x, y, z)[source]

Find the nearest centroid for provided x, y, z points.

Parameters:
  • x (float) – X coordinate.

  • y (float) – Y coordinate.

  • z (float) – Z coordinate.

Returns:

The coordinates of the nearest centroid.

Return type:

Point3

to_encoded_index()[source]

Convert a RegularGeometry to an encoded integer index

The integer index is encoded to preserve the spatial position.

Use the coordinate_hashing.hashed_index_to_multiindex function to convert it back to x, y, z pd.MultiIndex

Returns:

Return type:

Index

to_json()[source]

Convert the full geometry to a JSON string.

Return type:

str

to_multi_index()[source]

Convert a RegularGeometry to a MultiIndex.

The MultiIndex will have the following levels: - x: The x coordinates of the cell centres - y: The y coordinates of the cell centres - z: The z coordinates of the cell centres

Return type:

MultiIndex