psi_io

psi_io#

Routines for reading/writing PSI style HDF5 and HDF4 data files.

Written by Ronald M. Caplan, Ryder Davidson, & Cooper Downs.

2023/09: Start with SVN version r454, 2023/09/12 by RC, Predictive Science Inc.

2024/06: CD: add the get_scales subroutines.

2024/11: RD: Major Update: Add several generic data loading capabilites for faster IO.
  • Read only the portions of data required (read_hdf_by_index, read_hdf_by_value).

  • Interpolate to slices along a given axes (np_interpolate_slice_from_hdf) or generic positions (interpolate_positions_from_hdf).

2025/06: CD: Prep for integration into psi-io package, HDF4 is now optional.

2026/01: RD: Refactor legacy routines to use new generic routines where possible.

Classes

HdfDataMeta(name, type, shape, scales)

Named tuple for HDF dataset metadata

HdfScaleMeta(name, type, shape, imin, imax)

Named tuples for HDF metadata

Functions

get_scales_1d(filename)

Wrapper to return the scales of a 1D PSI style HDF5 or HDF4 dataset.

get_scales_2d(filename)

Wrapper to return the scales of a 2D PSI style HDF5 or HDF4 dataset.

get_scales_3d(filename)

Wrapper to return the scales of a 3D PSI style HDF5 or HDF4 dataset.

instantiate_linear_interpolator(*args, **kwargs)

Instantiate a linear interpolator using the provided data and scales.

interpolate_point_from_1d_slice(xi, scalex, ...)

Interpolate a point from a 1D slice using linear interpolation.

interpolate_point_from_2d_slice(xi, yi, ...)

Interpolate a point from a 2D slice using bilinear interpolation.

interpolate_positions_from_hdf(ifile, *xi, ...)

Interpolate at a list of scale positions using SciPy's RegularGridInterpolator.

np_interpolate_slice_from_hdf(ifile, /, *xi)

Interpolate a slice from HDF data using linear interpolation.

rdhdf_1d(hdf_filename)

Read a 1D PSI-style HDF5 or HDF4 file.

rdhdf_2d(hdf_filename)

Read a 2D PSI-style HDF5 or HDF4 file.

rdhdf_3d(hdf_filename)

Read a 3D PSI-style HDF5 or HDF4 file.

read_hdf_by_index(ifile, /, *xi[, ...])

Read data from an HDF4 (.hdf) or HDF5 (.h5) file by index.

read_hdf_by_ivalue(ifile, /, *xi[, ...])

Read data from an HDF4 (.hdf) or HDF5 (.h5) file by value.

read_hdf_by_value(ifile, /, *xi[, ...])

Read data from an HDF4 (.hdf) or HDF5 (.h5) file by value.

read_hdf_data(ifile, /[, dataset_id, ...])

Read data from an HDF4 (.hdf) or HDF5 (.h5) file.

read_hdf_meta(ifile, /[, dataset_id])

Read metadata from an HDF4 (.hdf) or HDF5 (.h5) file.

read_rtp_meta(ifile, /)

Read the scale metadata for PSI's 3D cubes.

sp_interpolate_slice_from_hdf(*xi, **kwargs)

Interpolate a slice from HDF data using SciPy's RegularGridInterpolator.

wrhdf_1d(hdf_filename, x, f)

Write a 1D PSI-style HDF5 or HDF4 file.

wrhdf_2d(hdf_filename, x, y, f)

Write a 2D PSI-style HDF5 or HDF4 file.

wrhdf_3d(hdf_filename, x, y, z, f)

Write a 3D PSI-style HDF5 or HDF4 file.

write_hdf_data(ifile, /, data, *scales[, ...])

Write data to an HDF4 (.hdf) or HDF5 (.h5) file.

Attributes

HDFEXT

Set of possible HDF file extensions

HdfExtType

Type alias for possible HDF file extensions

PSI_DATA_ID

Mapping of PSI standard dataset names for HDF4 and HDF5 files

PSI_SCALE_ID

Mapping of PSI standard scale names for HDF4 and HDF5 files

SDC_TYPE_CONVERSIONS

Helper dictionary for mapping HDF4 types to numpy dtypes