omfpandas.reader.OMFPandasReader
- class omfpandas.reader.OMFPandasReader(filepath)[source]
A class to read an OMF file to a pandas DataFrame.
- filepath
Path to the OMF file.
- Type:
Path
- __init__(filepath)[source]
Instantiate the OMFPandasReader object
- Parameters:
filepath (
Union
[str
,Path
,PathLike
]) – Path to the OMF file.
Methods
__init__
(filepath)Instantiate the OMFPandasReader object
find_nearest_centroid
(x, y, z[, blockmodel_name])Find the nearest centroid for provided x, y, z points using a math rounding approach considering the reference centroid.
get_bm_geometry
(blockmodel_name)Get the geometry of a BlockModel.
get_element_attribute_names
(element_name)Get the attribute names of an element.
get_element_by_name
(element_name)Get an element by its name.
plot_blockmodel
(blockmodel_name, scalar[, ...])Plot the BlockModel using PyVista.
read_block_models
(blockmodel_attributes[, ...])Return a DataFrame from multiple BlockModels.
read_blockmodel
(blockmodel_name[, ...])Return a DataFrame from a BlockModel.
view_block_model_profile
(blockmodel_name[, ...])View the profile of a BlockModel in the default web browser.
Attributes
blockmodel_attributes
Attributes for blockmodel elements, keyed by element name, including composites.
changelog
Return the change log as a DataFrame.
element_types
Dictionary of elements keyed by name
- find_nearest_centroid(x, y, z, blockmodel_name=None)[source]
Find the nearest centroid for provided x, y, z points using a math rounding approach considering the reference centroid.
- Parameters:
x (float) – X coordinate.
y (float) – Y coordinate.
z (float) – Z coordinate.
blockmodel_name (
Optional
[str
]) – The optional block model name. If not provided, the geometry for the first Tensor block model is used.
- Returns:
The coordinates of the nearest centroid.
- Return type:
Tuple[float, float, float]
- plot_blockmodel(blockmodel_name, scalar, threshold=True, show_edges=True, show_axes=True)[source]
Plot the BlockModel using PyVista.
- Parameters:
blockmodel_name (str) – The name of the BlockModel to plot.
scalar (str) – The scalar to plot.
threshold (bool) – If True, plot the thresholded mesh. Default is True.
show_edges (bool) – If True, show the edges. Default is True.
show_axes (bool) – If True, show the axes. Default is True.
- Returns:
The PyVista plotter object.
- Return type:
pv.Plotter
- read_block_models(blockmodel_attributes, query=None, encode_index=False)[source]
Return a DataFrame from multiple BlockModels.
- Parameters:
blockmodel_attributes (dict[str, list[str]]) – A dictionary of BlockModel names and the variables to include. If the dict value is None, all attributes in the blockmodel (key) are included.
query (Optional[str]) – A query string to filter the DataFrame. Default is None.
encode_index (
bool
) – If True, encode the index to a single integer.
- Returns:
The DataFrame representing the merged BlockModels.
- Return type:
pd.DataFrame
- read_blockmodel(blockmodel_name, attributes=None, query=None, index_filter=None, encode_index=False)[source]
Return a DataFrame from a BlockModel.
Only variables assigned to the cell (as distinct from the grid points) are loaded.
- Parameters:
blockmodel_name (str) – The name of the BlockModel to read. Use dot notation for composite (e.g., Composite.BlockModel).
attributes (Optional[list[str]]) – The attributes/variables to include in the DataFrame. If None, all variables are included.
query (Optional[str]) – A query string to filter the DataFrame. Default is None.
index_filter (Optional[list[int]]) – A list of indexes to filter the DataFrame. Default is None.
encode_index (bool) – If True, encode the index to a single integer.
- Returns:
The DataFrame representing the BlockModel.
- Return type:
pd.DataFrame