Utils
This module provides shared utility functions for raster operations.
Functions include path resolution for ENVI files, band extraction, and other common tasks.
compute_statistics(pixel_array)
Computes core summary statistics for a 1-dimensional numeric array utilizing a JIT-compiled pipeline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pixel_array
|
ndarray
|
A flat, contiguous array of isolated pixel intensity values cast to float64. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[float, float, float, float, float]
|
Tuple[float, float, float, float, float]: A structured sequence containing the median, mean, standard deviation, minimum, and maximum values respectively. |
Source code in src/phytospatial/raster/utils.py
extract_band_indices(src, bands)
Normalize band selection to a list of 1-based indices.
Source code in src/phytospatial/raster/utils.py
extract_band_names(src, indices)
Extract descriptions/names for specific bands.
Source code in src/phytospatial/raster/utils.py
map_wavelengths(parsed_wavelengths, required_wavelengths, max_tolerance=20.0)
Matches required formula variables to actual 1-based band indices based on wavelength proximity.
Source code in src/phytospatial/raster/utils.py
resolve_envi_path(path)
Resolve ENVI header/binary file confusion. If 'image.hdr' is passed, redirects to 'image' (binary).