geoh5py.shared package

Submodules

geoh5py.shared.coord3d module

class geoh5py.shared.coord3d.Coord3D(xyz: numpy.ndarray = array([[0.0, 4.67854142e-310, 0.0]]))[source]

Bases: object

Coordinate of vertices.

Warning

Replaced by numpy.array

property locations: numpy.ndarray
property x: float
property y: float
property z: float

geoh5py.shared.date_time module

class geoh5py.shared.date_time.DateTime[source]

Bases: object

Time stamp

Warning

Not implemented

geoh5py.shared.distance_unit module

class geoh5py.shared.distance_unit.DistanceUnit[source]

Bases: object

Units

Warning

Not implemented

geoh5py.shared.entity module

class geoh5py.shared.entity.Entity(**kwargs)[source]

Bases: abc.ABC

Base Entity class

add_children(children: list[shared.Entity])[source]
Parameters

children – Add a list of entities as children

property allow_delete: bool

bool Entity can be deleted from the workspace.

property allow_move: bool

bool Entity can change parent

property allow_rename: bool

bool Entity can change name

property attribute_map: dict

dict Correspondence map between property names used in geoh5py and geoh5.

property children

list Children entities in the workspace tree

copy(parent=None, copy_children: bool = True)[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.

Return entity

Registered Entity to the workspace.

classmethod create(workspace, **kwargs)[source]

Function to create an entity.

Parameters
  • workspace – Workspace to be added to.

  • kwargs – List of keyword arguments defining the properties of a class.

Return entity

Registered Entity to the workspace.

abstract property entity_type: shared.EntityType
property existing_h5_entity: bool

bool Entity already present in h5file.

classmethod fix_up_name(name: str) str[source]

If the given name is not a valid one, transforms it to make it valid :return: a valid name built from the given name. It simply returns the given name if it was already valid.

property metadata: str | dict | None

Metadata attached to the entity.

property modified_attributes

list[str] List of attributes to be updated in associated workspace h5file.

property name: str

str Name of the entity

property parent
property public: bool
bool Entity is accessible in the workspace tree and other parts

of the the user interface in ANALYST.

reference_to_uid(value: Entity | str | uuid.UUID) list[uuid.UUID][source]

General entity reference translation.

Parameters

value – Either an Entity, string or uuid

Returns

List of unique identifier associated with the input reference.

remove_children(children: list[shared.Entity])[source]

Remove children from the list of children entities.

Parameters

children – List of entities

Warning

Removing a child entity without re-assigning it to a different parent may cause it to become inactive. Inactive entities are removed from the workspace by remove_none_referents().

property uid

uuid.UUID The unique identifier of an entity, either as stored in geoh5 or generated in uuid4() format.

property visible: bool

bool Entity visible in camera (checked in ANALYST object tree).

property workspace

Workspace to which the Entity belongs to.

geoh5py.shared.entity_type module

class geoh5py.shared.entity_type.EntityType(workspace: ws.Workspace, **kwargs)[source]

Bases: abc.ABC

property attribute_map

dict Correspondence map between property names used in geoh5py and geoh5.

property description

str Entity type description.

property existing_h5_entity: bool

bool Entity already present in h5file.

classmethod find(workspace: ws.Workspace, type_uid: uuid.UUID) TEntityType | None[source]

Finds in the given Workspace the EntityType with the given UUID for this specific EntityType implementation class.

Returns

EntityType of None

property modified_attributes

list[str] List of attributes to be updated in associated workspace h5file.

property name: str | None
property uid: uuid.UUID

uuid.UUID The unique identifier of an entity, either as stored in geoh5 or generated in uuid4() format.

property workspace: ws.Workspace

Workspace registering this type.

geoh5py.shared.file_name module

class geoh5py.shared.file_name.FileName[source]

Bases: object

File name

Warning

Not implemented

geoh5py.shared.utils module

geoh5py.shared.utils.compare_entities(object_a, object_b, ignore: list | None = None, decimal: int = 6)[source]
geoh5py.shared.utils.fetch_h5_handle(file: str | h5py.File) h5py.File[source]

Open in read+ mode a geoh5 file from string. If receiving a file instead of a string, merely return the given file.

Parameters

file – Name or handle to a geoh5 file.

Return h5py.File

Handle to an opened h5py file.

geoh5py.shared.utils.match_values(vec_a, vec_b, collocation_distance=0.0001)[source]

Find indices of matching values between two arrays, within collocation_distance.

Param

vec_a, list or numpy.ndarray Input sorted values

Param

vec_b, list or numpy.ndarray Query values

Returns

indices, numpy.ndarray Pairs of indices for matching values between the two arrays such that vec_a[ind[:, 0]] == vec_b[ind[:, 1]].

geoh5py.shared.utils.merge_arrays(head, tail, replace='A->B', mapping=None, collocation_distance=0.0001, return_mapping=False)[source]

Given two numpy.arrays of different length, find the matching values and append both arrays.

Param

head, numpy.array of float First vector of shape(M,) to be appended.

Param

tail, numpy.array of float Second vector of shape(N,) to be appended

Param

mapping=None, numpy.ndarray of int Optional array where values from the head are replaced by the tail.

Param

collocation_distance=1e-4, float Tolerance between matching values.

Returns

numpy.array shape(O,) Unique values from head to tail without repeats, within collocation_distance.

geoh5py.shared.version_number module

class geoh5py.shared.version_number.VersionNumber(number: float)[source]

Bases: object

Version

Warning

Not implemented

property value: float

geoh5py.shared.version_string module

class geoh5py.shared.version_string.VersionString(value: str)[source]

Bases: object

Version of Geoscience ANALYST

Warning

Not implemented

property value: str

geoh5py.shared.vertex_index module

class geoh5py.shared.vertex_index.VertexIndex[source]

Bases: object

Indices

Warning

Not implemented

geoh5py.shared.weakref_utils module

geoh5py.shared.weakref_utils.get_clean_ref(some_dict: dict[K, ReferenceType[T]], key: K) T | None[source]

Gets the referent value for the given key in a some_dict of weakref values. In case key points to a reference to a deleted value, remove that key from some_dict on the fly, and returns None.

Parameters
  • some_dict – The dictionary of weakref values.

  • key – The key

Returns

the referent value for key if found in the the dictionary, else None.

geoh5py.shared.weakref_utils.insert_once(some_dict: dict[K, ReferenceType], key: K, value)[source]

Check if the reference to an Entity with uuid is already in use.

Parameters
  • some_dict – Dictionary of UUID keys and weakref values.

  • key – UUID key to be checked.

  • value – Entity to be checked

Returns

Dictionary with clean weakref

geoh5py.shared.weakref_utils.remove_none_referents(some_dict: dict[K, ReferenceType])[source]

Removes any key from the given some_dict where the value is a reference to a deleted value (that is where referent of the weakref value is None).

Parameters

some_dict – The dictionary to be cleaned up.

Module contents