Source code for geoh5py.data.blob_data
# ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
# Copyright (c) 2025 Mira Geoscience Ltd. '
# '
# This file is part of geoh5py. '
# '
# geoh5py is free software: you can redistribute it and/or modify '
# it under the terms of the GNU Lesser General Public License as published by '
# the Free Software Foundation, either version 3 of the License, or '
# (at your option) any later version. '
# '
# geoh5py is distributed in the hope that it will be useful, '
# but WITHOUT ANY WARRANTY; without even the implied warranty of '
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the '
# GNU Lesser General Public License for more details. '
# '
# You should have received a copy of the GNU Lesser General Public License '
# along with geoh5py. If not, see <https://www.gnu.org/licenses/>. '
# ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
from __future__ import annotations
from typing import Any
from .data import Data, PrimitiveTypeEnum
[docs]
class BlobData(Data):
[docs]
@classmethod
def primitive_type(cls) -> PrimitiveTypeEnum:
return PrimitiveTypeEnum.BLOB
[docs]
def validate_values(self, values: Any | None) -> Any:
"""
Validate values for BlobData.
"""
if values is not None:
if not isinstance(values, bytes):
raise TypeError(f"Values must be of type bytes. Got {type(values)}")
return values
# TODO: implement specialization to access values.
# Stored as a 1D array of 8-bit char type (native) (value '0' or '1').
# For each index set to 1, an opaque data set named after the index (e.g. "1", "2", etc)
# must be added under the Data instance, containing the binary data tied to that index.
# No data value : 0