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 (Path) – Path to the OMF file.

Methods

__init__(filepath)

Instantiate the OMFPandasReader object

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.

read_block_models(blockmodel_attributes[, query])

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

changelog

Return the change log as a DataFrame.

read_block_models(blockmodel_attributes, query=None)[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.

Returns:

The DataFrame representing the merged BlockModels.

Return type:

pd.DataFrame

read_blockmodel(blockmodel_name, attributes=None, query=None, index_filter=None)[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 convert.

  • 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.

Returns:

The DataFrame representing the BlockModel.

Return type:

pd.DataFrame