ftag.hdf5.h5utils#
Functions#
|
Return a dtype based on an existing dataset and requested variables. |
|
Cast float type to half or full precision. |
|
Join a list of structured numpy arrays. |
Module Contents#
- ftag.hdf5.h5utils.get_dtype(ds, variables: list[str] | None = None, precision: str | None = None, transform: ftag.transform.Transform | None = None, full_precision_vars: list[str] | None = None) numpy.dtype #
Return a dtype based on an existing dataset and requested variables.
- Parameters:
ds (h5py.Dataset) – Input h5 dataset
variables (list[str] | None, optional) – List of variables to include in dtype, by default None
precision (str | None, optional) – Precision to cast floats to, “half” or “full”, by default None
transform (Transform | None, optional) – Transform to apply to variables names, by default None
full_precision_vars (list[str] | None, optional) – List of variables to keep in full precision, by default None
- Returns:
Output dtype
- Return type:
np.dtype
- Raises:
ValueError – If variables are not found in dataset
- ftag.hdf5.h5utils.cast_dtype(typestr: str, precision: str) numpy.dtype #
Cast float type to half or full precision.
- Parameters:
typestr (str) – Input type string
precision (str) – Precision to cast to, “half” or “full”
- Returns:
Output dtype
- Return type:
np.dtype
- Raises:
ValueError – If precision is not “half” or “full”
- ftag.hdf5.h5utils.join_structured_arrays(arrays: list)#
Join a list of structured numpy arrays.
See numpy/numpy#7811
- Parameters:
arrays (list) – List of structured numpy arrays to join
- Returns:
A merged structured array
- Return type:
np.array