geoh5py.shared package¶
Submodules¶
geoh5py.shared.coord3d module¶
geoh5py.shared.date_time module¶
geoh5py.shared.distance_unit module¶
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_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¶
- 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 workspaceh5file
.
- property name: str¶
str
Name of the entity
- property parent¶
- property public: bool¶
bool
Entity is accessible in the workspace tree and other partsof 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 inuuid4()
format.
- property visible: bool¶
bool
Entity visible in camera (checked in ANALYST object tree).
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.
- 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 workspaceh5file
.
- property name: str | None¶
- property uid: uuid.UUID¶
uuid.UUID
The unique identifier of an entity, either as stored in geoh5 or generated inuuid4()
format.
geoh5py.shared.file_name module¶
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¶
geoh5py.shared.version_string module¶
geoh5py.shared.vertex_index module¶
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 asome_dict
ofweakref
values. In casekey
points to a reference to a deleted value, remove that key fromsome_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