Skip to content

Commit b6d5d23

Browse files
committed
fix bad rebase
1 parent 5c8a541 commit b6d5d23

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

pvlib/irradiance.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,7 +1085,7 @@ def perez(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
10851085
return sky_diffuse
10861086

10871087

1088-
def disc(ghi, zenith, times, pressure=101325):
1088+
def disc(ghi, zenith, datetime_or_doy, pressure=101325):
10891089
"""
10901090
Estimate Direct Normal Irradiance from Global Horizontal Irradiance
10911091
using the DISC model.
@@ -1103,7 +1103,9 @@ def disc(ghi, zenith, times, pressure=101325):
11031103
True (not refraction-corrected) solar zenith angles in decimal
11041104
degrees.
11051105
1106-
times : DatetimeIndex
1106+
datetime_or_doy : int, float, array, pd.DatetimeIndex
1107+
Day of year or array of days of year e.g.
1108+
pd.DatetimeIndex.dayofyear, or pd.DatetimeIndex.
11071109
11081110
pressure : numeric
11091111
Site pressure in Pascal.
@@ -1138,18 +1140,7 @@ def disc(ghi, zenith, times, pressure=101325):
11381140
dirint
11391141
"""
11401142

1141-
# in principle, the dni_extra calculation could be done by
1142-
# pvlib's function. However, this is the algorithm used in
1143-
# the DISC paper
1144-
1145-
doy = times.dayofyear
1146-
1147-
dayangle = 2. * np.pi*(doy - 1) / 365
1148-
1149-
re = (1.00011 + 0.034221*np.cos(dayangle) + 0.00128*np.sin(dayangle) +
1150-
0.000719*np.cos(2.*dayangle) + 7.7e-5*np.sin(2.*dayangle))
1151-
1152-
I0 = re * 1370.
1143+
I0 = extraradiation(datetime_or_doy, 1370, 'spencer')
11531144
I0h = I0 * np.cos(np.radians(zenith))
11541145

11551146
am = atmosphere.relativeairmass(zenith, model='kasten1966')
@@ -1186,8 +1177,8 @@ def disc(ghi, zenith, times, pressure=101325):
11861177
output['kt'] = kt
11871178
output['airmass'] = am
11881179

1189-
if isinstance(times, pd.DatetimeIndex):
1190-
output = pd.DataFrame(output, index=times)
1180+
if isinstance(datetime_or_doy, pd.DatetimeIndex):
1181+
output = pd.DataFrame(output, index=datetime_or_doy)
11911182

11921183
return output
11931184

0 commit comments

Comments
 (0)