omf_io.blockmodel.block_model.BlockModelIO

class omf_io.blockmodel.block_model.BlockModelIO(block_data, model_type)[source]

Handles the creation and consumption of block model objects.

__init__(block_data, model_type)[source]

Initialize the BlockModelIO instance.

Parameters:
  • block_data (pandas.DataFrame) – The block model data.

  • model_type (Literal['regular', 'tensor']) – The type of block model.

Methods

__init__(block_data, model_type)

Initialize the BlockModelIO instance.

from_csv(csv_file, model_type)

Create a BlockModelIO instance from a CSV file.

from_parquet(parquet_file, model_type)

Create a BlockModelIO instance from a Parquet file.

to_csv(output_file)

Export the block model data to a CSV file.

to_parquet(output_file)

Export the block model data to a Parquet file.

classmethod from_csv(csv_file, model_type)[source]

Create a BlockModelIO instance from a CSV file.

Parameters:
  • csv_file (Path) – The input CSV file path.

  • model_type (Literal['regular', 'tensor']) – The type of block model.

Returns:

An instance of the class.

Return type:

BlockModelIO

classmethod from_parquet(parquet_file, model_type)[source]

Create a BlockModelIO instance from a Parquet file.

Parameters:
  • parquet_file (Path) – The input Parquet file path.

  • model_type (Literal['regular', 'tensor']) – The type of block model.

Returns:

An instance of the class.

Return type:

BlockModelIO

to_csv(output_file)[source]

Export the block model data to a CSV file.

Parameters:

output_file (Path) – The output CSV file path.

to_parquet(output_file)[source]

Export the block model data to a Parquet file.

Parameters:

output_file (Path) – The output Parquet file path.