-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gilerson_Chl_Alg.py
115 lines (71 loc) · 3.38 KB
/
Gilerson_Chl_Alg.py
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
''' Module for Gilerson Chl algorithms (rrs-based and rhos-based)
author: jpscott6, 2018.05.08
'''
#==========================================================================================================================================
def calc_kd_rhos(rhos_442, rhos_490, rhos_620, rhos_665, rhos_865):
#Kd calculation with 865 correction applied
kd = (0.7 * ((((rhos_620 + rhos_665) / 2.) - rhos_865) / (((rhos_442 + rhos_490) / 2.) - rhos_865)))
#apply calibration
kd = (4.0 * kd) - 0.69
return kd
#==========================================================================================================================================
def calc_chl_rhos(rhos_442, rhos_490, rhos_620, rhos_665, rhos_709, rhos_865):
#Gilerson chl Rho_s
if (rhos_665 - rhos_865) == 0.0:
return float('nan')
else:
rel_chl = (rhos_709 - rhos_865) / (rhos_665 - rhos_865)
if rel_chl <= 19.30/35.75:
rel_chl = (19.30/35.75)
chl = ((35.75 * rel_chl) - 19.30) ** 1.124
#calculate and apply a correction in clear water based on kd where kd_min_threshold = 0.31
kd_min_threshold = 0.31
kd = calc_kd_rhos(rhos_442, rhos_490, rhos_620, rhos_665, rhos_865)
if (kd < kd_min_threshold) & (kd > 0):
chl = float('nan')
return chl
#==========================================================================================================================================
def calc_kd_rrs(rrs_442, rrs_490, rrs_620, rrs_665):
#Kd calculation
kd = (0.7 * (((rrs_620 + rrs_665) / 2.) / ((rrs_442 + rrs_490) / 2.)))
#apply calibration
kd = (4.0 * kd) - 0.69
return kd
#==========================================================================================================================================
def calc_chl_rrs(rrs_442, rrs_490, rrs_620, rrs_665, rrs_709):
#Gilerson chl rrs
if rrs_665 == 0.0:
return float('nan')
else:
rel_chl = (rrs_709 / rrs_665)
if rel_chl <= 19.30/35.75:
rel_chl = (19.30/35.75)
chl = ((35.75 * rel_chl) - 19.30) ** 1.124
#calculate and apply a correction in clear water based on kd where kd_min_threshold = 0.31
kd_min_threshold = 0.31
kd = calc_kd_rrs(rrs_442, rrs_490, rrs_620, rrs_665)
if (kd < kd_min_threshold) & (kd > 0):
chl = float('nan')
return chl
#==========================================================================================================================================
def calc_chl_rrs_2band(rrs_665, rrs_709):
#Gilerson 2010, advanced 2-band chl via rrs
if rrs_665 == 0.0:
return float('nan')
else:
rel_chl = (rrs_709 / rrs_665)
if rel_chl <= 19.30/35.75:
rel_chl = (19.30/35.75) #keeps chl from becoming complex if base is negative
chl = ((35.75 * rel_chl) - 19.30) ** 1.124
return chl
#==========================================================================================================================================
def calc_chl_rhos_2band(rhos_665, rhos_709, rhos_865):
#Gilerson chl Rho_s
if (rhos_665 - rhos_865) == 0.0:
return float('nan')
else:
rel_chl = (rhos_709 - rhos_865) / (rhos_665 - rhos_865)
if rel_chl <= 19.30/35.75:
rel_chl = (19.30/35.75)
chl = ((35.75 * rel_chl) - 19.30) ** 1.124
return chl