33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
import numpy as np
|
|
|
|
def load_coefficients(filepath):
|
|
"""
|
|
Load spectral coefficients from a full-format PROSAIL data file (e.g., dataSpec_PDB.txt).
|
|
|
|
Returns:
|
|
wl : ndarray, wavelength (nm)
|
|
nr : ndarray, refractive index of leaf material
|
|
Kab : ndarray, absorption coefficient of chlorophyll (a+b)
|
|
Kcar : ndarray, absorption coefficient of carotenoids
|
|
Kant : ndarray, absorption coefficient of anthocyanins
|
|
Kbrown : ndarray, absorption coefficient of brown pigments
|
|
Kw : ndarray, absorption coefficient of water
|
|
Km : ndarray, absorption coefficient of dry matter
|
|
Rsoil1 : ndarray, dry soil reflectance
|
|
Rsoil2 : ndarray, wet soil reflectance
|
|
"""
|
|
data = np.loadtxt(filepath, comments='%', delimiter=None)
|
|
|
|
wl = data[:, 0]
|
|
nr = data[:, 1]
|
|
Kab = data[:, 2]
|
|
Kcar = data[:, 3]
|
|
Kant = data[:, 4]
|
|
Kbrown = data[:, 5]
|
|
Kw = data[:, 6]
|
|
Km = data[:, 7]
|
|
Rsoil1 = data[:, 10]
|
|
Rsoil2 = data[:, 11]
|
|
|
|
return wl, nr, Kab, Kcar, Kant, Kbrown, Kw, Km, Rsoil1, Rsoil2
|