12
12
import pandas as pd
13
13
14
14
from pvlib import tools
15
- from pvlib import irradiance
16
- from pvlib import atmosphere
17
- from pvlib import solarposition
18
15
19
16
20
17
def ineichen (apparent_zenith , airmass_absolute , linke_turbidity ,
21
- dni_extra = 1364. , altitude = 0 ):
18
+ altitude = 0 , dni_extra = 1364. ):
22
19
'''
23
20
Determine clear sky GHI, DNI, and DHI from Ineichen/Perez model.
24
21
@@ -29,22 +26,26 @@ def ineichen(apparent_zenith, airmass_absolute, linke_turbidity,
29
26
report on clear sky models found the Ineichen/Perez model to have
30
27
excellent performance with a minimal input data set [3].
31
28
32
- Default values for montly Linke turbidity provided by SoDa [4, 5].
29
+ Default values for monthly Linke turbidity provided by SoDa [4, 5].
33
30
34
31
Parameters
35
32
-----------
36
33
apparent_zenith: numeric
34
+ Refraction corrected solar zenith angle in degrees.
37
35
38
36
airmass_absolute: numeric
37
+ Pressure corrected airmass.
39
38
40
39
linke_turbidity: numeric
40
+ Linke Turbidity.
41
+
42
+ altitude: numeric
43
+ Altitude above sea level in meters.
41
44
42
45
dni_extra: numeric
43
46
Extraterrestrial irradiance. The units of ``dni_extra``
44
47
determine the units of the output.
45
48
46
- altitude: numeric
47
-
48
49
Returns
49
50
-------
50
51
clearsky : DataFrame (if Series input) or OrderedDict of arrays
@@ -125,15 +126,15 @@ def ineichen(apparent_zenith, airmass_absolute, linke_turbidity,
125
126
126
127
# BncI = "normal beam clear sky radiation"
127
128
b = 0.664 + 0.163 / fh1
128
- BncI = b * np .exp (- 0.09 * airmass_absolute * (tl - 1 ))
129
- BncI = dni_extra * np .fmax (BncI , 0 )
129
+ bnci = b * np .exp (- 0.09 * airmass_absolute * (tl - 1 ))
130
+ bnci = dni_extra * np .fmax (bnci , 0 )
130
131
131
132
# "empirical correction" SE 73, 157 & SE 73, 312.
132
- BncI_2 = ((1 - (0.1 - 0.2 * np .exp (- tl ))/ (0.1 + 0.882 / fh1 )) /
133
+ bnci_2 = ((1 - (0.1 - 0.2 * np .exp (- tl ))/ (0.1 + 0.882 / fh1 )) /
133
134
cos_zenith )
134
- BncI_2 = ghi * np .fmin (np .fmax (BncI_2 , 0 ), 1e20 )
135
+ bnci_2 = ghi * np .fmin (np .fmax (bnci_2 , 0 ), 1e20 )
135
136
136
- dni = np .minimum (BncI , BncI_2 )
137
+ dni = np .minimum (bnci , bnci_2 )
137
138
138
139
dhi = ghi - dni * cos_zenith
139
140
@@ -222,9 +223,9 @@ def lookup_linke_turbidity(time, latitude, longitude, filepath=None,
222
223
linke_turbidity = pd .Series (np .interp (time .dayofyear , days , g2 ),
223
224
index = time )
224
225
else :
225
- apply_month = lambda x : g [x [0 ]- 1 ]
226
226
linke_turbidity = pd .DataFrame (time .month , index = time )
227
- linke_turbidity = linke_turbidity .apply (apply_month , axis = 1 )
227
+ # apply monthly data
228
+ linke_turbidity = linke_turbidity .apply (lambda x : g [x [0 ]- 1 ], axis = 1 )
228
229
229
230
linke_turbidity /= 20.
230
231
@@ -271,11 +272,11 @@ def haurwitz(apparent_zenith):
271
272
272
273
cos_zenith = tools .cosd (apparent_zenith )
273
274
274
- clearsky_GHI = 1098.0 * cos_zenith * np .exp (- 0.059 / cos_zenith )
275
+ clearsky_ghi = 1098.0 * cos_zenith * np .exp (- 0.059 / cos_zenith )
275
276
276
- clearsky_GHI [ clearsky_GHI < 0 ] = 0
277
+ clearsky_ghi [ clearsky_ghi < 0 ] = 0
277
278
278
- df_out = pd .DataFrame ({'ghi' :clearsky_GHI })
279
+ df_out = pd .DataFrame ({'ghi' : clearsky_ghi })
279
280
280
281
return df_out
281
282
@@ -285,8 +286,8 @@ def _linearly_scale(inputmatrix, inputmin, inputmax, outputmin, outputmax):
285
286
286
287
inputrange = inputmax - inputmin
287
288
outputrange = outputmax - outputmin
288
- OutputMatrix = (inputmatrix - inputmin ) * outputrange / inputrange + outputmin
289
- return OutputMatrix
289
+ outputmatrix = (inputmatrix - inputmin ) * outputrange / inputrange + outputmin
290
+ return outputmatrix
290
291
291
292
292
293
def simplified_solis (apparent_elevation , aod700 = 0.1 , precipitable_water = 1. ,
0 commit comments