geoh5py.shared.concatenation package

Submodules

geoh5py.shared.concatenation.concatenated module

class geoh5py.shared.concatenation.concatenated.Concatenated(*args, **kwargs)[source]

Bases: object

Base class modifier for concatenated objects and data.

property concat_attr_str: str

String identifier for the concatenated attributes.

property concatenator: Concatenator

Parental Concatenator entity.

geoh5py.shared.concatenation.concatenator module

class geoh5py.shared.concatenation.concatenator.Concatenator(**kwargs)[source]

Bases: Group

Class modifier for concatenation of objects and data.

add_children(children: list[ConcatenatedObject] | list[Entity]) None[source]
Parameters:

children – Add a list of entities as children

add_save_concatenated(child) None[source]

Add or save a concatenated entity.

Parameters:

child – Concatenated entity

property attributes_keys: list | None

List of uuids present in the concatenated attributes.

property concat_attr_str: str

String identifier for the concatenated attributes.

property concatenated_attributes: dict | None

Dictionary of concatenated objects and data attributes.

property concatenated_object_ids: list[bytes] | None

Dictionary of concatenated objects and data concatenated_object_ids.

copy(parent=None, copy_children: bool = True, clear_cache: bool = False, mask: ndarray | None = None, **kwargs)[source]

Function to copy an entity to a different parent entity.

Parameters:
  • parent – Target parent to copy the entity under. Copied to current parent if None.

  • copy_children – Create copies of all children entities along with it.

  • mask – Array of indices to sub-sample the input entity.

  • clear_cache – Clear array attributes after copy.

Return entity:

Registered Entity to the workspace.

property data: dict

Concatenated data values stored as a dictionary.

delete_index_data(label: str, index: int) None[source]
property drillholes_table_from_data_name: dict | dict[str, DrillholesGroupTable]

Dictionary of the drillholes tables from data name as keys

property drillholes_tables: dict

Dictionary of drillholes tables. Always recompute the drillholes tables to ensure changes.

fetch_concatenated_data_index()[source]

Extract concatenation arrays.

fetch_concatenated_objects() dict[source]

Load all concatenated children.

fetch_index(entity: ConcatenatedObject | ConcatenatedData | EntityType, field: str) int | None[source]

Fetch the array index for specific concatenated object and data field.

Parameters:
  • entity – Parent entity with data

  • field – Name of the target data.

fetch_start_index(entity: ConcatenatedObject | ConcatenatedData, label: str) int[source]

Fetch starting index for a given entity and label. Existing date is removed such that new entries can be appended.

Parameters:
  • entity – Concatenated entity to be added.

  • label – Name of the attribute requiring an update.

fetch_values(entity: ConcatenatedObject | ConcatenatedData | EntityType, field: str) ndarray | None[source]

Get an array of values from concatenated data.

Parameters:
  • entity – Parent entity with data

  • field – Name of the target data.

get_concatenated_attributes(uid: bytes | str | UUID) dict[source]

Fast reference index to concatenated attribute keys.

property index: dict

Concatenated index stored as a dictionary.

property property_group_ids: list | None

Dictionary of concatenated objects and data property_group_ids.

remove_children(children: list | Concatenated)[source]

Remove children from object.

This method calls the ObjectBase parent class to remove children from the object children, but also deletes the children from the workspace.

Parameters:

children – List of children to remove.

remove_entity(entity: ConcatenatedObject | ConcatenatedData | ConcatenatedPropertyGroup)[source]

Remove a concatenated entity.

save_attribute(field: str)[source]

Save a concatenated attribute.

Parameters:

field – Name of the attribute

update_array_attribute(entity: ConcatenatedObject | ConcatenatedData, field: str, remove=False) None[source]

Update values stored as data.

Row data and indices are first removed then appended.

Parameters:
  • entity – Concatenated entity with array values.

  • field – Name of the valued field.

  • remove – Remove the data from the concatenated array.

update_attributes(entity: ConcatenatedObject | ConcatenatedData, label: str) None[source]

Update a concatenated entity.

update_concatenated_attributes(entity: ConcatenatedObject | ConcatenatedData) None[source]

Update the concatenated attributes. :param entity: Concatenated entity with attributes.

update_data_index()[source]

Update the concatenated data and index of the concatenator

geoh5py.shared.concatenation.data module

class geoh5py.shared.concatenation.data.ConcatenatedData(**kwargs)[source]

Bases: Concatenated, Data

property n_values: int | None

Number of values in the data.

property parent: ConcatenatedObject
property property_group: ConcatenatedPropertyGroup | None

Get the property group containing the data interval.

geoh5py.shared.concatenation.drillhole module

class geoh5py.shared.concatenation.drillhole.ConcatenatedDrillhole(**kwargs)[source]

Bases: ConcatenatedObject, Drillhole

property depth_: list[Data]
format_survey_values(values: list | ndarray) recarray[source]

Reformat the survey values as structured array with the right shape.

property from_: list[Data]

Depth data corresponding to the tops of the interval values.

post_processing()[source]

Bypass sort_depths from previous version.

property to_: list[Data]

Depth data corresponding to the bottoms of the interval values.

validate_association(attributes: dict, property_group=None, collocation_distance=None, **_) tuple[source]

Validate input drillhole data attributes.

Parameters:
  • attributes – Dictionary of data attributes.

  • property_group – Input property group to validate against.

  • collocation_distance – Threshold on the comparison between existing depth values.

validate_depth_data(depth: list | ndarray | None, values: ndarray, collocation_distance: float | None = None, property_group: str | ConcatenatedPropertyGroup | None = None) ConcatenatedPropertyGroup[source]

Compare new and current depth values and reuse the property group if possible.

Parameters:
  • depth – Sampling depths.

  • values – Data samples to depths.

  • collocation_distance – Threshold on the comparison between existing depth values.

  • property_group – Group for possibly collocated data.

Returns:

Augmented property group with name/values added for collocated data otherwise newly created property group with name/depth/values added.

validate_interval_data(from_to: list | ndarray | None, values: ndarray, collocation_distance=0.0001, property_group: str | ConcatenatedPropertyGroup | None = None) ConcatenatedPropertyGroup[source]

Compare new and current depth values and reuse the property group if possible. Otherwise a new property group is added.

Parameters:
  • from_to – Array of from-to values.

  • values – Data values to be added on the from-to intervals.

  • collocation_distance – Threshold on the comparison between existing depth values.

  • property_group – Property group name.

:return A ConcatenatedPropertyGroup with the matched values.

geoh5py.shared.concatenation.drillholes_group_table module

class geoh5py.shared.concatenation.drillholes_group_table.DrillholesGroupTable(parent: Concatenator, name: str)[source]

Bases: ABC

A class to store the information of a PropertyGroup.

Parameters:
  • parent – The parent DrillholesConcatenator.

  • name – The name of the PropertyGroup to extract.

add_values_to_property_group(name: str, values: ndarray, data_type: DataType | None = None)[source]

Push the values to each drillhole of the property group based on association.

Parameters:
  • name – The name of the data to push.

  • values – The values to push.

  • data_type – The data type associated to description; useful especially for referenced data.

property association: tuple

The depth association of the PropertyGroup.

property depth_table: ndarray

Get a table with all the data associated with depth for every drillhole object.

The Drillhole name is added at the beginning of the table for every row. The table is based on the association and contains nan values if no data is found.

Returns:

a structured array with all the data.

depth_table_by_name(names: tuple[str] | str, spatial_index: bool = False) ndarray[source]

Get a table with specific data associated with depth for every drillhole object.

Parameters:
  • names – The names to extract.

  • spatial_index – If True, the spatial index is added to the table.

Returns:

a table containing the Drillholes, the association and the data.

property index_by_drillhole: dict[bytes, dict[str, list[int]]]

Get for every object index and count of all the data in ‘association’ and ‘properties’

Returns:

A dictionary with the object uuid and the index of all the data.

property name: str

The name of the PropertyGroup.

nan_value_from_name(name: str) Any[source]

Get the nan value of a data from the name.

Parameters:

name – The name of the data to get.

Returns:

The nan value.

property parent: Concatenator

The parent Concatenator object.

property properties: tuple

The names of the associated data.

property properties_type: tuple

The dtype of the associated data.

They are ordered in the same way as the properties.

property property_group_type: str

The type of the PropertyGroup.

property property_groups: dict[UUID, ConcatenatedPropertyGroup]

Get all the property groups in the concatenator.

Returns:

A list containing all the property groups.

geoh5py.shared.concatenation.object module

class geoh5py.shared.concatenation.object.ConcatenatedObject(**kwargs)[source]

Bases: Concatenated, ObjectBase

create_property_group(name=None, property_group_type: GroupTypeEnum | str = GroupTypeEnum.INTERVAL, **kwargs) ConcatenatedPropertyGroup[source]

Create a new PropertyGroup.

Parameters:
  • name – Name of the property group.

  • property_group_type – Type of property group.

  • kwargs – Any arguments taken by the PropertyGroup class.

Returns:

A new PropertyGroup

get_data_list(attribute='name')[source]

Lazy loading of data names from concatenated attributes.

get_entity(name: str | uuid.UUID) list[Entity | None][source]

Get a child Data by name.

Parameters:
  • name – Name of the target child data

  • entity_type – Sub-select entities based on type.

Returns:

A list of children Data objects

property parent: Concatenator
property property_groups: list | None

List of the property groups associated with the object.

remove_children(children: list | Concatenated | ConcatenatedPropertyGroup)[source]

Remove children from object.

This method calls the ObjectBase parent class to remove children from the object children, but also deletes the children from the workspace.

Parameters:

children – List of children to remove.

geoh5py.shared.concatenation.property_group module

class geoh5py.shared.concatenation.property_group.ConcatenatedPropertyGroup(parent: ConcatenatedObject, **kwargs)[source]

Bases: PropertyGroup

property concatenator: Concatenator

Parental Concatenator entity.

property depth_
property from_

Return the data entities defined the ‘from’ depth intervals.

is_collocated(locations: ndarray, collocation_distance: float) bool[source]

True if locations are collocated with property group.

Parameters:
  • locations – Locations to check.

  • collocation_distance – tolerance for similarity check.

property locations: ndarray

Return depths or intervals array if either exists else None.

property parent: ConcatenatedObject

The parent of the PropertyGroup.

remove_properties(data: str | Data | list[str | Data | UUID] | UUID)[source]

Remove data from the properties.

The property group is removed if only the depth or from/to data are left.

property to_

Return the data entities defined the ‘to’ depth intervals.

Module contents