elphick.geomet.block_model.BlockModel
- class elphick.geomet.block_model.BlockModel(data=None, name=None, moisture_in_scope=True, mass_wet_var=None, mass_dry_var=None, moisture_var=None, component_vars=None, composition_units='%', components_as_symbols=True, ranges=None, config_file=None)[source]
- __init__(data=None, name=None, moisture_in_scope=True, mass_wet_var=None, mass_dry_var=None, moisture_var=None, component_vars=None, composition_units='%', components_as_symbols=True, ranges=None, config_file=None)[source]
- Parameters:
data (
Optional[DataFrame]) – The input dataname (
Optional[str]) – The name of the samplemoisture_in_scope (
bool) – Whether the moisture is in scope. If False, only dry mass is processed.mass_wet_var (
Optional[str]) – The name of the wet mass columnmass_dry_var (
Optional[str]) – The name of the dry mass columnmoisture_var (
Optional[str]) – The name of the moisture columncomponent_vars (
Optional[list[str]]) – The names of the chemical columnscomponents_as_symbols (
bool) – If True, convert the composition variables to symbols, e.g. Feranges (
Optional[dict[str,list]]) – The range of valid data for each column in the dataconfig_file (
Optional[Path]) – The configuration file
Methods
__init__([data, name, moisture_in_scope, ...])add(other[, name, include_supplementary_data])Add two objects together
balance_composition([epsilon])Balance the composition data
clip_composition([ranges, epsilon])Clip the components
clip_recovery(other[, recovery_bounds, ...])Clip the recovery to the specified bounds and recalculate the estimate.
common_block_size()compare(other[, comparisons, explicit_names])create_congruent_object(name[, ...])Create an object with the same attributes
create_structured_grid(imports)create_unstructured_grid(imports)Requires the index to be a pd.MultiIndex with names ['x', 'y', 'z', 'dx', 'dy', 'dz'].
create_voxels()div(other[, name, include_supplementary_data])Divide two objects
filter_by_index(index)Update the data by index
from_mass_dataframe(mass_df[, mass_wet, ...])Class method to create a MassComposition object from a mass dataframe.
from_omf(cls, omf_filepath, imports[, ...])Create a BlockModel from an OMF file.
get_blocks()get_mass_data([include_moisture])Get the mass data
Determine if the grid spacing is complete and regular If it is, a pv.StructuredGrid is suitable.
plot(scalar, imports[, show_edges])plot_comparison(other[, color, ...])Create an interactive parallel plot
plot_parallel([color, vars_include, ...])Create an interactive parallel plot
plot_ternary(variables[, color, title])Plot a ternary diagram
query(expr[, name])Reduce the data by a query expression
reset_index(index_name)set_moisture(moisture[, mass_to_adjust])Set the moisture to the specified value
split(fraction[, name_1, name_2, ...])Split the object by mass
sub(other[, name, include_supplementary_data])Subtract other from self
to_omf(omf_filepath, imports[, ...])Write the BlockModel to an OMF file.
to_stream()update_mass_data(value)voxelise(blocks, imports)weight_average([group_by])Attributes
aggregatecomposition_columnsdatadata_columnsmass_columnsmass_datamoisture_columnsupplementary_columnsvariable_mapA map from lower case standard names to the actual column names
- create_unstructured_grid(imports)[source]
Requires the index to be a pd.MultiIndex with names [‘x’, ‘y’, ‘z’, ‘dx’, ‘dy’, ‘dz’]. :rtype:
UnstructuredGrid:return:
- classmethod from_omf(cls, omf_filepath, imports, element_name=None, columns=None, query=None, density=2.5)[source]
Create a BlockModel from an OMF file.
- Parameters:
omf_filepath (
Path) – Path to the OMF file.imports – internally used to import the necessary packages.
element_name (
Optional[str]) – The name of the element in the OMF file.columns (
Optional[list[str]]) – The columns to extract from the OMF file.query (
Optional[str]) – The query to filter the DataFrame.density (
float) – The density of the material in g/cm3, used to calculate DMT (Dry Mass Tonnes). A workaround.
- Returns:
The BlockModel instance.
- Return type:
- is_regular()[source]
Determine if the grid spacing is complete and regular If it is, a pv.StructuredGrid is suitable. If not, a pv.UnstructuredGrid is suitable.
- Return type:
bool- Returns:
- to_omf(omf_filepath, imports, element_name='Block Model', description='A block model')[source]
Write the BlockModel to an OMF file.
- Parameters:
omf_filepath (
Path) – Path to the OMF file.imports – internally used to import the necessary packages.
element_name (
str) – The name of the element in the OMF file.description (
str) – Description of the block model.