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
(self)[source]¶ Makes this workspace the active one.
In case the workspace gets deleted, Workspace.active() safely returns None.
-
all_data
(self) → ”List[‘data.Data’]”[source]¶ Get all active Data entities registered in the workspace.
-
all_groups
(self) → ”List[‘group.Group’]”[source]¶ Get all active Group entities registered in the workspace.
-
all_objects
(self) → ”List[‘object_base.ObjectBase’]”[source]¶ Get all active Object entities registered in the workspace.
-
all_types
(self) → ”List[‘EntityType’]”[source]¶ Get all active entity types registered in the workspace.
-
property
attribute_map
¶ Mapping between names used in the geoh5 database.
-
property
contributors
¶ List of contributors name
-
copy_to_parent
(self, entity, parent, copy_children: ‘bool’ = True)[source]¶ Function to copy an entity to a different parent entity
- Parameters
entity – Entity to be copied
parent – Target parent to copy the entity under
copy_children – Copy all children of the entity
- Returns
Entity: Registered to the workspace.
-
classmethod
create
(entity: 'Entity', \*\*kwargs) → ’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
(self, entity_class, entity_kwargs, entity_type_kwargs) → ’Optional[Entity]’[source]¶ - Parameters
entity_class –
entity_kwargs –
entity_type_kwargs –
- Returns entity
-
create_entity
(entity_class, name, uuid.UUID, type_uuid)[source]¶ Function to create and register a new entity and its entity_type.
- Parameters
entity_class – Type of entity to be created
- Return entity
Newly created entity registered to the workspace
-
create_object_or_group
(self, entity_class, entity_kwargs, entity_type_kwargs) → ’Optional[Entity]’[source]¶ - Parameters
entity_class –
entity_kwargs –
entity_type_kwargs –
- Return entity
-
property
distance_unit
¶ Distance unit used in the project
-
fetch_cells
(self, uid: ‘uuid.UUID’) → ’Cell’[source]¶ Fetch the cells of an object from the source h5file
- Parameters
uid – Unique identifier of target entity
- Return cells
Cell object with vertices index
-
fetch_children
(self, entity: ‘Entity’, recursively: ‘bool’ = False)[source]¶ Recover and register children entities from the h5file
- Parameters
entity – Parental entity
recursively – Recover all children down the project tree
-
fetch_delimiters
(self, uid: ‘uuid.UUID’) → ’Tuple[np.ndarray, np.ndarray, np.ndarray]’[source]¶ Fetch the delimiter attributes from the source h5file
- Parameters
uid – Unique identifier of target data object
- Return (u_delimiters, v_delimiters, z_delimiters)
Arrays of delimiters along the u, v, and w axis
-
fetch_octree_cells
(self, uid: ‘uuid.UUID’) → ’np.ndarray’[source]¶ Fetch the octree cells ordering from the source h5file
- Parameters
uid – Unique identifier of target entity
- Return values
Array of [i, j, k, dimension] defining the octree mesh
-
fetch_property_groups
(self, uid: ‘uuid.UUID’) → ’List[PropertyGroup]’[source]¶ Fetch all property_groups on an object from the source h5file
- Parameters
uid – Unique identifier of target object
-
fetch_values
(self, uid: ‘uuid.UUID’) → ’Optional[float]’[source]¶ Fetch the data values from the source h5file
- Parameters
uid – Unique identifier of target data object
- Return value
Array of values
-
fetch_vertices
(self, uid: ‘uuid.UUID’) → ’np.ndarray’[source]¶ Fetch the vertices of an object from the source h5file
- Parameters
uid – Unique identifier of target entity
- Return coordinates
Array of coordinate [x, y, z] locations
-
finalize
(self)[source]¶ Finalize the h5file by checking for updated entities and re-building the Root
-
find_data
(self, data_uid: ‘uuid.UUID’) → ”Optional[‘data.Data’]”[source]¶ Find an existing and active Data entity
-
find_entity
(self, entity_uid: ‘uuid.UUID’) → ”Optional[‘Entity’]”[source]¶ Get all active entities registered in the workspace.
-
find_group
(self, group_uid: ‘uuid.UUID’) → ”Optional[‘group.Group’]”[source]¶ Find an existing and active Group object
-
find_object
(self, object_uid: ‘uuid.UUID’) → ”Optional[‘object_base.ObjectBase’]”[source]¶ Find an existing and active Object
-
find_type
(self, type_uid: ‘uuid.UUID’, type_class: “Type[‘EntityType’]”) → ”Optional[‘EntityType’]”[source]¶ Find an existing and active EntityType
- Parameters
type_uid – Unique identifier of target type
-
property
ga_version
¶ Version of Geoscience Analyst software
-
get_entity
(self, name: ‘Union[str, uuid.UUID]’) → ’List[Optional[Entity]]’[source]¶ Retrieve an entity from one of its identifier, either by name or uuid
- Parameters
name – Object identifier, either name or uuid.
- Returns
object_list: List of entities with the same given name
-
property
h5file
¶ Target geoh5 file name with path
-
property
list_data_name
¶ List all registered data with name
-
property
list_entities_name
¶ List all registered entities with name
-
property
list_groups_name
¶ List all registered groups with name
-
property
list_objects_name
¶ List all registered objects with name
-
property
modified_attributes
¶ Flag to update the workspace attributes on file
-
property
name
¶ Name of the project
-
property
root
¶ RootGroup entity with no parent
-
static
save_entity
(entity: ‘Entity’, close_file: ‘bool’ = True, add_children: ‘bool’ = True)[source]¶ Save or update an entity to geoh5
- Parameters
entity – Entity to be written to geoh5
close_file – Close the geoh5 database after writing is completed
add_children – Add children entities to geoh5
-
property
version
¶ Project version
-
property
workspace
¶ - Return self
The Workspace