geoh5py.data

geoh5py.data.blob_data

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

Bases: Data

classmethod primitive_type() PrimitiveTypeEnum[source]

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, **kwargs)[source]

Bases: Entity

Base class for Data entities.

add_file(file: str)[source]

Alias not implemented from base Entity class.

property association: DataAssociationEnum | None

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, copy_children: bool = True, 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.

  • copy_children – (Optional) Create copies of all children entities along with it.

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

property entity_type: DataType

DataType

property extent: ndarray | None

Geography bounding box of the parent object.

Returns:

shape(2, 3) Bounding box defined by the bottom South-West and top North-East coordinates.

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]
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.Workspace, **kwargs)[source]

Bases: EntityType

DataType class

property color_map: ColorMap | None

ColorMap: Colormap used for plotting

The colormap can be set from a dict of sorted values with corresponding RGBA color.

color_map = {
    val_1: [r_1, g_1, b_1, a_1],
    ...,
    val_i: [r_i, g_i, b_i, a_i]
}
classmethod create(workspace: workspace.Workspace, data_class: type[data.Data]) DataType[source]

Creates a new instance of DataType with corresponding PrimitiveTypeEnum.

Parameters:

data_class – A Data implementation class.

Returns:

A new instance of DataType.

classmethod find_or_create(workspace: workspace.Workspace, **kwargs) DataType[source]

Find or creates an EntityType with given UUID that matches the given Group implementation class.

Parameters:

workspace – An active Workspace class

Returns:

A new instance of DataType.

classmethod for_x_data(workspace: workspace.Workspace) DataType[source]
classmethod for_y_data(workspace: workspace.Workspace) DataType[source]
classmethod for_z_data(workspace: workspace.Workspace) DataType[source]
property hidden: bool

bool: Hidden data [False]

property mapping: str

str: Color stretching type chosen from: ‘linear’, [‘equal_area’], ‘logarithmic’, ‘cdf’, ‘missing’

property number_of_bins: int | None

int: Number of bins used by the histogram [50]

property primitive_type: PrimitiveTypeEnum | None

PrimitiveTypeEnum

property transparent_no_data: bool

bool: Use transparent for no-data-value [True]

property units: str | None

str: Data units

property value_map: ReferenceValueMap | None

ReferenceValueMap: Reference value map for ReferenceData

The value_map can be set from a dict of sorted values with corresponding str 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, **kwargs)[source]

Bases: TextData

classmethod primitive_type() PrimitiveTypeEnum[source]

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]
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, **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]

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, **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]

geoh5py.data.numeric_data

class geoh5py.data.numeric_data.NumericData(data_type: DataType, **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]
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(color_map: dict[int, str] | None = None)[source]

Bases: ABC

Maps from reference index to reference value of ReferencedData.

property map

dict: A reference dictionary mapping values to strings

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]
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, **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]
property values: list[dict] | None

list List of comments

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

Bases: Data

classmethod primitive_type() PrimitiveTypeEnum[source]
property values: ndarray | str | None

str Text value.

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

Bases: Data

classmethod primitive_type() PrimitiveTypeEnum[source]
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]