Classification¶
ela.classification module¶
-
class
ela.classification.ClassMapper(mapping, lithology_names)¶ Bases:
objectHold information about and perform lithology and hydraulic conductivity classification
-
lithology_names¶ Name of the lithologies
- Type
iterable of str
-
mapping¶ dictionary where keys are primary+secondary lithologies (‘sand/clay’) and values are numeric codes for e.g. hydraulic conductivities
- Type
dict
-
litho_numeric_mapper¶ numeric mapper from primary+secondary lithologies to hydraulic conductivities
- Type
np array
-
bivariate_mapper(primary_litho_code, secondary_litho_code)¶ Get the mapping class code (e.g. hydraulic conductivity) for a set of primary+secondary lithologies
- Parameters
primary_litho_class (float) – primary lithology numeric (lithology class) identifier
secondary_litho_class (float) – primary lithology numeric (lithology class) identifier
- Returns
numeric, numeric code of the mapped class for this primary+secondary lithologies
-
class_code(primary_litho_class, secondary_litho_class)¶ Get the mapping class code (e.g. hydraulic condouctivity) for a set of primary+secondary lithologies
- Parameters
primary_litho_class (str, float or int) – primary lithology name or numeric (lithology class) identifier
secondary_litho_class (str, float or int) – primary lithology name or numeric (lithology class) identifier
- Returns
numeric, numeric code of the mapped class for this primary+secondary lithologies
-
static
create_full_litho_desc(df)¶ Create strings identifying primary+secondary lithologies, used as keys in classification operations
- Parameters
df (pandas data frame) – bore lithology data with columns named PRIMARY_LITHO_COL and SECONDARY_LITHO_COL
- Returns
a list of strings, compound primary+optional_secondary lithology descriptions e.g. ‘sand/clay’, ‘loam/’
-
data_frame_frequencies(freq_table)¶ Get the frequencies of primary+secondary as a data frame, typically from the output of get_frequencies
- Parameters
freq_table (np.array of dim 2) – counts of primary/secondary lithology occurrences.
- Returns
counts of primary/secondary lithology occurrences.
- Return type
(pandas data frame)
-
get_frequencies(mask_2d, primary_lithology_3d_array, secondary_lithology_3d_array)¶ Get the frequencies of primary+secondary for a set of x/y coordinates and all Z values in 3d lithologies
- Parameters
mask_2d (np.array of dim 2) – mask to apply to the x-y dimensions of the other arguments
primary_lithology_3d_array (np.array of dim 3) – primary lithology numeric (lithology class) identifiers
secondary_lithology_3d_array (np.array of dim 3) – primary lithology numeric (lithology class) identifiers
- Returns
counts of primary/secondary lithology occurrences.
- Return type
(np.array of dim 2)
-
litho_class_label(primary_litho_class, secondary_litho_class)¶ Get the string identifier for a set of primary+secondary lithologies
- Parameters
primary_litho_class (str, float or int) – primary lithology name or numeric (lithology class) identifier
secondary_litho_class (str, float or int) – primary lithology name or numeric (lithology class) identifier
- Returns
string, lithologies key such as ‘sand/clay’
-
map_classes(primary_lithology_3d_array, secondary_lithology_3d_array)¶ (compute intensive) Get the mapping class codes (e.g. hydraulic conductivity) for grids of primary+secondary lithologies
- Parameters
primary_lithology_3d_array (np.array of dim 3) – primary lithology numeric (lithology class) identifiers
secondary_lithology_3d_array (np.array of dim 3) – primary lithology numeric (lithology class) identifiers
- Returns
mapped numeric identifiers, e.g. as of hydraulic conductivities
- Return type
(np.array of dim 3)
-
numeric_for_litho_classes(litho_classes)¶ Get the numeric class for primary+secondary lithologies
- Parameters
litho_classes (iterable of str) – one or more strings e.g. ‘sand/clay’
- Returns
list of numeric codes
-
-
ela.classification.create_numeric_classes(lithologies)¶ Creates a dictionary mapping lithologies to numeric code
- Parameters
lithologies (iterable of str) – Name of the lithologies
-
ela.classification.extract_single_lithology_class_3d(lithology_3d_classes, class_value)¶ Transform a 3D volume of lithology class codes by binary bining cells as being either of a class value or other. Preprocessing primarily for 3D visualisation for Mayavi.
- Parameters
lithology_3d_classes (np.array of dim 3) – lithology numeric (lithology class) identifiers
class_value (float) – class code of interest
-
ela.classification.to_litho_class_num(lithology, kv)¶ Get a numeric code for a lithology, or NaN if not in the dictionary mapping lithologies to numeric code
- Parameters
lithology (str) – Name of the lithology
kv (dict[str,float]) – lithologies keywords to numeric code
-
ela.classification.v_to_litho_class_num(lithologies, kv)¶ Get numeric codes for lithologies, or NaN if not in the dictionary mapping lithologies to numeric code
- Parameters
lithologies (iterable of str) – Name of the lithologies
kv (dict[str,float]) – lithologies keywords to numeric code