Repository navigation
Expand file tree
/
Copy pathLeafSIP.py
More file actions
97 lines (73 loc) · 3.03 KB
/
Copy pathLeafSIP.py
File metadata and controls
97 lines (73 loc) · 3.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
"""
Created on Fri Jan 21 2022
@author: Fujiang Ji
"""
import numpy as np
import sys
import os
import pandas as pd
import matplotlib.pyplot as plt
from numpy import exp, log, sin, pi
from scipy.special import expn
def Leaf_SIP_model(Cab,Ccar,Cbrw,Cw,Cm,Cant):
Cab = Cab #Chlorophyll (a+b)(cm-2.microg)
Ccar = Ccar #Carotenoids (cm-2.microg)
Cbrw = Cbrw #Brown pigments (arbitrary units)[0-1]
Cw = Cw #Water (cm)
Cm = Cm #Dry matter (cm-2.g)
Cant = Cant #Anthocyanins (cm-2.microg)
alpha = 600 # constant for the the optimal size of the leaf scattering element
data = pd.read_csv('dataSpec_PDB.csv')#%Get coefficients (Ks) for leaf bioparameters
lamda = data['lambda']# wavelengths
nr = data['nr']# refractive index
Kab = data['Kab']# K for chlorophyll (a+b) content
Kcar = data['Kcar']# K for carotenoids
Kant = data['Kant'] # K for anthocyanins
Kbrw = data['Kbrw']# K for brown pigments
Kw = data['Kw'] # K for water
Km = data['Km']# K for dry matter
kall = (Cab*Kab + Ccar*Kcar + Cant*Kant + Cbrw*Kbrw + Cw*Kw + Cm*Km)/(Cm*alpha)
w0 = np.exp(-kall)
# spectral invariant parameters
fLMA = 2765.0*Cm
gLMA = 102.8 *Cm
p = 1-(1 - np.exp(-fLMA))/fLMA
q = 1- 2 * np.exp(-gLMA)
qabs = np.sqrt(q**2)
# leaf single scattering albedo
w = w0*(1-p)/(1-p*w0)
# leaf reflectance and leaf transmittance
refl = w*(1/2+q/2*(1-p*w0)/(1-qabs*p*w0))
trans = w*(1/2-q/2*(1-p*w0)/(1-qabs*p*w0))
return [refl, trans]
def Leaf_SIP_model_Calibrated_pq(Cab,Ccar,Cbrw,Cw,Cm,Cant):
Cab = Cab #Chlorophyll (a+b)(cm-2.microg)
Ccar = Ccar #Carotenoids (cm-2.microg)
Cbrw = Cbrw #Brown pigments (arbitrary units)[0-1]
Cw = Cw #Water (cm)
Cm = Cm #Dry matter (cm-2.g)
Cant = Cant #Anthocyanins (cm-2.microg)
alpha = 600 # constant for the the optimal size of the leaf scattering element
data = pd.read_csv('/scratch/fji7/transfer_learning_paper/4_src_code/dataSpec_PDB.csv')#%Get coefficients (Ks) for leaf bioparameters
lamda = data['lambda']# wavelengths
nr = data['nr']# refractive index
Kab = data['Kab']# K for chlorophyll (a+b) content
Kcar = data['Kcar']# K for carotenoids
Kant = data['Kant'] # K for anthocyanins
Kbrw = data['Kbrw']# K for brown pigments
Kw = data['Kw'] # K for water
Km = data['Km']# K for dry matter
kall = (Cab*Kab + Ccar*Kcar + Cant*Kant + Cbrw*Kbrw + Cw*Kw + Cm*Km)/(Cm*alpha)
w0 = np.exp(-kall)
# spectral invariant parameters
fLMA = 2519.64832573*Cm
gLMA = -631.5441990240528*(Cm - 0.006443637536132927)
p = 1-(1 - np.exp(-fLMA))/fLMA
q = 2/(1+ np.exp(gLMA)) - 1
qabs = np.sqrt(q**2)
# leaf single scattering albedo
w = w0*(1-p)/(1-p*w0)
# leaf reflectance and leaf transmittance
refl = w*(1/2+q/2*(1-p*w0)/(1-qabs*p*w0))
trans = w*(1/2-q/2*(1-p*w0)/(1-qabs*p*w0))
return [refl, trans]