Skip to content

Commit 5252d22

Browse files
committed
reorder kwargs. pep8
1 parent a88fd8d commit 5252d22

File tree

4 files changed

+26
-24
lines changed

4 files changed

+26
-24
lines changed

pvlib/clearsky.py

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,10 @@
1212
import pandas as pd
1313

1414
from pvlib import tools
15-
from pvlib import irradiance
16-
from pvlib import atmosphere
17-
from pvlib import solarposition
1815

1916

2017
def 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

292293
def simplified_solis(apparent_elevation, aod700=0.1, precipitable_water=1.,

pvlib/location.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ def get_clearsky(self, times, model='ineichen', solar_position=None,
224224
times, solar_position=solar_position)['airmass_absolute']
225225

226226
cs = clearsky.ineichen(apparent_zenith, airmass_absolute,
227-
linke_turbidity, dni_extra=dni_extra,
228-
altitude=self.altitude)
227+
linke_turbidity, altitude=self.altitude,
228+
dni_extra=dni_extra)
229229
elif model == 'haurwitz':
230230
cs = clearsky.haurwitz(apparent_zenith)
231231
elif model == 'simplified_solis':

pvlib/modelchain.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,9 @@ def basic_chain(times, latitude, longitude,
147147
solar_position['apparent_zenith'],
148148
airmass,
149149
linke_turbidity,
150-
dni_extra=dni_extra,
151-
altitude=altitude)
150+
altitude=altitude,
151+
dni_extra=dni_extra
152+
)
152153

153154
total_irrad = pvlib.irradiance.total_irrad(
154155
surface_tilt,

pvlib/test/test_clearsky.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def test_ineichen_nans():
7575
expected['dhi'][length-1] = 121.2299
7676

7777
out = clearsky.ineichen(apparent_zenith, airmass_absolute,
78-
linke_turbidity, dni_extra)
78+
linke_turbidity, dni_extra=dni_extra)
7979

8080
for k, v in expected.items():
8181
assert_allclose(expected[k], out[k])

0 commit comments

Comments
 (0)