@@ -49,13 +49,13 @@ def ineichen(time, location, linke_turbidity=None,
49
49
Sets the solar position algorithm.
50
50
See solarposition.get_solarposition()
51
51
52
- zenith_data : None or pandas. Series
52
+ zenith_data : None or Series
53
53
If None, ephemeris data will be calculated using ``solarposition_method``.
54
54
55
55
airmass_model : string
56
56
See pvlib.airmass.relativeairmass().
57
57
58
- airmass_data : None or pandas. Series
58
+ airmass_data : None or Series
59
59
If None, absolute air mass data will be calculated using
60
60
``airmass_model`` and location.alitude.
61
61
@@ -65,14 +65,14 @@ def ineichen(time, location, linke_turbidity=None,
65
65
66
66
Returns
67
67
--------
68
- DataFrame with the following columns: ``GHI, DNI, DHI ``.
68
+ DataFrame with the following columns: ``ghi, dni, dhi ``.
69
69
70
70
Notes
71
71
-----
72
72
If you are using this function
73
73
in a loop, it may be faster to load LinkeTurbidities.mat outside of
74
- the loop and feed it in as a variable , rather than
75
- having the function open the file each time it is called.
74
+ the loop and feed it in as a keyword argument , rather than
75
+ having the function open and process the file each time it is called.
76
76
77
77
References
78
78
----------
@@ -96,7 +96,7 @@ def ineichen(time, location, linke_turbidity=None,
96
96
'''
97
97
# Initial implementation of this algorithm by Matthew Reno.
98
98
# Ported to python by Rob Andrews
99
- # Added functionality by Will Holmgren
99
+ # Added functionality by Will Holmgren (@wholmgren)
100
100
101
101
I0 = irradiance .extraradiation (time .dayofyear )
102
102
@@ -161,7 +161,7 @@ def ineichen(time, location, linke_turbidity=None,
161
161
# alt2pres) using Kasten and Young's 1989 formula for airmass.
162
162
163
163
if airmass_data is None :
164
- AMabsolute = atmosphere .absoluteairmass (AMrelative = atmosphere .relativeairmass (ApparentZenith , airmass_model ),
164
+ AMabsolute = atmosphere .absoluteairmass (airmass_relative = atmosphere .relativeairmass (ApparentZenith , airmass_model ),
165
165
pressure = atmosphere .alt2pres (location .altitude ))
166
166
else :
167
167
AMabsolute = airmass_data
@@ -195,7 +195,9 @@ def ineichen(time, location, linke_turbidity=None,
195
195
196
196
cos_zenith = tools .cosd (ApparentZenith )
197
197
198
- clearsky_GHI = cg1 * I0 * cos_zenith * np .exp (- cg2 * AMabsolute * (fh1 + fh2 * (TL - 1 ))) * np .exp (0.01 * AMabsolute ** 1.8 )
198
+ clearsky_GHI = ( cg1 * I0 * cos_zenith *
199
+ np .exp (- cg2 * AMabsolute * (fh1 + fh2 * (TL - 1 ))) *
200
+ np .exp (0.01 * AMabsolute ** 1.8 ) )
199
201
clearsky_GHI [clearsky_GHI < 0 ] = 0
200
202
201
203
# BncI == "normal beam clear sky radiation"
@@ -204,25 +206,24 @@ def ineichen(time, location, linke_turbidity=None,
204
206
logger .debug ('b={}' .format (b ))
205
207
206
208
# "empirical correction" SE 73, 157 & SE 73, 312.
207
- BncI_2 = clearsky_GHI * ( 1 - (0.1 - 0.2 * np .exp (- TL ))/ (0.1 + 0.882 / fh1 ) ) / cos_zenith
208
- #return BncI, BncI_2
209
- clearsky_DNI = np .minimum (BncI , BncI_2 ) # Will H: use np.minimum explicitly
209
+ BncI_2 = ( clearsky_GHI *
210
+ ( 1 - (0.1 - 0.2 * np .exp (- TL ))/ (0.1 + 0.882 / fh1 ) ) /
211
+ cos_zenith )
212
+
213
+ clearsky_DNI = np .minimum (BncI , BncI_2 )
210
214
211
215
clearsky_DHI = clearsky_GHI - clearsky_DNI * cos_zenith
212
216
213
- df_out = pd .DataFrame ({'GHI ' :clearsky_GHI , 'DNI ' :clearsky_DNI ,
214
- 'DHI ' :clearsky_DHI })
217
+ df_out = pd .DataFrame ({'ghi ' :clearsky_GHI , 'dni ' :clearsky_DNI ,
218
+ 'dhi ' :clearsky_DHI })
215
219
df_out .fillna (0 , inplace = True )
216
- #df_out['BncI'] = BncI
217
- #df_out['BncI_2'] = BncI
218
220
219
221
return df_out
220
-
221
-
222
-
223
- def haurwitz (ApparentZenith ):
222
+
223
+
224
+ def haurwitz (apparent_zenith ):
224
225
'''
225
- Determine clear sky GHI from Haurwitz model
226
+ Determine clear sky GHI from Haurwitz model.
226
227
227
228
Implements the Haurwitz clear sky model for global horizontal
228
229
irradiance (GHI) as presented in [1, 2]. A report on clear
@@ -232,7 +233,7 @@ def haurwitz(ApparentZenith):
232
233
233
234
Parameters
234
235
----------
235
- ApparentZenith : DataFrame
236
+ apparent_zenith : Series
236
237
The apparent (refraction corrected) sun zenith angle
237
238
in degrees.
238
239
@@ -258,13 +259,13 @@ def haurwitz(ApparentZenith):
258
259
Laboratories, SAND2012-2389, 2012.
259
260
'''
260
261
261
- cos_zenith = tools .cosd (ApparentZenith )
262
+ cos_zenith = tools .cosd (apparent_zenith )
262
263
263
264
clearsky_GHI = 1098.0 * cos_zenith * np .exp (- 0.059 / cos_zenith )
264
265
265
266
clearsky_GHI [clearsky_GHI < 0 ] = 0
266
267
267
- df_out = pd .DataFrame ({'GHI ' :clearsky_GHI })
268
+ df_out = pd .DataFrame ({'ghi ' :clearsky_GHI })
268
269
269
270
return df_out
270
271
@@ -274,5 +275,5 @@ def _linearly_scale(inputmatrix, inputmin, inputmax, outputmin, outputmax):
274
275
275
276
inputrange = inputmax - inputmin
276
277
outputrange = outputmax - outputmin
277
- OutputMatrix = (inputmatrix - inputmin ) * outputrange / inputrange + outputmin
278
+ OutputMatrix = (inputmatrix - inputmin ) * outputrange / inputrange + outputmin
278
279
return OutputMatrix
0 commit comments