geoh5py.workspace package¶
Submodules¶
geoh5py.workspace.workspace module¶
- class geoh5py.workspace.workspace.Workspace(h5file: str = 'Analyst.geoh5', **kwargs)[source]¶
Bases:
object
The Workspace class manages all Entities created or imported from the geoh5 structure.
The basic requirements needed to create a Workspace are:
- Parameters
h5file – File name of the target geoh5 file. A new project is created if the target file cannot by found on disk.
- activate()[source]¶
Makes this workspace the active one.
In case the workspace gets deleted, Workspace.active() safely returns None.
- static active() geoh5py.workspace.workspace.Workspace [source]¶
Get the active workspace.
- property attribute_map: dict¶
Mapping between names used in the geoh5 database.
- property contributors: numpy.ndarray¶
numpy.array
ofstr
List of contributors name.
- copy_to_parent(entity, parent, copy_children: bool = True, omit_list: tuple = ())[source]¶
Copy an entity to a different parent with copies of children.
- Parameters
entity – Entity to be copied.
parent – Target parent to copy the entity under.
copy_children – Copy all children of the entity.
omit_list – List of property names to omit on copy
- Returns
The Entity registered to the workspace.
- classmethod create(entity: geoh5py.shared.entity.Entity, **kwargs) geoh5py.shared.entity.Entity [source]¶
Create and register a new Entity.
- Parameters
entity – Entity to be created
kwargs – List of attributes to set on new entity
- Return entity
The new entity
- create_data(entity_class, entity_kwargs: dict, entity_type_kwargs: dict | DataType) Entity | None [source]¶
Create a new Data entity with attributes.
- Parameters
entity_class –
Data
class.entity_kwargs – Properties of the entity.
entity_type_kwargs – Properties of the entity_type.
- Returns
The newly created entity.
- create_entity(entity_class, save_on_creation: bool = True, file: str | h5py.File | None = None, **kwargs) Entity | None [source]¶
Function to create and register a new entity and its entity_type.
- Parameters
entity_class – Type of entity to be created
save_on_creation – Save the entity to h5file immediately
file –
h5py.File
or name of the target geoh5 file
- Return entity
Newly created entity registered to the workspace
- create_object_or_group(entity_class, entity_kwargs: dict, entity_type_kwargs: dict) Entity | None [source]¶
Create an object or a group with attributes.
- Parameters
entity_class –
ObjectBase
orGroup
class.entity_kwargs – Attributes of the entity.
entity_type_kwargs – Attributes of the entity_type.
- Returns
A new Object or Group.
- property distance_unit: str¶
str
Distance unit used in the project.
- fetch_cells(uid: uuid.UUID, file: str | h5py.File | None = None) np.ndarray [source]¶
Fetch the cells of an object from the source h5file.
- Parameters
uid – Unique identifier of target entity.
file –
h5py.File
or name of the target geoh5 file
- Returns
Cell object with vertices index.
- fetch_children(entity: Entity, recursively: bool = False, file: str | h5py.File | None = None)[source]¶
Recover and register children entities from the h5file
- Parameters
entity – Parental entity
recursively – Recover all children down the project tree
file –
h5py.File
or name of the target geoh5 file
- fetch_coordinates(uid: uuid.UUID, name: str, file: str | h5py.File | None = None) np.ndarray [source]¶
Fetch the survey values of drillhole objects
- Parameters
uid – Unique identifier of target entity
file –
h5py.File
or name of the target geoh5 file
- Return values
Array of [Depth, Dip, Azimuth] defining the drillhole path.
- fetch_delimiters(uid: uuid.UUID, file: str | h5py.File | None = None) tuple[np.ndarray, np.ndarray, np.ndarray] [source]¶
Fetch the delimiter attributes from the source h5file.
- Parameters
uid – Unique identifier of target data object.
file –
h5py.File
or name of the target geoh5 file
- Returns
Arrays of delimiters along the u, v, and w axis (u_delimiters, v_delimiters, z_delimiters).
- fetch_metadata(uid: uuid.UUID, file: str | h5py.File | None = None)[source]¶
Fetch the metadata of an entity from the source h5file.
- Returns
- fetch_octree_cells(uid: uuid.UUID, file: str | h5py.File | None = None) np.ndarray [source]¶
Fetch the octree cells ordering from the source h5file
- Parameters
uid – Unique identifier of target entity
file –
h5py.File
or name of the target geoh5 file
- Return values
Array of [i, j, k, dimension] defining the octree mesh
- fetch_property_groups(entity: Entity, file: str | h5py.File | None = None) list[PropertyGroup] [source]¶
Fetch all property_groups on an object from the source h5file
- Parameters
entity – Target object
file –
h5py.File
or name of the target geoh5 file
- fetch_trace_depth(uid: uuid.UUID, file: str | h5py.File | None = None) np.ndarray [source]¶
Fetch the trace depth information of a drillhole objects
- Parameters
uid – Unique identifier of target entity
file –
h5py.File
or name of the target geoh5 file
- Returns
Array of trace depth values.
- fetch_values(uid: uuid.UUID, file: str | h5py.File | None = None) float | None [source]¶
Fetch the data values from the source h5file.
- Parameters
uid – Unique identifier of target data object.
file –
h5py.File
or name of the target geoh5 file
- Returns
Array of values.
- finalize(file: str | h5py.File | None = None)[source]¶
Finalize the h5file by checking for updated entities and re-building the Root
- Parameters
file –
h5py.File
or name of the target geoh5 file
- find_entity(entity_uid: uuid.UUID) Entity | None [source]¶
Get all active entities registered in the workspace.
- find_group(group_uid: uuid.UUID) group.Group | None [source]¶
Find an existing and active Group object.
- find_object(object_uid: uuid.UUID) object_base.ObjectBase | None [source]¶
Find an existing and active Object.
- find_type(type_uid: uuid.UUID, type_class: type[EntityType]) EntityType | None [source]¶
Find an existing and active EntityType
- Parameters
type_uid – Unique identifier of target type
- property ga_version: str¶
str
Version of Geoscience Analyst software.
- get_entity(name: str | uuid.UUID) list[Entity | None] [source]¶
Retrieve an entity from one of its identifier, either by name or
uuid.UUID
.- Parameters
name – Object identifier, either name or uuid.
- Returns
List of entities with the same given name.
- property groups: list[groups.Group]¶
Get all active Group entities registered in the workspace.
- property h5file: str¶
- Str
Target geoh5 file name with path.
- property list_data_name: dict[uuid.UUID, str]¶
dict
ofuuid.UUID
keys and name values for all registered Data.
- property list_entities_name: dict[uuid.UUID, str]¶
- Returns
dict
ofuuid.UUID
keys and name values for all registered Entities.
- property list_groups_name: dict[uuid.UUID, str]¶
dict
ofuuid.UUID
keys and name values for all registered Groups.
- property list_objects_name: dict[uuid.UUID, str]¶
dict
ofuuid.UUID
keys and name values for all registered Objects.
- load_entity(uid: uuid.UUID, entity_type: str, parent: Entity = None, file: str | h5py.File | None = None) Entity | None [source]¶
Recover an entity from geoh5.
- Parameters
uid – Unique identifier of entity
entity_type – One of entity type ‘group’, ‘object’, ‘data’ or ‘root’
file –
h5py.File
or name of the target geoh5 file
- Return entity
Entity loaded from geoh5
- property name: str¶
str
Name of the project.
- property objects: list[objects.ObjectBase]¶
Get all active Object entities registered in the workspace.
- remove_children(parent, children: list, file: str | h5py.File | None = None)[source]¶
Remove a list of entities from a parent.
- remove_entity(entity: Entity, file: str | h5py.File | None = None)[source]¶
Function to remove an entity and its children from the workspace
- remove_none_referents(referents: dict[uuid.UUID, ReferenceType], rtype: str, file: str | h5py.File | None = None)[source]¶
Search and remove deleted entities
- remove_recursively(entity: Entity, file: str | h5py.File | None = None)[source]¶
Delete an entity and its children from the workspace and geoh5 recursively
- save_entity(entity: Entity, add_children: bool = True, file: str | h5py.File | None = None)[source]¶
Save or update an entity to geoh5.
- Parameters
entity – Entity to be written to geoh5.
add_children – Add children entities to geoh5.
file –
h5py.File
or name of the target geoh5
- property types: list[EntityType]¶
Get all active entity types registered in the workspace.
- property version: float¶
float
Version of the geoh5 file format.
- property workspace¶
This workspace instance itself.
- geoh5py.workspace.workspace.active_workspace(workspace: geoh5py.workspace.workspace.Workspace)[source]¶