parq_blockmodel.geometry.RegularGeometry

class parq_blockmodel.geometry.RegularGeometry(corner, block_size, shape=<property object>, axis_u=(1, 0, 0), axis_v=(0, 1, 0), axis_w=(0, 0, 1), srs=None)[source]

Regular geometry data class.

__init__(corner, block_size, shape=<property object>, axis_u=(1, 0, 0), axis_v=(0, 1, 0), axis_w=(0, 0, 1), srs=None)

Methods

__init__(corner, block_size[, shape, ...])

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_azimuth, ...])

from_parquet(filepath[, axis_azimuth, ...])

is_compatible(other)

Check if the geometry is compatible with another RegularGeometry.

nearest_centroid_lookup(x, y, z)

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

to_dataframe()

Convert a RegularGeometry to a DataFrame using the cached centroids.

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_pyvista()

to_spatial_index()

Convert a RegularGeometry to an encoded integer index

to_summary_json()

Convert the geometry to a JSON string.

Attributes

axis_angles

Return (azimuth, dip, plunge) corresponding to axis_u, axis_v, axis_w.

axis_u

axis_v

axis_w

bounding_box

centroid_u

Return the unique u coordinates of the centroids.

centroid_v

Return the unique v coordinates of the centroids.

centroid_w

Return the unique w coordinates of the centroids.

centroid_x

Return the x coordinates of the centroids.

centroid_y

Return the y coordinates of the centroids.

centroid_z

Return the z coordinates of the centroids.

extents

is_regular

is_rotated

Check if the geometry is rotated.

num_blocks

shape

srs

summary

corner

block_size

property axis_angles

Return (azimuth, dip, plunge) corresponding to axis_u, axis_v, axis_w.

property centroid_u: ndarray

Return the unique u coordinates of the centroids.

property centroid_v: ndarray

Return the unique v coordinates of the centroids.

property centroid_w: ndarray

Return the unique w coordinates of the centroids.

property centroid_x: ndarray

Return the x coordinates of the centroids.

property centroid_y: ndarray

Return the y coordinates of the centroids.

property centroid_z: ndarray

Return the z coordinates of the centroids.

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

is_compatible(other)[source]

Check if the geometry is compatible with another RegularGeometry.

Parameters:

other (RegularGeometry) – The other RegularGeometry to check compatibility with.

Returns:

True if the geometries are compatible, False otherwise.

Return type:

bool

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_dataframe()[source]

Convert a RegularGeometry to a DataFrame using the cached centroids.

Returns:

The DataFrame representing the blockmodel element geometry.

Return type:

pd.DataFrame

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

Returns:

The MultiIndex representing the blockmodel element geometry.

Return type:

pd.MultiIndex

to_spatial_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