parq_blockmodel.utils.pyvista_utils.df_to_pv_structured_grid
- parq_blockmodel.utils.pyvista_utils.df_to_pv_structured_grid(df, block_size=None, validate_block_size=True)[source]
Convert a DataFrame into a PyVista StructuredGrid.
This function is for the full grid dense block model.
The DataFrame should have a MultiIndex of coordinates (x, y, z) and data columns. The grid is created assuming uniform block sizes in the x, y, z directions. The grid points are calculated based on the centroids of the blocks, and the data is added to the cell data of the grid.
- Parameters:
df (
DataFrame
) – pd.DataFrame with a MultiIndex of coordinates (x, y, z) and data columns.block_size (
Optional
[tuple
[float
,float
,float
]]) – tuple of floats (dx, dy, dz), optional. Not used if geometry is provided.validate_block_size (
bool
) – bool, optional. Not needed if geometry is provided.
- Returns:
A PyVista StructuredGrid object.
- Return type:
pv.StructuredGrid