Envi¶
Module: spectralbridge.envi.
Lightweight ENVI header parsing and cube reading utilities.
API glossary ยท Workflow / scientific context
Signatures and documentation below are collected from the current source. Advanced objects are not newly declared stable by inclusion here.
Audience: advanced.
hdr_to_dict ¶
hdr_to_dict(hdr_path: Path) -> dict[str, Any]
Parse an ENVI header, tolerating absent or unparseable wavelength lists where supported.
Audience: advanced.
band_axis_from_header ¶
band_axis_from_header(arr: ndarray, hdr: dict[str, Any]) -> int
Locate a band-count-matching axis, falling back to the last axis for unmatched three-dimensional arrays.
Audience: advanced.
wavelength_array ¶
wavelength_array(header_dict: dict[str, Any]) -> np.ndarray | None
Read numeric wavelength metadata as an array, returning None when absent or unparseable.
Audience: advanced.
memmap_bsq ¶
memmap_bsq(img_path: Path, header: dict[str, Any]) -> np.memmap
Open a read-only BSQ memory map shaped (bands, lines, samples) with header-declared dtype and byte order.
Audience: advanced.
read_envi_cube ¶
read_envi_cube(img_path: Path, header: dict[str, Any] | None = None) -> np.ndarray
Read a BSQ ENVI image as float32 in (bands, lines, samples) order without reflectance rescaling.
Audience: advanced.
to_unitless_reflectance ¶
to_unitless_reflectance(arr: ndarray) -> np.ndarray
Apply the legacy median heuristic: divide by 10000 when the finite median exceeds 1.5.