geoh5py.data package#
Submodules#
geoh5py.data.blob_data module#
- class geoh5py.data.blob_data.BlobData(association: DataAssociationEnum = DataAssociationEnum.OBJECT, modifiable: bool = True, pinned: bool = False, visible: bool = False, values: Any | None = None, **kwargs)#
Bases:
Data- validate_values(values: Any | None) Any#
Validate values for BlobData.
geoh5py.data.boolean_data module#
- class geoh5py.data.boolean_data.BooleanData(**kwargs)#
Bases:
ReferencedDataData class for logical (bool) values.
- format_type(values: ndarray)#
Check if the type of values is valid and coerce to type bool. :param values: numpy array to modify. :return: the formatted values.
- property formatted_values#
The data with the right format for Geoscience ANALYST.
- property ndv: int#
No-Data-Value
geoh5py.data.color_map module#
- class geoh5py.data.color_map.ColorMap(**kwargs)#
Bases:
objectRecords colors assigned to value ranges (where Value is the start of the range).
- property name: str#
str: Name of the colormap
- property values: ndarray#
numpy.array: Colormap defined by values and corresponding RGBA:values = [ [V_1, R_1, G_1, B_1, A_1], ..., [V_i, R_i, G_i, B_i, A_i] ]
where V (Values) are sorted floats defining the position of each RGBA. R (Red), G (Green), B (Blue) and A (Alpha) are integer values between [0, 255].
geoh5py.data.colour module#
- class geoh5py.data.colour.Colour(*args, **kwargs)#
Bases:
DataBase class for the ternary colour map.
Warning: actually, GA is storing RGBA but ignore the “A” band (full 255). To mimic this behavior, works with RGB only (and drop A if exists).
- property nan_value#
Value used to represent missing data in python.
- validate_values(values: ndarray | None) Any#
Validate values for UnknownData.
Important Note: GA is only supporting RGB but is storing as RGBA. Transform values to RGB always.
geoh5py.data.data module#
- class geoh5py.data.data.Data(association: DataAssociationEnum = DataAssociationEnum.OBJECT, modifiable: bool = True, pinned: bool = False, visible: bool = False, values: Any | None = None, **kwargs)#
Bases:
EntityBase class for Data entities.
- Parameters:
association – Relationship made between the parent object and values.
modifiable – Entity can be modified.
visible – Entity is visible. Only a single data can be visible at a time.
values – Data values.
- property association: DataAssociationEnum#
Relationship made between the
values()and elements of theparentobject.
- copy(parent=None, *, clear_cache: bool = False, mask: ndarray | None = None, **kwargs)#
Function to copy data to a different parent entity.
- Parameters:
parent – Target parent to copy the entity under. Copied to current
parentif None.clear_cache – Clear array attributes after copy.
mask – Array of bool defining the values to keep.
kwargs – Additional keyword arguments to pass to the copy constructor.
- Return entity:
Registered Entity to the workspace.
- copy_from_extent(extent: ndarray, parent=None, *, clear_cache: bool = False, inverse: bool = False, **kwargs) Entity | None#
Function to copy data based on a bounding box extent.
- Parameters:
extent – Bounding box extent requested for the input entity, as supplied for
mask_by_extent().parent – Target parent to copy the entity under. Copied to current
parentif None.clear_cache – Clear array attributes after copy.
inverse – Keep the inverse (clip) of the extent selection.
kwargs – Additional keyword arguments to pass to the copy constructor.
- Return entity:
Registered Entity to the workspace.
- classmethod default_type_uid() UUID | None#
Abstract method to return the default type uid for the class.
- property entity_type#
Type of data.
- format_length(values: ndarray) ndarray#
Check for possible mismatch between the length of values :param values: the values to check. :return: the values with the right length.
- property formatted_values#
The data with the right format for Geoscience ANALYST.
- mask_by_extent(extent: ndarray, inverse: bool = False) ndarray | None#
Sub-class extension of
mask_by_extent().Uses the parent object’s vertices or centroids coordinates.
- Parameters:
extent – Array or coordinate defining the lower and upper bounds of the extent.
inverse – Keep the inverse (clip) of the extent selection.
- property modifiable: bool#
Entity can be modified within ANALYST.
- property n_values: int | None#
Number of expected data values based on
association
- property nan_value: None#
Value used to represent missing data in python.
- property pinned: bool#
Controls whether the data is pinned to the beginning of the datatable.
- primitive_type() Enum#
Deprecated method to return the primitive type of the class.
- static validate_association(value: str | DataAssociationEnum)#
- validate_entity_type(entity_type: DataType) DataType#
Validate the entity type.
- Parameters:
entity_type – Entity type to validate.
- abstractmethod validate_values(values: Any | None) Any#
Validate the values.
To be deprecated along with the standalone Drillhole class in future version.
- Parameters:
values – Values to validate.
- property values#
Data values
- property visible: bool#
Whether the data is visible in camera (checked in ANALYST object tree).
geoh5py.data.data_association_enum module#
geoh5py.data.data_type module#
- class geoh5py.data.data_type.DataType(workspace: Workspace, *, primitive_type: type[Data] | PrimitiveTypeEnum | str = 'UNKNOWN', color_map: ColorMap | None = None, complement_filter: bool = False, duplicate_on_copy: bool = False, duplicate_type_on_copy: bool = False, filter_max: int | float | None = None, filter_min: int | float | None = None, hidden: bool = False, mapping: ColorMapping = 'equal_area', number_of_bins: int | None = None, precision: int = 2, scale: str | None = None, scientific_notation: bool = False, transparent_no_data: bool = True, units: str | None = None, **kwargs)#
Bases:
EntityTypeDataType class.
Controls all the attributes of the data type for displays in Geoscience ANALYST.
- Parameters:
workspace – An active Workspace.
primitive_type – The primitive type of the data.
complement_filter – Filter color map on complement of the min-max filter
color_map – The colormap used for plotting.
duplicate_on_copy – Force a copy on copy of the data entity.
duplicate_type_on_copy – Force a copy on copy of the data entity.
filter_max – Maximum value for the colormap filter.
filter_min – Minimum value for the colormap filter.
hidden – If the data are hidden or not.
mapping – The type of color stretching to plot the colormap.
number_of_bins – The number of bins used by the histogram.
precision – The decimals precision of the data to display.
scale – The type of scale of the data.
scientific_notation – If the data should be displayed in scientific notation.
transparent_no_data – If the no data values are displayed as transparent or not.
units – The type of the units of the data.
kwargs – Additional keyword arguments to set as attributes (see
shared.entity_type.EntityType).
- property color_map: ColorMap | None#
The Colormap used for plotting
The colormap can be set from a dictionary of sorted values with corresponding RGBA color. Or from a numpy array containing the RGBA values.
color_map = { val_1: [r_1, g_1, b_1, a_1], ..., val_i: [r_i, g_i, b_i, a_i] }
It can be set to None if non-existing.
- property complement_filter: bool#
Filter color map on complement of the min-max filter.
- property dtype: type#
The data type of the data.
- property duplicate_on_copy: bool#
If the data type should be duplicated on copy.
- property duplicate_type_on_copy: bool#
If the data type should be duplicated on copy.
- property filter_max: float | None#
Maximum value of the colormap filter.
- property filter_min: float | None#
Minimum value of the colormap filter.
- classmethod find_or_create_type(workspace: Workspace, primitive_type: PrimitiveTypeEnum | str, *, dynamic_implementation_id: str | UUID | None = None, uid: UUID | None = None, **kwargs) DataType#
Get the data type for geometric data.
- Parameters:
workspace – An active Workspace class
primitive_type – The primitive type of the data.
uid – The unique identifier of the entity type.
kwargs – The attributes of the entity type.
- Returns:
EntityType
If the data are hidden or not.
- property mapping: str#
The type of color stretching to plot the colormap. It chan be one of the following: ‘linear’, ‘equal_area’, ‘logarithmic’, ‘cdf’, ‘missing’
- property number_of_bins: int | None#
The number of bins used by the histogram. It can be None if no histogram is used.
- property precision: int#
The decimals precision of the data to display.
- property primitive_type: PrimitiveTypeEnum#
The primitive type of the data.
- static primitive_type_from_values(values: ndarray | None) PrimitiveTypeEnum#
Validate the primitive type of the data.
- Parameters:
values – The values to validate.
- Returns:
The equivalent primitive type of the data.
- property scale: str | None#
The type of scale of the data.
- property scientific_notation: bool#
If the data should be displayed in scientific notation.
- property transparent_no_data: bool#
If the no data values are displayed as transparent or not.
- property units: str | None#
The type of the units of the data.
- static validate_primitive_type(primitive_type: PrimitiveTypeEnum | str | type[Data]) PrimitiveTypeEnum#
Validate the primitive type of the data.
- Parameters:
primitive_type – Some reference to the primitive type of the data.
- Returns:
A known primitive type.
- class geoh5py.data.data_type.GeometricDataValueMapType(workspace: Workspace, *, value_map: dict[int, str] | tuple | ReferenceValueMap | None = None, parent: ObjectBase | None = None, description: str = 'Dynamic referenced data', primitive_type: PrimitiveTypeEnum | str = PrimitiveTypeEnum.GEOMETRIC, **kwargs)#
Bases:
ReferenceDataType,GeometricDynamicDataTypeData container for value map
- get_parent_reference(parent: ObjectBase)#
Recover the parent ReferencedData by name.
- property referenced_data: ReferencedData | None#
Reference data type holding the value map.
- set_parent_reference(data: GeometricDataConstants, new_name: str)#
Change the metadata keys on the referenced data.
- Parameters:
data – Geometric data entity referenced in the data map
new_name – Name to be replaced in the data map
- static validate_keys(value_map: ReferenceValueMap)#
Validate the keys of the value map.
- validate_value_map(value_map: dict[int, str] | ndarray | tuple | ReferenceValueMap) ReferenceValueMap | None#
Validate the attribute of ReferencedDataType
- property value_map: ReferenceValueMap | None#
Reference value to map index with description.
The value_map can be set from a dictionary of sorted integer values with text description.
value_map = { val_1: str_1, ..., val_i: str_i }
- class geoh5py.data.data_type.GeometricDataXType(workspace: Workspace, uid: UUID | None = None, **kwargs)#
Bases:
GeometricDynamicDataTypeData container for X values
- class geoh5py.data.data_type.GeometricDataYType(workspace: Workspace, uid: UUID | None = None, **kwargs)#
Bases:
GeometricDynamicDataTypeData container for Y values
- class geoh5py.data.data_type.GeometricDataZType(workspace: Workspace, uid: UUID | None = None, **kwargs)#
Bases:
GeometricDynamicDataTypeData container for Z values
- class geoh5py.data.data_type.GeometricDynamicDataType(workspace: Workspace, uid: UUID | None = None, **kwargs)#
Bases:
DataType,ABCData container for dynamic geometric data.
- classmethod default_type_uid() UUID | None#
Default uuid for the entity type.
- property dynamic_implementation_id: UUID#
The dynamic implementation id.
- class geoh5py.data.data_type.ReferenceDataType(workspace: Workspace, value_map: dict[int, str] | np.ndarray | tuple | ReferenceValueMap = ((0, 'Unknown'),), **kwargs)#
Bases:
DataTypeDataType class.
Controls all the attributes of reference data.
- Parameters:
value_map – Reference value to map index with description.
- abstractmethod static validate_keys(value_map: ReferenceValueMap) ReferenceValueMap#
Validate the keys of the value map.
- validate_value_map(value_map: dict[int, str] | ndarray | tuple | ReferenceValueMap) ReferenceValueMap | None#
Validate the attribute of ReferencedDataType
- property value_map: ReferenceValueMap | None#
Reference value map for to map index with description.
The value_map can be set from a dictionary of sorted values int values with text description.
value_map = { val_1: str_1, ..., val_i: str_i }
- class geoh5py.data.data_type.ReferencedBooleanType(workspace: Workspace, value_map: dict[int, str] | np.ndarray | tuple | ReferenceValueMap = array([(0, b'False'), (1, b'True')], dtype=[('Key', '<u4'), ('Value', 'O')]), **kwargs)#
Bases:
ReferenceDataTypeData container for referenced boolean data.
- static validate_keys(value_map: ReferenceValueMap)#
Validate the keys of the value map.
- class geoh5py.data.data_type.ReferencedValueMapType(workspace: Workspace, **kwargs)#
Bases:
ReferenceDataTypeData container for referenced value map.
- static validate_keys(value_map: ReferenceValueMap)#
Validate the keys of the value map.
geoh5py.data.data_unit module#
geoh5py.data.datetime_data module#
- class geoh5py.data.datetime_data.DatetimeData(association: DataAssociationEnum = DataAssociationEnum.OBJECT, modifiable: bool = True, pinned: bool = False, visible: bool = False, values: Any | None = None, **kwargs)#
Bases:
TextDataDatetimeData class for storing datetime values in a geoh5 file.
geoh5py.data.filename_data module#
- class geoh5py.data.filename_data.FilenameData(values: str | None = None, file_bytes: bytes | None = None, name='GeoImageMesh_Image', public: bool = False, **kwargs)#
Bases:
DataClass for storing files as data blob.
- Parameters:
values – Name of the file.
file_bytes – Binary representation of the file.
- property file_bytes#
Binary blob value representation of a file.
- property file_name#
Binary blob value representation of a file.
- save_file(path: str | Path = PosixPath('.'), name=None) Path#
Save the file to disk.
- Parameters:
path – Directory to save the file to.
name – Name given to the file.
- Returns:
Path to the saved file.
- validate_values(values: Any | None) Any#
Validate the values.
To be deprecated along with the standalone Drillhole class in future version.
- Parameters:
values – Values to validate.
geoh5py.data.float_data module#
- class geoh5py.data.float_data.FloatData(association: DataAssociationEnum = DataAssociationEnum.OBJECT, modifiable: bool = True, pinned: bool = False, visible: bool = False, values: Any | None = None, **kwargs)#
Bases:
NumericDataData container for floats values
- format_type(values: ndarray) ndarray#
Check if the type of values is valid and coerce to type float64. :param values: numpy array to modify. :return: the formatted values.
- property formatted_values#
The data with the right format for Geoscience ANALYST.
- property nan_value#
Nan-Data-Value
- property ndv: float#
No-Data-Value
geoh5py.data.geometric_data module#
- class geoh5py.data.geometric_data.GeometricDataConstants(allow_move=False, visible=False, allow_delete=False, allow_rename=False, **kwargs)#
Bases:
DataBase class for geometric data constants.
- Parameters:
allow_move – Defaults coordinate to remain on object.
visible – Defaults to not visible.
- copy(parent=None, *, clear_cache: bool = False, mask: ndarray | None = None, **kwargs) None#
Overload of the base Data.copy method to prevent direct copy of GeometricData.
- Returns:
A new GeometricDataConstants instance or None.
- property name: str#
strName of the entity
- validate_values(values: None) None#
Validate values for GeometricDataConstants.
geoh5py.data.integer_data module#
- class geoh5py.data.integer_data.IntegerData(association: DataAssociationEnum = DataAssociationEnum.OBJECT, modifiable: bool = True, pinned: bool = False, visible: bool = False, values: Any | None = None, **kwargs)#
Bases:
NumericData- format_type(values: ndarray) ndarray#
Check if the type of values is valid and coerce to type int32. :param values: numpy array to modify. :return: the formatted values.
- property formatted_values#
The data with the right format for Geoscience ANALYST.
- property nan_value#
Nan-Data-Value
- property ndv: int#
No-Data-Value
geoh5py.data.numeric_data module#
- class geoh5py.data.numeric_data.NumericData(association: DataAssociationEnum = DataAssociationEnum.OBJECT, modifiable: bool = True, pinned: bool = False, visible: bool = False, values: Any | None = None, **kwargs)#
Bases:
Data,ABCData container for floats values
- abstractmethod format_type(values: ndarray) ndarray#
Check if the type of values is valid and convert it to right dtype. :param values: numpy array to modify. :return: the formatted values.
- abstract property ndv#
No-data-value
- property ndv_values: ndarray | None#
Data with nan replaced by ndv
- validate_values(values: ndarray | None) ndarray#
Check for possible mismatch between the length of values stored and the expected number of cells or vertices.
- Parameters:
values – Array of values to check
- Returns:
values: An array of float values of length n_values or None
geoh5py.data.reference_value_map module#
- class geoh5py.data.reference_value_map.ReferenceValueMap(value_map: dict[int, str] | ndarray | tuple, name: str = 'Value map', main: bool = False)#
Bases:
objectMaps from reference index to reference value of ReferencedData.
- Parameters:
value_map – A mapping of positive integers to strings. The key ‘0’ is reserved for ‘Unknown’.
name – The name of the value map.
main – Whether this is the main value map for the data. If True, it will be used for mapping values to strings. If False, it will be stored as an auxiliary value map.
- MAP_DTYPE = dtype([('Key', '<u4'), ('Value', 'O')])#
- property map: ndarray#
A reference array mapping values to strings. The keys are positive integers, and the values description. The key ‘0’ is always ‘Unknown’.
- map_values(values: ndarray) ndarray#
Map the values to the reference values.
- Parameters:
values – The values to map.
- Returns:
The mapped values.
- classmethod validate_value_map(value_map: ndarray | dict, main: bool = False) ndarray#
Verify that the key and value are valid. It raises errors if there is an issue
- Parameters:
value_map – Array of key, value pairs.
main – Whether this is the main value map for the data. If True, it will be used for mapping values to strings. If False, it will be stored as an auxiliary value map.
- Returns:
A validated value map as a numpy recarray.
geoh5py.data.referenced_data module#
- class geoh5py.data.referenced_data.ReferencedData(**kwargs)#
Bases:
IntegerDataReference data described by indices and associated strings.
- add_data_map(name: str, values: ndarray | dict, public: bool = True)#
Add a data map to the value map.
- Parameters:
name – The name of the data map.
values – The data map to add.
public – Whether the data map should be public.
- copy(parent=None, *, clear_cache: bool = False, mask: ndarray | None = None, **kwargs)#
Overwrite the copy method to ensure that the uid is set to None and transfer the GeometricDataValueMapType to the new entity type.
- copy_data_map(data_map: GeometricDataConstants, name: str | None = None, clear_cache=True) GeometricDataConstants | None#
Create a copy with unique name of a GeometricDataConstant entity.
- Parameters:
data_map – An existing GeometricDataConstant to be copied.
name – Name assigned to the data_map, or increments the original.
clear_cache – Clear array attributes after copy.
- property data_maps: dict[str, GeometricDataConstants] | None#
A reference dictionary mapping properties to numpy arrays.
- property mapped_values: ndarray#
The values mapped from the reference data.
- property nan_value#
Nan-Data-Value
- remove_data_map(name: str)#
Remove a data map from the list of children.
- Parameters:
name – The name of the data map to remove.
- property value_map: ReferenceValueMap | None#
Pointer to the
data.data_type.DataType.value_map
geoh5py.data.text_data module#
- class geoh5py.data.text_data.CommentsData(association: DataAssociationEnum = DataAssociationEnum.OBJECT, modifiable: bool = True, pinned: bool = False, visible: bool = False, values: Any | None = None, **kwargs)#
Bases:
TextDataComments added to an Object or Group. Stored as a list of dictionaries with the following keys:
comments = [ { "Author": "username", "Date": "2020-05-21T10:12:15", "Text": "A text comment." }, ]
- property formatted_values#
The data with the right format for Geoscience ANALYST.
- validate_values(values) dict | None#
Validate the values.
To be deprecated along with the standalone Drillhole class in future version.
- Parameters:
values – Values to validate.
- class geoh5py.data.text_data.MultiTextData(association: DataAssociationEnum = DataAssociationEnum.OBJECT, modifiable: bool = True, pinned: bool = False, visible: bool = False, values: Any | None = None, **kwargs)#
Bases:
TextData- property formatted_values#
The data with the right format for Geoscience ANALYST.
- property nan_value#
Value used to represent missing data in python.
- validate_values(values: ndarray | str | None) ndarray | str | None#
Validate the values.
To be deprecated along with the standalone Drillhole class in future version.
- Parameters:
values – Values to validate.
- class geoh5py.data.text_data.TextData(association: DataAssociationEnum = DataAssociationEnum.OBJECT, modifiable: bool = True, pinned: bool = False, visible: bool = False, values: Any | None = None, **kwargs)#
Bases:
Data- property formatted_values#
The data with the right format for Geoscience ANALYST.
- property nan_value#
Nan-Data-Value to be used in arrays
- validate_values(values: ndarray | str | None) ndarray | str | None#
Validate the values.
To be deprecated along with the standalone Drillhole class in future version.
- Parameters:
values – Values to validate.
- geoh5py.data.text_data.text_formating(values: None | ndarray | str) ndarray | None#
Format text values to utf-8.
- Parameters:
values – The values to format.
- Returns:
The formatted values.
geoh5py.data.unknown_data module#
- class geoh5py.data.unknown_data.UnknownData(association: DataAssociationEnum = DataAssociationEnum.OBJECT, modifiable: bool = True, pinned: bool = False, visible: bool = False, values: Any | None = None, **kwargs)#
Bases:
Data- validate_values(values: Any | None) Any#
Validate values for UnknownData.
geoh5py.data.visual_parameters module#
- class geoh5py.data.visual_parameters.VisualParameters(association: DataAssociationEnum = DataAssociationEnum.OBJECT, public: bool = False, **kwargs)#
Bases:
TextData- property colour: None | list#
Colour of the object in [Red, Green, Blue] format.
Each value is an integer between 0 and 255. The colour value is stored as a single integer converted from a byte string of the form ‘RRGGBB’ where ‘BB’ is the blue value, ‘GG’ is the green value, ‘RR’ is the red converted from hexadecimal format.
- property filter_basement: None | float#
Filter basement tag for VPmodel.
- get_tag(tag: str) None | Element#
Recover the tag element.
- Parameters:
tag – The name of the tag.
- Returns:
The xml element.
- set_tags(**values: str)#
Set values for the tags stored as xml Elements.
- Parameters:
values – Dictionary of tag names and values.
- property values: str | None#
Data values
- property xml: Element#
strXML string.
Module contents#
- class geoh5py.data.DataTypeEnum(*values)#
Bases:
Enum- BLOB = <class 'bytes'>#
- BOOLEAN = <class 'bool'>#
- DATETIME = <class 'str'>#
- FILENAME = <class 'pathlib.Path'>#
- FLOAT = <class 'numpy.float32'>#
- GEOMETRIC = <class 'NoneType'>#
- INTEGER = <class 'numpy.int32'>#
- INVALID = <class 'NoneType'>#
- MULTI_TEXT = <class 'str'>#
- REFERENCED = <class 'numpy.uint32'>#
- TEXT = <class 'str'>#
- VECTOR = <class 'NoneType'>#
- classmethod from_primitive_type(primitive_type: PrimitiveTypeEnum) type#
Get the data type from the primitive type.
- Parameters:
primitive_type – The primitive type.
- Returns:
The data type.
- class geoh5py.data.PrimitiveTypeEnum(*values)#
Bases:
EnumEnum for data types.
- BLOB = <class 'geoh5py.data.blob_data.BlobData'>#
- BOOLEAN = <class 'geoh5py.data.boolean_data.BooleanData'>#
- COLOUR = <class 'geoh5py.data.colour.Colour'>#
- COMMENTS = <class 'geoh5py.data.text_data.CommentsData'>#
- DATETIME = <class 'geoh5py.data.datetime_data.DatetimeData'>#
- FILENAME = <class 'geoh5py.data.filename_data.FilenameData'>#
- FLOAT = <class 'geoh5py.data.float_data.FloatData'>#
- GEOMETRIC = <class 'geoh5py.data.geometric_data.GeometricDataConstants'>#
- INTEGER = <class 'geoh5py.data.integer_data.IntegerData'>#
- INVALID = <class 'NoneType'>#
- MULTI_TEXT = <class 'geoh5py.data.text_data.MultiTextData'>#
- REFERENCED = <class 'geoh5py.data.referenced_data.ReferencedData'>#
- TEXT = <class 'geoh5py.data.text_data.TextData'>#
- TEXTURE = <class 'geoh5py.data.texture_data.TextureData'>#
- UNKNOWN = <class 'geoh5py.data.unknown_data.UnknownData'>#
- VECTOR = <class 'NoneType'>#
- VISUAL_PARAMETERS = <class 'geoh5py.data.visual_parameters.VisualParameters'>#