- Home
- Documentation
- API reference
- Spectral
- hyperproc.spectral.bands
hyperproc.spectral.bands¶
Source-derived reference
Generated from the current hyperproc 0.1.2 checkout.
Implementation: hyperproc/spectral/bands.py. Signatures, defaults, docstrings, and expandable source are extracted statically; the module is not imported or executed. Names beginning with _ are implementation details, not a stable public API.
Use the function signature as the authority for individual parameter defaults and return annotations. Original docstrings sometimes group parameter names or wrap return descriptions across lines; these descriptions are preserved rather than inferred or rewritten.
Exported entry points¶
| Importable name | Definition |
|---|---|
hyperproc.spectral.bands.TOLERANCE |
hyperproc.spectral.bands.TOLERANCE |
hyperproc.spectral.bands.band_at |
hyperproc.spectral.bands.band_at |
hyperproc.spectral.bands.runs_of_good_bands |
hyperproc.spectral.bands.runs_of_good_bands |
hyperproc.spectral.bands.good_bands |
hyperproc.spectral.bands.good_bands |
Addressing bands by wavelength, and the runs of usable bands.
Everything spectral in this package is addressed by wavelength, never by
band number. That is the difference between an operation that ports across
sensors and one that quietly moves when the instrument changes: R860 means
the band nearest 860 nm on whatever is in hand, and asking for a wavelength a
sensor does not cover fails loudly rather than returning the wrong band.
:func:runs_of_good_bands is the other half. A hyperspectral spectrum is not
one continuous signal: the water-vapour regions are unusable, and a filter, a
hull or a derivative that reaches across such a gap measures the gap. Every
function in this subpackage works inside the runs this returns.
TOLERANCE = 20.0
module-attribute
¶
good_bands(ds: xr.Dataset, good_only: bool = True) -> np.ndarray
¶
Boolean mask of usable bands, all True when the dataset flags none.
Source code in hyperproc/spectral/bands.py
runs_of_good_bands(good: np.ndarray, min_len: int) -> list
¶
Index ranges of consecutive usable bands at least min_len long.
Source code in hyperproc/spectral/bands.py
band_at(ds: xr.Dataset, wavelength: float, var: str | None = None, tolerance: float = TOLERANCE, good_only: bool = True) -> xr.DataArray
¶
The band nearest wavelength nm.
| PARAMETER | DESCRIPTION |
|---|---|
ds
|
dataset with a wavelength cube.
TYPE:
|
wavelength
|
what to look for, nm.
TYPE:
|
var
|
variable name; the main cube by default.
TYPE:
|
tolerance
|
how far the nearest band may sit from the request.
TYPE:
|
good_only
|
ignore bands flagged unusable by
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataArray
|
The 2-D slice, with |
DataArray
|
wavelength in its attrs. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
nothing lies within |