parq_blockmodel.utils.pyvista_utils.df_to_pv_unstructured_grid
- parq_blockmodel.utils.pyvista_utils.df_to_pv_unstructured_grid(df, block_size, validate_block_size=True)[source]
Convert a DataFrame into a PyVista UnstructuredGrid.
This function is for the unstructured grid block model, which is typically used for sparse or irregular block models.
The DataFrame should have a MultiIndex of coordinates (x, y, z) and block sizes (dx, dy, dz). The grid is created based on the centroids of the blocks, and the data is added to the cell data of the grid. The block sizes (dx, dy, dz) can be provided or estimated from the DataFrame.
- Parameters:
df (
DataFrame
) – pd.DataFrame with a MultiIndex of coordinates (x, y, z) and block sizes (dx, dy, dz).block_size (
tuple
[float
,float
,float
]) – tuple of floats, optionalvalidate_block_size (
bool
) – bool, optional
- Returns:
A PyVista UnstructuredGrid object.
- Return type:
pv.UnstructuredGrid