1212import pandas as pd
1313
1414from pvlib import tools
15- from pvlib import irradiance
16- from pvlib import atmosphere
17- from pvlib import solarposition
1815
1916
2017def ineichen (apparent_zenith , airmass_absolute , linke_turbidity ,
21- dni_extra = 1364. , altitude = 0 ):
18+ altitude = 0 , dni_extra = 1364. ):
2219 '''
2320 Determine clear sky GHI, DNI, and DHI from Ineichen/Perez model.
2421
@@ -29,22 +26,26 @@ def ineichen(apparent_zenith, airmass_absolute, linke_turbidity,
2926 report on clear sky models found the Ineichen/Perez model to have
3027 excellent performance with a minimal input data set [3].
3128
32- Default values for montly Linke turbidity provided by SoDa [4, 5].
29+ Default values for monthly Linke turbidity provided by SoDa [4, 5].
3330
3431 Parameters
3532 -----------
3633 apparent_zenith: numeric
34+ Refraction corrected solar zenith angle in degrees.
3735
3836 airmass_absolute: numeric
37+ Pressure corrected airmass.
3938
4039 linke_turbidity: numeric
40+ Linke Turbidity.
41+
42+ altitude: numeric
43+ Altitude above sea level in meters.
4144
4245 dni_extra: numeric
4346 Extraterrestrial irradiance. The units of ``dni_extra``
4447 determine the units of the output.
4548
46- altitude: numeric
47-
4849 Returns
4950 -------
5051 clearsky : DataFrame (if Series input) or OrderedDict of arrays
@@ -125,15 +126,15 @@ def ineichen(apparent_zenith, airmass_absolute, linke_turbidity,
125126
126127 # BncI = "normal beam clear sky radiation"
127128 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 )
130131
131132 # "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 )) /
133134 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 )
135136
136- dni = np .minimum (BncI , BncI_2 )
137+ dni = np .minimum (bnci , bnci_2 )
137138
138139 dhi = ghi - dni * cos_zenith
139140
@@ -222,9 +223,9 @@ def lookup_linke_turbidity(time, latitude, longitude, filepath=None,
222223 linke_turbidity = pd .Series (np .interp (time .dayofyear , days , g2 ),
223224 index = time )
224225 else :
225- apply_month = lambda x : g [x [0 ]- 1 ]
226226 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 )
228229
229230 linke_turbidity /= 20.
230231
@@ -271,11 +272,11 @@ def haurwitz(apparent_zenith):
271272
272273 cos_zenith = tools .cosd (apparent_zenith )
273274
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 )
275276
276- clearsky_GHI [ clearsky_GHI < 0 ] = 0
277+ clearsky_ghi [ clearsky_ghi < 0 ] = 0
277278
278- df_out = pd .DataFrame ({'ghi' :clearsky_GHI })
279+ df_out = pd .DataFrame ({'ghi' : clearsky_ghi })
279280
280281 return df_out
281282
@@ -285,8 +286,8 @@ def _linearly_scale(inputmatrix, inputmin, inputmax, outputmin, outputmax):
285286
286287 inputrange = inputmax - inputmin
287288 outputrange = outputmax - outputmin
288- OutputMatrix = (inputmatrix - inputmin ) * outputrange / inputrange + outputmin
289- return OutputMatrix
289+ outputmatrix = (inputmatrix - inputmin ) * outputrange / inputrange + outputmin
290+ return outputmatrix
290291
291292
292293def simplified_solis (apparent_elevation , aod700 = 0.1 , precipitable_water = 1. ,
0 commit comments