geoh5py.data

geoh5py.data.blob_data

class geoh5py.data.blob_data.BlobData(data_type: DataType, association: DataAssociationEnum = DataAssociationEnum.OBJECT, **kwargs)[source]

Bases: Data

classmethod primitive_type() PrimitiveTypeEnum[source]

Abstract method to return the primitive type of the class.

geoh5py.data.color_map

class geoh5py.data.color_map.ColorMap(**kwargs)[source]

Bases: object

Records colors assigned to value ranges (where Value is the start of the range).

property name: str

str: Name of the colormap

property parent

Parent data type

property values: ndarray | None

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.data

class geoh5py.data.data.Data(data_type: DataType, association: DataAssociationEnum = DataAssociationEnum.OBJECT, **kwargs)[source]

Bases: Entity

Base class for Data entities.

property association: DataAssociationEnum

DataAssociationEnum: Relationship made between the values() and elements of the parent object. Association can be set from a str chosen from the list of available DataAssociationEnum options.

copy(parent=None, clear_cache: bool = False, mask: ndarray | None = None, **kwargs) Data[source]

Function to copy data to a different parent entity.

Parameters:
  • parent – Target parent to copy the entity under. Copied to current parent if 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[source]

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 parent if 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.

property entity_type: DataType

DataType

mask_by_extent(extent: ndarray, inverse: bool = False) ndarray | None[source]

Sub-class extension of mask_by_extent().

Uses the parent object’s vertices or centroids coordinates.

property modifiable: bool

bool Entity can be modified.

property n_values: int | None

int: Number of expected data values based on association

property nan_value: None

Value used to represent missing data in python.

abstract classmethod primitive_type() PrimitiveTypeEnum[source]

Abstract method to return the primitive type of the class.

property values

Data values

geoh5py.data.data_association_enum

class geoh5py.data.data_association_enum.DataAssociationEnum(value)[source]

Bases: Enum

Known data association between values and the parent object. Available options:

CELL = 2
DEPTH = 6
FACE = 4
GROUP = 5
OBJECT = 1
UNKNOWN = 0
VERTEX = 3

geoh5py.data.data_type

class geoh5py.data.data_type.DataType(workspace: Workspace, primitive_type: type[Data] | PrimitiveTypeEnum | str | None = None, color_map: ColorMap | None = None, hidden: bool = False, mapping: ColorMapping = 'equal_area', number_of_bins: int | None = None, transparent_no_data: bool = True, units: str | None = None, value_map: dict[int, str] | ReferenceValueMap | None = None, **kwargs)[source]

Bases: EntityType

DataType 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.

  • color_map – The colormap used for plotting.

  • 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.

  • transparent_no_data – If the no data values are displayed as transparent or not.

  • units – The type of the units of the data.

  • value_map – Reference value map for to map index with description.

  • 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.

classmethod for_x_data(workspace: Workspace) DataType[source]

Get the data type for x data.

Parameters:

workspace – An active Workspace.

Returns:

A new instance of DataType.

classmethod for_y_data(workspace: Workspace) DataType[source]

Get the data type for y data.

Parameters:

workspace – An active Workspace.

Returns:

A new instance of DataType.

classmethod for_z_data(workspace: Workspace) DataType[source]

Get the data type for z data.

Parameters:

workspace – An active Workspace.

Returns:

A new instance of DataType.

property hidden: bool

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 primitive_type: PrimitiveTypeEnum | None

The primitive type of the data.

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_data_type(workspace: Workspace, attribute_dict: dict)[source]

Get a dictionary of attributes and validate the type of data.

Parameters:
  • workspace – An active Workspace.

  • attribute_dict – A dictionary of attributes of the new Datatype to create.

Returns:

A new instance of DataType.

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
}

geoh5py.data.data_unit

class geoh5py.data.data_unit.DataUnit(unit_name: str | None = None)[source]

Bases: object

Data unit

property name: str | None

geoh5py.data.datetime_data

class geoh5py.data.datetime_data.DatetimeData(data_type: DataType, association: DataAssociationEnum = DataAssociationEnum.OBJECT, **kwargs)[source]

Bases: TextData

classmethod primitive_type() PrimitiveTypeEnum[source]

Abstract method to return the primitive type of the class.

geoh5py.data.filename_data

class geoh5py.data.filename_data.FilenameData(data_type: DataType, file_name=None, **kwargs)[source]

Bases: Data

property file_name: str | None

str Text value.

classmethod primitive_type() PrimitiveTypeEnum[source]

Abstract method to return the primitive type of the class.

save_file(path: str | Path = PosixPath('.'), name=None)[source]

Save the file to disk.

Parameters:
  • path – Directory to save the file to.

  • name – Name given to the file.

property values: bytes | None

Binary str value representation of a file.

geoh5py.data.float_data

class geoh5py.data.float_data.FloatData(data_type: DataType, association: DataAssociationEnum = DataAssociationEnum.OBJECT, **kwargs)[source]

Bases: NumericData

Data container for floats values

format_type(values: ndarray) ndarray[source]

Check if the type of values is valid and coerse to type float64. :param values: numpy array to modify. :return: the formatted values.

property nan_value

Nan-Data-Value

property ndv: float

No-Data-Value

classmethod primitive_type() PrimitiveTypeEnum[source]

Abstract method to return the primitive type of the class.

geoh5py.data.geometric_data_constants

class geoh5py.data.geometric_data_constants.GeometricDataConstants[source]

Bases: object

classmethod primitive_type() PrimitiveTypeEnum[source]
classmethod x_datatype_uid() UUID[source]
classmethod y_datatype_uid() UUID[source]
classmethod z_datatype_uid() UUID[source]

geoh5py.data.integer_data

class geoh5py.data.integer_data.IntegerData(data_type: DataType, association: DataAssociationEnum = DataAssociationEnum.OBJECT, **kwargs)[source]

Bases: NumericData

format_type(values: ndarray) ndarray[source]

Check if the type of values is valid and coerse to type int32. :param values: numpy array to modify. :return: the formatted values.

property nan_value

Nan-Data-Value

property ndv: int

No-Data-Value

classmethod primitive_type() PrimitiveTypeEnum[source]

Abstract method to return the primitive type of the class.

geoh5py.data.numeric_data

class geoh5py.data.numeric_data.NumericData(data_type: DataType, association: DataAssociationEnum = DataAssociationEnum.OBJECT, **kwargs)[source]

Bases: Data, ABC

Data container for floats values

format_length(values: ndarray) ndarray[source]

Check for possible mismatch between the length of values :param values: the values to check. :return: the values with the right length.

abstract format_type(values: ndarray) ndarray[source]

Check if the type of values is valid and convert it to right dtype. :param values: numpy array to modify. :return: the formatted values.

format_values(values: ndarray | None) ndarray[source]

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

abstract property ndv

No-data-value

classmethod primitive_type() PrimitiveTypeEnum[source]

Abstract method to return the primitive type of the class.

property values: ndarray | None
Returns:

values: An array of values

geoh5py.data.primitive_type_enum

class geoh5py.data.primitive_type_enum.PrimitiveTypeEnum(value)[source]

Bases: Enum

Known data type.

Available options:

BLOB = 6
BOOLEAN = 11
DATETIME = 8
FILENAME = 5
FLOAT = 2
GEOMETRIC = 9
INTEGER = 1
INVALID = 0
MULTI_TEXT = 10
REFERENCED = 4
TEXT = 3
VECTOR = 7

geoh5py.data.reference_value_map

class geoh5py.data.reference_value_map.ReferenceValueMap(value_map: dict[int, str])[source]

Bases: ABC

Maps from reference index to reference value of ReferencedData.

property map: dict[int, str]

A reference dictionary mapping values to strings. The keys are positive integers, and the values description. The key ‘0’ is always ‘Unknown’.

geoh5py.data.referenced_data

class geoh5py.data.referenced_data.ReferencedData(data_type: DataType, **kwargs)[source]

Bases: IntegerData

Reference data described by indices and associated strings.

classmethod primitive_type() PrimitiveTypeEnum[source]

Abstract method to return the primitive type of the class.

property value_map

Pointer to the data.data_type.DataType.value_map

geoh5py.data.text_data

class geoh5py.data.text_data.CommentsData(data_type: DataType, association: DataAssociationEnum = DataAssociationEnum.OBJECT, **kwargs)[source]

Bases: Data

Comments 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."
    },
]
classmethod primitive_type() PrimitiveTypeEnum[source]

Abstract method to return the primitive type of the class.

property values: list[dict] | None

list List of comments

class geoh5py.data.text_data.MultiTextData(data_type: DataType, association: DataAssociationEnum = DataAssociationEnum.OBJECT, **kwargs)[source]

Bases: Data

classmethod primitive_type() PrimitiveTypeEnum[source]

Abstract method to return the primitive type of the class.

property values: ndarray | str | None

str Text value.

class geoh5py.data.text_data.TextData(data_type: DataType, association: DataAssociationEnum = DataAssociationEnum.OBJECT, **kwargs)[source]

Bases: Data

property nan_value

Nan-Data-Value to be used in arrays

classmethod primitive_type() PrimitiveTypeEnum[source]

Abstract method to return the primitive type of the class.

property values: ndarray | str | None

str Text value.

geoh5py.data.unknown_data

class geoh5py.data.unknown_data.UnknownData(data_type: DataType, association: DataAssociationEnum, name: str, uid: UUID | None = None)[source]

Bases: Data

classmethod primitive_type() PrimitiveTypeEnum[source]

Abstract method to return the primitive type of the class.