This function extracts a single reflectance band that is the closest to a user defined wavelength from a hyperspectral datacube,
which is a
Spectral_data class instance created while reading in with
mode='envi'. This function is similar to the
pcv.hyperspectral.extract_index function which calculates
and outputs standard spectral indices from a hyperspectral datacube.
returns index array (instance of the
- spectral_data - Hyperspectral data instance
- wavelength - Target wavelength value for band for extraction
- This function will print out which wavelength was found to be closest to the target wavelength value input. Additionally, this metadata is available since the function outputs a spectral data class instance which has a method that stores the array type.
from plantcv import plantcv as pcv # Set global debug behavior to None (default), "print" (to file), # or "plot" (Jupyter Notebooks or X11) pcv.params.debug = "print" # Many plants absorb 430nm wavelength light. blue_array_obj = pcv.hyperspectral.extract_wavelength(spectral_data=spectral_array_obj, wavelength=430) blue_array_obj.array_type
> The closest band found to 400nm is: 400.033
Grayscale array image
Source Code: Here