-
Notifications
You must be signed in to change notification settings - Fork 0
/
solweig_l_rads.py
166 lines (135 loc) · 8.27 KB
/
solweig_l_rads.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
##############################################################################################################################################
# Fucntions to estimate all longwave radiations for Solweig #
# source :https://github.com/UMEP-dev/UMEP/tree/SuPy-QGIS3/SOLWEIG/SOLWEIGpython #
# Goteborg Urban Climate Group #
# Gothenburg University #
# #
# #
# #
##############################################################################################################################################
import numpy as np
def Lvikt_veg(svf, svfveg, svfaveg, vikttot):
# Least
viktonlywall = (vikttot - (
63.227 * svf ** 6 - 161.51 * svf ** 5 + 156.91 * svf ** 4 - 70.424 * svf ** 3 + 16.773 * svf ** 2 - 0.4863 * svf)) / vikttot
viktaveg = (vikttot - (
63.227 * svfaveg ** 6 - 161.51 * svfaveg ** 5 + 156.91 * svfaveg ** 4 - 70.424 * svfaveg ** 3 + 16.773 * svfaveg ** 2 - 0.4863 * svfaveg)) / vikttot
viktwall = viktonlywall - viktaveg
svfvegbu = (svfveg + svf - 1) # Vegetation plus buildings
viktsky = (
63.227 * svfvegbu ** 6 - 161.51 * svfvegbu ** 5 + 156.91 * svfvegbu ** 4 - 70.424 * svfvegbu ** 3 + 16.773 * svfvegbu ** 2 - 0.4863 * svfvegbu) / vikttot
viktrefl = (vikttot - (
63.227 * svfvegbu ** 6 - 161.51 * svfvegbu ** 5 + 156.91 * svfvegbu ** 4 - 70.424 * svfvegbu ** 3 + 16.773 * svfvegbu ** 2 - 0.4863 * svfvegbu)) / vikttot
viktveg = (vikttot - (
63.227 * svfvegbu ** 6 - 161.51 * svfvegbu ** 5 + 156.91 * svfvegbu ** 4 - 70.424 * svfvegbu ** 3 + 16.773 * svfvegbu ** 2 - 0.4863 * svfvegbu)) / vikttot
viktveg = viktveg - viktwall
return viktveg, viktwall, viktsky, viktrefl
def Lside_veg_v2015a(svfS, svfW, svfN, svfE, svfEveg, svfSveg, svfWveg, svfNveg, svfEaveg, svfSaveg, svfWaveg, svfNaveg,
azimuth, altitude, Ta, Tw, SBC, ewall, Ldown, esky, t, F_sh, CI, LupE, LupS, LupW, LupN):
# This m-file is the current one that estimates L from the four cardinal points 20100414
# Building height angle from svf
svfalfaE = np.arcsin(np.exp((np.log(1 - svfE)) / 2))
svfalfaS = np.arcsin(np.exp((np.log(1 - svfS)) / 2))
svfalfaW = np.arcsin(np.exp((np.log(1 - svfW)) / 2))
svfalfaN = np.arcsin(np.exp((np.log(1 - svfN)) / 2))
vikttot = 4.4897
aziW = azimuth + t
aziN = azimuth - 90 + t
aziE = azimuth - 180 + t
aziS = azimuth - 270 + t
F_sh = 2 * F_sh - 1 # (cylindric_wedge scaled 0-1)
c = 1 - CI
Lsky_allsky = esky * SBC * ((Ta + 273.15) ** 4) * (1 - c) + c * SBC * ((Ta + 273.15) ** 4)
## Least
[viktveg, viktwall, viktsky, viktrefl] = Lvikt_veg(svfE, svfEveg, svfEaveg, vikttot)
if altitude > 0: # daytime
alfaB = np.arctan(svfalfaE)
betaB = np.arctan(np.tan((svfalfaE) * F_sh))
betasun = ((alfaB - betaB) / 2) + betaB
# betasun = np.arctan(0.5*np.tan(svfalfaE)*(1+F_sh)) #TODO This should be considered in future versions
if (azimuth > (180 - t)) and (azimuth <= (360 - t)):
Lwallsun = SBC * ewall * ((Ta + 273.15 + Tw * np.sin(aziE * (np.pi / 180))) ** 4) * \
viktwall * (1 - F_sh) * np.cos(betasun) * 0.5
Lwallsh = SBC * ewall * ((Ta + 273.15) ** 4) * viktwall * F_sh * 0.5
else:
Lwallsun = 0
Lwallsh = SBC * ewall * ((Ta + 273.15) ** 4) * viktwall * 0.5
else: # nighttime
Lwallsun = 0
Lwallsh = SBC * ewall * ((Ta + 273.15) ** 4) * viktwall * 0.5
Lsky = ((svfE + svfEveg - 1) * Lsky_allsky) * viktsky * 0.5
Lveg = SBC * ewall * ((Ta + 273.15) ** 4) * viktveg * 0.5
Lground = LupE * 0.5
Lrefl = (Ldown + LupE) * (viktrefl) * (1 - ewall) * 0.5
Least = Lsky + Lwallsun + Lwallsh + Lveg + Lground + Lrefl
# clear alfaB betaB betasun Lsky Lwallsh Lwallsun Lveg Lground Lrefl viktveg viktwall viktsky
## Lsouth
[viktveg, viktwall, viktsky, viktrefl] = Lvikt_veg(svfS, svfSveg, svfSaveg, vikttot)
if altitude > 0: # daytime
alfaB = np.arctan(svfalfaS)
betaB = np.arctan(np.tan((svfalfaS) * F_sh))
betasun = ((alfaB - betaB) / 2) + betaB
# betasun = np.arctan(0.5*np.tan(svfalfaS)*(1+F_sh))
if (azimuth <= (90 - t)) or (azimuth > (270 - t)):
Lwallsun = SBC * ewall * ((Ta + 273.15 + Tw * np.sin(aziS * (np.pi / 180))) ** 4) * \
viktwall * (1 - F_sh) * np.cos(betasun) * 0.5
Lwallsh = SBC * ewall * ((Ta + 273.15) ** 4) * viktwall * F_sh * 0.5
else:
Lwallsun = 0
Lwallsh = SBC * ewall * ((Ta + 273.15) ** 4) * viktwall * 0.5
else: # nighttime
Lwallsun = 0
Lwallsh = SBC * ewall * ((Ta + 273.15) ** 4) * viktwall * 0.5
Lsky = ((svfS + svfSveg - 1) * Lsky_allsky) * viktsky * 0.5
Lveg = SBC * ewall * ((Ta + 273.15) ** 4) * viktveg * 0.5
Lground = LupS * 0.5
Lrefl = (Ldown + LupS) * (viktrefl) * (1 - ewall) * 0.5
Lsouth = Lsky + Lwallsun + Lwallsh + Lveg + Lground + Lrefl
# clear alfaB betaB betasun Lsky Lwallsh Lwallsun Lveg Lground Lrefl viktveg viktwall viktsky
## Lwest
[viktveg, viktwall, viktsky, viktrefl] = Lvikt_veg(svfW, svfWveg, svfWaveg, vikttot)
if altitude > 0: # daytime
alfaB = np.arctan(svfalfaW)
betaB = np.arctan(np.tan((svfalfaW) * F_sh))
betasun = ((alfaB - betaB) / 2) + betaB
# betasun = np.arctan(0.5*np.tan(svfalfaW)*(1+F_sh))
if (azimuth > (360 - t)) or (azimuth <= (180 - t)):
Lwallsun = SBC * ewall * ((Ta + 273.15 + Tw * np.sin(aziW * (np.pi / 180))) ** 4) * \
viktwall * (1 - F_sh) * np.cos(betasun) * 0.5
Lwallsh = SBC * ewall * ((Ta + 273.15) ** 4) * viktwall * F_sh * 0.5
else:
Lwallsun = 0
Lwallsh = SBC * ewall * ((Ta + 273.15) ** 4) * viktwall * 0.5
else: # nighttime
Lwallsun = 0
Lwallsh = SBC * ewall * ((Ta + 273.15) ** 4) * viktwall * 0.5
Lsky = ((svfW + svfWveg - 1) * Lsky_allsky) * viktsky * 0.5
Lveg = SBC * ewall * ((Ta + 273.15) ** 4) * viktveg * 0.5
Lground = LupW * 0.5
Lrefl = (Ldown + LupW) * (viktrefl) * (1 - ewall) * 0.5
Lwest = Lsky + Lwallsun + Lwallsh + Lveg + Lground + Lrefl
# clear alfaB betaB betasun Lsky Lwallsh Lwallsun Lveg Lground Lrefl viktveg viktwall viktsky
## Lnorth
[viktveg, viktwall, viktsky, viktrefl] = Lvikt_veg(svfN, svfNveg, svfNaveg, vikttot)
if altitude > 0: # daytime
alfaB = np.arctan(svfalfaN)
betaB = np.arctan(np.tan((svfalfaN) * F_sh))
betasun = ((alfaB - betaB) / 2) + betaB
# betasun = np.arctan(0.5*np.tan(svfalfaN)*(1+F_sh))
if (azimuth > (90 - t)) and (azimuth <= (270 - t)):
Lwallsun = SBC * ewall * ((Ta + 273.15 + Tw * np.sin(aziN * (np.pi / 180))) ** 4) * \
viktwall * (1 - F_sh) * np.cos(betasun) * 0.5
Lwallsh = SBC * ewall * ((Ta + 273.15) ** 4) * viktwall * F_sh * 0.5
else:
Lwallsun = 0
Lwallsh = SBC * ewall * ((Ta + 273.15) ** 4) * viktwall * 0.5
else: # nighttime
Lwallsun = 0
Lwallsh = SBC * ewall * ((Ta + 273.15) ** 4) * viktwall * 0.5
Lsky = ((svfN + svfNveg - 1) * Lsky_allsky) * viktsky * 0.5
Lveg = SBC * ewall * ((Ta + 273.15) ** 4) * viktveg * 0.5
Lground = LupN * 0.5
Lrefl = (Ldown + LupN) * (viktrefl) * (1 - ewall) * 0.5
Lnorth = Lsky + Lwallsun + Lwallsh + Lveg + Lground + Lrefl
# clear alfaB betaB betasun Lsky Lwallsh Lwallsun Lveg Lground Lrefl viktveg viktwall viktsky
return Least, Lsouth, Lwest, Lnorth