geoh5py.objects package¶
Subpackages¶
- geoh5py.objects.surveys package
- Subpackages
- geoh5py.objects.surveys.electromagnetics package
- Submodules
- geoh5py.objects.surveys.electromagnetics.airborne_fem module
- geoh5py.objects.surveys.electromagnetics.airborne_tem module
- geoh5py.objects.surveys.electromagnetics.base module
- geoh5py.objects.surveys.electromagnetics.ground_fem module
- geoh5py.objects.surveys.electromagnetics.ground_tem module
- geoh5py.objects.surveys.electromagnetics.magnetotellurics module
- geoh5py.objects.surveys.electromagnetics.tipper module
- Module contents
- geoh5py.objects.surveys.electromagnetics package
- Submodules
- geoh5py.objects.surveys.direct_current module
- geoh5py.objects.surveys.magnetics module
- Module contents
- Subpackages
Submodules¶
geoh5py.objects.block_model module¶
- class geoh5py.objects.block_model.BlockModel(u_cell_delimiters: ndarray = array([0., 1.]), v_cell_delimiters: ndarray = array([0., 1.]), z_cell_delimiters: ndarray = array([0., 1.]), **kwargs)[source]¶
Bases:
GridObject
Rectilinear 3D tensor mesh defined by three perpendicular axes.
Each axis is divided into discrete intervals that define the cell dimensions. Nodal coordinates are determined relative to the origin and the sign of cell delimiters. Negative and positive cell delimiters are accepted to denote relative offsets from the origin.
- Parameters:
object_type – Type of object registered in the workspace.
u_cell_delimiters – Nodal offsets along the u-axis relative to the origin.
v_cell_delimiters – Nodal offsets along the v-axis relative to the origin.
z_cell_delimiters – Nodal offsets along the z-axis relative to the origin.
kwargs – Additional attributes defined by the
GridObject
class.
- property cell_delimiters: list[ndarray]¶
List of cell delimiters along the u, v and z-axis.
- property centroids: ndarray¶
Cell center locations in world coordinates of shape (n_cells, 3).
centroids = [ [x_1, y_1, z_1], ..., [x_N, y_N, z_N] ]
- local_axis_centers(axis: str) ndarray [source]¶
Get the local axis centers for the block model.
- Parameters:
axis – Axis to get the centers for.
- property shape: tuple[int, int, int]¶
Number of cells along the u, v and z-axis
- property u_cell_delimiters: ndarray¶
Nodal offsets along the u-axis relative to the origin.
- property u_cells: ndarray¶
Cell size along the u-axis.
- property v_cell_delimiters: ndarray¶
Nodal offsets along the v-axis relative to the origin.
- property v_cells: ndarray¶
Cell size along the v-axis.
- static validate_cell_delimiters(value: ndarray, axis: str) ndarray [source]¶
Validate the cell delimiters for the block model.
- Parameters:
value – Cell delimiters along the axis.
axis – Axis to validate the cell delimiters for.
- property z_cell_delimiters: ndarray¶
Nodal offsets along the u-axis relative to the origin.
- property z_cells: ndarray¶
Cell size along the z-axis
geoh5py.objects.cell_object module¶
- class geoh5py.objects.cell_object.CellObject(cells: ndarray | list | tuple | None = None, **kwargs)[source]¶
Bases:
Points
,ABC
Base class for object with cells.
- Parameters:
cells – Array of indices defining connecting vertices.
- property cells: ndarray¶
Array of indices defining connecting vertices.
- property centroids: ndarray | None¶
Compute the centroids of the cells.
- copy(parent=None, *, copy_children: bool = True, clear_cache: bool = False, mask: ndarray | None = None, cell_mask: ndarray | None = None, **kwargs)[source]¶
Sub-class extension of
copy()
.- Additions:
cell_mask: Array of indices to sub-sample the input entity cells.
- property locations¶
Exposes the vertices or centroids of the object.
- mask_by_extent(extent: ndarray, inverse: bool = False) ndarray | None [source]¶
Extension of
mask_by_extent()
.
- property n_cells: int¶
Number of vertices
- remove_cells(indices: list[int] | ndarray, clear_cache: bool = False)[source]¶
Safely remove cells and corresponding data entries.
- Parameters:
indices – Indices of cells to be removed.
clear_cache – Clear cache of data values.
- remove_vertices(indices: list[int] | ndarray, clear_cache: bool = False)[source]¶
Safely remove vertices and cells and corresponding data entries.
- Parameters:
indices – Indices of vertices to be removed.
clear_cache – Clear cache of data values.
- abstract validate_cells(indices: list | tuple | ndarray | None) ndarray [source]¶
Validate or generate cells defining the connection between vertices.
- Parameters:
indices – Array of indices. If None provided, the vertices are connected sequentially.
- Returns:
Array of indices defining connected vertices.
geoh5py.objects.curve module¶
- class geoh5py.objects.curve.Curve(current_line_id: UUID | None = None, parts: ndarray | None = None, vertices: ndarray | list | tuple | None = None, **kwargs)[source]¶
Bases:
CellObject
Curve object defined by a series of line segments (
cells
) connectingvertices
.- Parameters:
current_line_id – Unique identifier of the current line.
parts – Group identifiers for vertices connected by line segments as defined by the
cells
property.vertices – Array of vertices as defined by
vertices
.
- property current_line_id: UUID | None¶
Unique identifier of the current line.
- property parts: ndarray¶
Group identifiers for vertices connected by line segments as defined by the
cells
property. The definition of thecells
property get modified by the setting of parts.
- remove_vertices(indices: list[int] | ndarray, clear_cache: bool = False)[source]¶
Safely remove vertices and cells and corresponding data entries.
- Parameters:
indices – Indices of vertices to be removed.
clear_cache – Clear cache of data values.
- validate_cells(indices: list | tuple | ndarray | None) ndarray [source]¶
- Validate or generate cells made up of pairs of vertices making
up line segments.
- Parameters:
indices – Array of indices, shape(*, 2). If None provided, the vertices are connected sequentially.
- Returns:
Array of indices defining connected vertices.
geoh5py.objects.drape_model module¶
- class geoh5py.objects.drape_model.DrapeModel(layers: ndarray | list | tuple | None = None, prisms: ndarray | list | tuple | None = None, **kwargs)[source]¶
Bases:
ObjectBase
Drape (curtain) model object made up of layers and prisms.
- Parameters:
layers – Array of layers in the drape model organized into blocks representing each prism in the model.
prisms – Array detailing the assembly of
geoh5py.objects.drape_model.DrapeModel.layers
within the trace of the drape model.
- property centroids: ndarray¶
Cell center locations in world coordinates, shape(*, 3).
centroids = [ [x_1, y_1, z_1], ..., [x_N, y_N, z_N] ]
- property layers: ndarray¶
Layers in the drape model organized into blocks representing each prism in the model:
X (prism index), K (depth index), elevation (cell bottom))
layers = [ [x_1, k_1, z_11], [x_1, k_2, z_12], ... [x_1, k_N, z_1N], . . . [x_M, k_1, z_M1], [x_M, k_2, z_M2], ... [x_M, k_N, z_MM] ]
- property n_cells: int¶
- property prisms: ndarray¶
Array detailing the assembly of :obj: geoh5py.objects.drape_model.Drapemodel.layers within the trace of the drape model.
Columns: Easting, Northing, Elevation (top), layer index (first), layer count.
prisms = [ [e_1, n_1, z_1, l_1, c_1], ..., [e_N, n_N, z_N, l_N, c_N] ]
geoh5py.objects.drillhole module¶
- class geoh5py.objects.drillhole.Drillhole(*, collar: ndarray | list | None = None, cost: float = 0.0, end_of_hole: float | None = None, planning: str = 'Default', surveys: ndarray | list | tuple | None = None, vertices: ndarray | None = None, default_collocation_distance: float = 0.01, **kwargs)[source]¶
Bases:
Points
Drillhole object class defined by a collar and survey.
- Parameters:
collar – Coordinates of the drillhole.
cost – Cost estimate of the drillhole.
end_of_hole – End of drillhole in meters.
planning – Status of the hole, defaults to ‘Default’.
surveys – Survey information provided as ‘Depth’, ‘Azimuth’, ‘Dip’.
vertices – Coordinates of the vertices.
default_collocation_distance – Minimum collocation distance for matching depth on merge.
- property cells: ndarray | None¶
numpy.ndarray
ofint
, shape (*, 2): Array of indices defining segments connecting vertices.
- property collar: ndarray¶
Coordinates of the collar, shape(1, 3)
- static compute_intervals(survey: ndarray, collar, end_of_hole) dict [source]¶
Compute the intervals from survey and collar information.
Stores a dictionary describing the arc circle between the survey points separated by a maximum depth interval of 50 m.
Translated from C++ code.
- Parameters:
survey – Array of survey points with columns ‘Depth’, ‘Azimuth’, ‘Dip’.
collar – Collar location of the drillhole.
end_of_hole – End of the drillhole in meters.
- property cost: float¶
float
: Cost estimate of the drillhole
- property default_collocation_distance¶
Minimum collocation distance for matching depth on merge
- static densify_survey_values(survey: ndarray, end_of_hole: float | None) ndarray [source]¶
Validate the survey values for desurveying.
Repeat first survey point at surface for de-survey interpolation
Repeat last survey point at end of hole for de-survey interpolation
Densify along intervals if greater than 50 m
- Parameters:
survey – Array of survey points with columns ‘Depth’, ‘Azimuth’, ‘Dip’.
end_of_hole – End of the drillhole in meters.
- Returns:
Augmented array of survey points with columns ‘Depth’, ‘Azimuth’, ‘Dip’.
- static depths_to_xyz(intervals: dict, depths: ndarray) ndarray [source]¶
Convert survey parameters to x, y, z coordinates.
- Parameters:
intervals – Dictionary of intervals parameters.
depths – Array of depth values.
- property end_of_hole: float | None¶
End of drillhole in meters
- property extent: ndarray | None¶
Geography bounding box of the object.
- Returns:
shape(2, 3) Bounding box defined by the bottom South-West and top North-East coordinates.
- format_survey_values(values: list | tuple | ndarray) ndarray [source]¶
Reformat the survey values as structured array with the right shape.
- property from_¶
Depth data corresponding to the tops of the interval values.
- property intervals¶
Densified and computed interval information
- property locations: ndarray | None¶
Lookup array of the well path in x, y, z coordinates.
- mask_by_extent(extent: ndarray, inverse: bool = False) ndarray | None [source]¶
Sub-class extension of
mask_by_extent()
.Uses the collar location only.
- property n_cells: int | None¶
Number of cells.
- property planning: str¶
Status of the hole on of “Default”, “Ongoing”, “Planned”, “Completed” or “No status”
- property surveys: ndarray¶
Coordinates of the surveys.
- property to_¶
Depth data corresponding to the bottoms of the interval values.
- property trace: ndarray | None¶
numpy.array
: Drillhole trace defining the path in 3D
- property trace_depth: ndarray | None¶
numpy.array
: Drillhole trace depth from top to bottom
- 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 – Minimum collocation distance for matching.
- validate_depth_data(depth: ndarray, values: ndarray, collocation_distance=0.0001) ndarray [source]¶
Compare new and current depth values. Append new vertices if necessary and return an augmented values vector that matches the vertices indexing.
- Parameters:
depth – Array of depth values.
values – Array of values.
collocation_distance – Minimum collocation distance for matching.
- Returns:
Augmented values vector that matches the vertices indexing.
- validate_interval_data(from_to: ndarray | list, values: ndarray, collocation_distance: float = 0.0001) ndarray [source]¶
Compare new and current depth values, append new vertices if necessary and return an augmented values vector that matches the vertices indexing.
- Parameters:
from_to – Array of from-to values.
values – Array of values.
collocation_distance – Minimum collocation distance for matching.
- Returns:
Augmented values vector that matches the vertices indexing.
- property vertices: ndarray | None¶
vertices
geoh5py.objects.geo_image module¶
- class geoh5py.objects.geo_image.GeoImage(*, cells: ndarray | list | tuple | None = None, dip: float | None = None, image: str | ndarray | BytesIO | Image | FilenameData | None = None, rotation: float | None = None, vertices: ndarray | list | tuple | None = None, **kwargs)[source]¶
Bases:
ObjectBase
Image object class.
The GeoImage object position is defined by the four corner vertices. The values displayed in the image are stored in a separate entity, called ‘GeoImageMesh_Image’, and stored as ‘GeoImage.image_data’ attribute. The image values themselves can be accessed through the ‘GeoImage.image’ attribute.
- The ‘image’ data can be set with:
A File on disk
- An array of values defining the pixels of the image
A 2D array of values will create a grayscale image.
A 3D array of values will create an RGB image
A PIL.Image object
Setting the ‘image’ property will create a ‘GeoImageMesh_Image’ entity and remove the previous one.
- Parameters:
cells – Array of indices defining segments connecting vertices.
dip – Dip of the image in degrees from the vertices position.
image – Image data as a numpy array, PIL.Image, bytes, or path to an image file.
rotation – Rotation of the image in degrees, counter-clockwise.
vertices – Array of vertices defining the four corners of the image.
- property cells: ndarray¶
Array of indices defining segments connecting vertices.
- 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 – New parent for the copied object.
copy_children – Copy children entities.
clear_cache – Clear cache of data values.
mask – Array of indices to sub-sample the input entity.
kwargs – Additional keyword arguments.
- copy_from_extent(extent: ndarray, parent=None, *, copy_children: bool = True, clear_cache: bool = False, inverse: bool = False, **kwargs) GeoImage | None [source]¶
Sub-class extension of
copy_from_extent()
.
- property default_vertices: ndarray¶
Assign the default vertices based on image pixel count
- property dip: float¶
Calculated dip of the image in degrees from the vertices position. :return: the dip angle.
- georeference(reference: ndarray | list, locations: ndarray | list)[source]¶
Georeference the image vertices (corners) based on input reference and corresponding world coordinates.
- Parameters:
reference – Array of integers representing the reference used as reference points.
locations – Array of floats for the corresponding world coordinates for each input pixel.
- Return vertices:
Corners (vertices) in world coordinates.
- georeferencing_from_tiff()[source]¶
Get the geographic information from the PIL Image to georeference it. Run the georeference() method of the object.
- property image¶
Get the image as a
PIL.Image
object.
- property image_data: FilenameData | None¶
Get the FilenameData entity holding the image.
- property image_georeferenced: Image | None¶
Get the image as a georeferenced
PIL.Image
object.
- mask_by_extent(extent: ndarray, inverse: bool = False) ndarray | None [source]¶
Sub-class extension of
mask_by_extent()
.Uses the four corners of the image to determine overlap with the extent window.
- property n_cells¶
Number of vertices
- property n_vertices¶
Number of vertices
- property origin: array¶
The origin of the image. :return: an array of the origin of the image in x, y, z.
- property rotation: float¶
The rotation of the image in degrees, counter-clockwise. :return: the rotation angle.
- save_as(name: str, path: str | Path = '')[source]¶
Function to save the geoimage into an image file. It the name ends by ‘.tif’ or ‘.tiff’ and the tag is not None then the image is saved as georeferenced tiff image ; else, the image is save with PIL.Image’s save function. :param name: the name to give to the image. :param path: the path of the file of the image, default: ‘’.
- set_tag_from_vertices()[source]¶
If tag is None, set the basic tag values based on vertices in order to export as a georeferenced .tiff. WARNING: this function must be used after georeference().
- property tag: dict | None¶
Georeferencing information of a tiff image stored in the header. :return: a dictionary containing the PIL.Image.tag information.
- to_grid2d(mode: str | None = None, **grid2d_kwargs) Grid2D [source]¶
Create a geoh5py :obj:geoh5py.objects.grid2d.Grid2D from the geoimage in the same workspace.
- Parameters:
mode – The output image mode, defaults to the incoming image.mode. If “GRAY” convert the image to grayscale.
grid2d_kwargs – Keyword arguments to pass to the
geoh5py.objects.grid2d.Grid2D
constructor.
- Returns:
the new created
geoh5py.objects.grid2d.Grid2D
.
- validate_image_data(image: str | ndarray | BytesIO | Image | FilenameData | None) Image [source]¶
Validate the input image.
- Parameters:
image – Image to validate.
- Returns:
Image converted to FileNameData object.
- property vertices: ndarray¶
vertices
: Defines the four corners of the geo_image
geoh5py.objects.grid2d module¶
- class geoh5py.objects.grid2d.Grid2D(*, u_cell_size: float = 1.0, v_cell_size: float = 1.0, u_count: int = 1, v_count: int = 1, vertical: bool = False, dip: float = 0.0, **kwargs)[source]¶
Bases:
GridObject
Rectilinear 2D grid of uniform cell size. The grid can be oriented in 3D space through horizontal
rotation
anddip
parameters. Nodal coordinates are determined relative to the origin and the sign of cell delimiters.- Parameters:
u_cell_size – Cell size along the u-axis.
v_cell_size – Cell size along the v-axis.
u_count – Number of cells along the u-axis.
v_count – Number of cells along the v-axis.
vertical – Set the grid to be vertical.
dip – Dip angle from horizontal (positive down) in degrees. Defaults to an horizontal grid (dip=0).
- property cell_center_v: ndarray¶
The cell center local coordinate along the v-axis, shape(
u_count
, )
- property centroids: ndarray¶
Cell center locations in world coordinates, shape(
n_cells
, 3).centroids = [ [x_1, y_1, z_1], ..., [x_N, y_N, z_N] ]
- copy_from_extent(extent: ndarray, parent=None, *, copy_children: bool = True, clear_cache: bool = False, inverse: bool = False, **kwargs) Grid2D | None [source]¶
Sub-class extension of
copy_from_extent()
.
- property dip: float¶
Dip angle from horizontal (positive down) in degrees.
- property shape: tuple[int32, int32]¶
Number of cells along the u and v-axis.
- to_geoimage(keys: list | str, mode: str | None = None, **geoimage_kwargs) GeoImage [source]¶
Create a :obj:geoh5py.objects.geo_image.GeoImage object from the current Grid2D.
- Parameters:
keys – the list of the data name to pass as band in the image. Warning: The len of the list can only be 1, 3, 4 (Pillow restrictions).
mode – The mode of the image. One of ‘GRAY’, ‘RGB’, ‘RGBA’ or ‘CMYK’.
- Returns:
a new georeferenced
geoh5py.objects.geo_image.GeoImage
.
- property u_cell_size: float¶
Cell size along the u-axis.
- property u_count: int32¶
Number of cells along v-axis.
- property v_cell_size: float¶
Cell size along the v-axis
- property v_count: int32¶
Number of cells along v-axis.
- static validate_cell_size(value: Real | ndarray, axis: str) float [source]¶
Validate and format type of cell size value.
- static validate_count(value: int, axis: str) int32 [source]¶
Validate and format type of count value.
- property vertical: bool¶
Set the grid to be vertical.
geoh5py.objects.grid_object module¶
- class geoh5py.objects.grid_object.GridObject(origin: ndarray | tuple = (0.0, 0.0, 0.0), rotation: float = 0.0, **kwargs)[source]¶
Bases:
ObjectBase
,ABC
Base class for object with centroids.
- Parameters:
origin – Origin of the object.
rotation – Rotation angle (clockwise) about the vertical axis.
- abstract property centroids: ndarray¶
Cell center locations in world coordinates of shape (n_cells, 3).
- property n_cells: int¶
Total number of cells
- property origin: ndarray¶
Coordinates of the origin, shape (3, ).
- property rotation: float¶
Clockwise rotation angle (degree) about the vertical axis.
- abstract property shape: ndarray¶
Cell center locations in world coordinates.
geoh5py.objects.integrator module¶
- class geoh5py.objects.integrator.IntegratorPoints(vertices: ndarray | list | tuple | None = None, **kwargs)[source]¶
Bases:
Points
INTEGRATOR Points object. Sub-class of
geoh5py.objects.points.Points
.
geoh5py.objects.label module¶
- class geoh5py.objects.label.Label(**kwargs)[source]¶
Bases:
ObjectBase
Label object for annotation in viewport.
Warning
Not yet implemented.
- 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 – (Optional) Create copies of all children entities along with it.
clear_cache – Clear array attributes after copy.
mask – (Optional) Indices of vertices to copy.
kwargs – Additional keyword arguments.
- Returns:
New copy of the input entity.
- property extent¶
Geography bounding box of the object.
- mask_by_extent(extent: ndarray, inverse: bool = False) None [source]¶
Sub-class extension of
mask_by_extent()
.
geoh5py.objects.notype_object module¶
- class geoh5py.objects.notype_object.NoTypeObject(last_focus: str = 'None', **kwargs)[source]¶
Bases:
ObjectBase
Generic Data object without a registered type
- 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 – (Optional) Create copies of all children entities along with it.
clear_cache – Clear array attributes after copy.
mask – Array of indices to sub-sample the input entity.
kwargs – Additional keyword arguments.
- Returns:
New copy of the input entity.
geoh5py.objects.object_base module¶
- class geoh5py.objects.object_base.ObjectBase(last_focus: str = 'None', **kwargs)[source]¶
Bases:
EntityContainer
Object base class.
- Parameters:
last_focus – Object visible in camera on start.
- add_children(children: Entity | PropertyGroup | list[Entity | PropertyGroup])[source]¶
- Parameters:
children – a list of entity to add as children.
- add_data(data: dict, property_group: str | PropertyGroup | None = None, compression: int = 5, **kwargs) Data | list[Data] [source]¶
Create a Data from dictionary of name and arguments. The provided arguments can be any property of the target Data class.
- Parameters:
data – Dictionary of data to be added to the object, e.g.
property_group – Name or
PropertyGroup
.compression – Compression level for data.
data = { "data_A": { 'values': [v_1, v_2, ...], 'association': 'VERTEX' }, "data_B": { 'values': [v_1, v_2, ...], 'association': 'CELLS' }, }
- Returns:
List of new Data objects.
- add_data_to_group(data: list[Data | UUID | str] | Data | UUID | str, property_group: str | PropertyGroup, **kwargs) PropertyGroup [source]¶
Append data children to a
PropertyGroup
All given data must be children of the parent object.- Parameters:
data – The name, the uid or the object to add itself, pass as a list or single object.
property_group – The name or the object of the property group; a new one will be created if not found.
kwargs – Additional keyword arguments to create a property group.
- Returns:
The target property group.
- property converter: Any¶
- Returns:
The converter for the object.
- 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 – New parent for the copied object.
copy_children – Copy children entities.
clear_cache – Clear cache of data values.
mask – Array of indices to sub-sample the input entity.
kwargs – Additional keyword arguments.
- Returns:
New copy of the input entity.
- create_property_group(name=None, property_group_type: GroupTypeEnum | str = GroupTypeEnum.MULTI, **kwargs) PropertyGroup [source]¶
Create a new
PropertyGroup
.- Parameters:
name – Name of the new property group.
property_group_type – Type of property group.
kwargs – Any arguments taken by the
PropertyGroup
class.
- Returns:
A new
PropertyGroup
- property entity_type: ObjectType¶
EntityType
: Object type.
- property extent: ndarray | None¶
Geography bounding box of the object.
- Returns:
Bounding box defined by the bottom South-West and top North-East coordinates, shape(2, 3).
- fetch_property_group(name=None, uid=None, **kwargs) PropertyGroup [source]¶
Find or create a PropertyGroup from given name and properties.
- Parameters:
name – Name of the property group.
uid – Unique identifier for the property group.
kwargs – Any arguments taken by the
PropertyGroup
class.
- Returns:
A new or existing
PropertyGroup
- find_association(values: ndarray) str [source]¶
Find the association based on a value shape.
- Parameters:
values – The values to check.
- Returns:
The name of the association.
- find_or_create_property_group(name=None, uid=None, **kwargs) PropertyGroup [source]¶
Find or create a PropertyGroup from given name and properties.
- classmethod find_or_create_type(workspace: Workspace, **kwargs) ObjectType [source]¶
Find or create a type instance for a given object class.
- Parameters:
workspace – Target workspace.
kwargs – Keyword arguments for the ObjectType.
- Returns:
The ObjectType instance for the given object class.
- get_data(name: str | UUID) list[Data] [source]¶
Get the children associated with a given name.
- Parameters:
name – Name or UUID of the target child data
- Returns:
A list of children Data objects
- get_data_list(attribute: str = 'name') list[Any] [source]¶
Get a list of a specific attribute of the data children.
- Parameters:
attribute – The attribute to return from the data objects.
- Returns:
List of names of data associated with the object.
- get_property_group(name: UUID | str) list[PropertyGroup] | list[None] [source]¶
Get a child PropertyGroup by name.
- Parameters:
name – the reference of the property group to get.
- Returns:
A list of children Data objects
- property last_focus: str¶
The name of the object visible in the camera on start.
- property locations: ndarray | None¶
Exposes the vertices or centroids of the object.
- mask_by_extent(extent: ndarray, inverse: bool = False) ndarray | None [source]¶
Get a mask array from coordinate extent.
- Parameters:
extent – Bounding box extent coordinates defined by either: - obj:numpy.ndarray of shape (2, 3) 3D coordinate: [[west, south, bottom], [east, north, top]] - obj:numpy.ndarray of shape (2, 2) Horizontal coordinates: [[west, south], [east, north]].
inverse – Return the complement of the mask extent. Default to False
- Returns:
Array of bool defining the vertices or cell centers within the mask extent, or None if no intersection.
- property property_groups: list[PropertyGroup] | None¶
List of the property groups associated with the object.
- reference_to_data(data: str | Data | UUID) Data [source]¶
Convert a reference to a Data object.
- Parameters:
data – The data to convert. It can be the name, the uuid or the data itself.
- Returns:
The data object.
- remove_children(children: list[Entity | PropertyGroup])[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()
.
- remove_data_from_groups(data: list[Data | UUID | str] | Data | UUID | str)[source]¶
Remove data children to all
PropertyGroup
of the object.- Parameters:
data – The name, the uid or the object to remove itself, pass as a list or single object.
- validate_association(attributes, property_group=None, **_)[source]¶
Get a dictionary of attributes and validate the data ‘association’ keyword.
- Parameters:
attributes – Dictionary of attributes provided for the data.
property_group – Property group to associate the data with.
- validate_entity_type(entity_type: ObjectType) ObjectType [source]¶
Validate the entity type.
- property visual_parameters: VisualParameters | None¶
The visual parameters of the object.
geoh5py.objects.object_type module¶
- class geoh5py.objects.object_type.ObjectType(workspace: Workspace, **kwargs)[source]¶
Bases:
EntityType
Object type class
geoh5py.objects.octree module¶
- class geoh5py.objects.octree.Octree(*, u_count: int = 1, v_count: int = 1, w_count: int = 1, u_cell_size: float = 1.0, v_cell_size: float = 1.0, w_cell_size: float = 1.0, octree_cells: ndarray | list | tuple | None = None, **kwargs)[source]¶
Bases:
GridObject
Octree mesh class that uses a tree structure such that cells can be subdivided it into eight octants.
- Parameters:
u_count – Number of cells along the u-axis.
v_count – Number of cells along the v-axis.
w_count – Number of cells along the w-axis.
u_cell_size – Base cell size along the u-axis.
v_cell_size – Base cell size along the v-axis.
w_cell_size – Base cell size along the w-axis.
octree_cells – Array defining the i, j, k position and size of each cell.
- base_refine() ndarray [source]¶
Refine the mesh to its base octree level resulting in a single cell along the shortest dimension.
- property cell_volumes: ndarray¶
Returns Octree cell volumes.
Calculates nc * u_cell_size * nc * v_cell_size * nc * w_cell_size where nc is the number of base cells making up the octree cell as defined in the octree_cells array.
- Returns:
Array of cell volumes in same order as octree_cells.
- property centroids: ndarray¶
Cell center locations in world coordinates of shape (n_cells, 3).
centroids = [ [x_1, y_1, z_1], ..., [x_N, y_N, z_N] ]
- property n_cells: int¶
Total number of cells in the mesh
- property octree_cells: ndarray¶
Array defining the i, j, k position and size of each cell. The size defines the width of a cell in number of base cells, shape (
n_cells
, 4).cells = [ [i_1, j_1, k_1, size_1], ..., [i_N, j_N, k_N, size_N] ]
- property shape: tuple[int32, int32, int32]¶
Number of cells along the u, v and w-axis.
- property u_cell_size: float¶
Base cell size along the u-axis.
- property u_count: int¶
Number of cells along u-axis.
- property v_cell_size: float¶
Base cell size along the v-axis.
- property v_count: int¶
Number of cells along v-axis.
- classmethod validate_octree_cells(array: ndarray | list | tuple | None) ndarray [source]¶
Validate the octree cell array.
- Parameters:
array – An array or list defining the i, j, k position and size of each cell.
- Returns:
A formatted recarray
- static validate_octree_count(value: int, axis: str) int32 [source]¶
Validate the number of cells along an axis are in power of 2.
- Parameters:
value – Number of cells along the axis.
axis – Axis name.
- Returns:
Number of cells along the axis.
- property w_cell_size: float¶
Base cell size along the w-axis.
- property w_count: int¶
Number of cells along w-axis.
geoh5py.objects.points module¶
- class geoh5py.objects.points.Points(vertices: ndarray | list | tuple | None = None, **kwargs)[source]¶
Bases:
ObjectBase
Points object made up of vertices.
- Parameters:
vertices – Array of vertices coordinates, shape(n_vertices, 3).
- copy(parent=None, *, copy_children: bool = True, clear_cache: bool = False, mask: ndarray | None = None, **kwargs) Points [source]¶
Sub-class extension of
copy()
.
- property n_vertices: int¶
Number of vertices
- remove_vertices(indices: list[int] | ndarray, clear_cache: bool = False)[source]¶
Safely remove vertices and corresponding data entries.
- Parameters:
indices – Indices of vertices to remove.
clear_cache – Clear cached data and attributes.
- classmethod validate_vertices(xyz: ndarray | list | tuple | None) ndarray [source]¶
Validate and format type of vertices array.
- Parameters:
xyz – Array of vertices as defined by
vertices
.
- property vertices: ndarray¶
Array of vertices coordinates, shape(n_vertices, 3).
geoh5py.objects.surface module¶
- class geoh5py.objects.surface.Surface(cells: ndarray | list | tuple | None = None, **kwargs)[source]¶
Bases:
CellObject
Surface object defined by vertices and cells
- validate_cells(indices: list | tuple | ndarray | None) ndarray [source]¶
- Validate or generate cells made up of triplets of vertices making
up triangles.
- Parameters:
indices – Array of indices, shape(*, 3). If None provided, the vertices are connected sequentially.
- Returns:
Array of indices defining connecting vertices.