@@ -1085,7 +1085,7 @@ def perez(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
1085
1085
return sky_diffuse
1086
1086
1087
1087
1088
- def disc (ghi , zenith , times , pressure = 101325 ):
1088
+ def disc (ghi , zenith , datetime_or_doy , pressure = 101325 ):
1089
1089
"""
1090
1090
Estimate Direct Normal Irradiance from Global Horizontal Irradiance
1091
1091
using the DISC model.
@@ -1103,7 +1103,9 @@ def disc(ghi, zenith, times, pressure=101325):
1103
1103
True (not refraction-corrected) solar zenith angles in decimal
1104
1104
degrees.
1105
1105
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.
1107
1109
1108
1110
pressure : numeric
1109
1111
Site pressure in Pascal.
@@ -1138,18 +1140,7 @@ def disc(ghi, zenith, times, pressure=101325):
1138
1140
dirint
1139
1141
"""
1140
1142
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' )
1153
1144
I0h = I0 * np .cos (np .radians (zenith ))
1154
1145
1155
1146
am = atmosphere .relativeairmass (zenith , model = 'kasten1966' )
@@ -1186,8 +1177,8 @@ def disc(ghi, zenith, times, pressure=101325):
1186
1177
output ['kt' ] = kt
1187
1178
output ['airmass' ] = am
1188
1179
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 )
1191
1182
1192
1183
return output
1193
1184
0 commit comments