@@ -1927,10 +1927,10 @@ def dirint(ghi, solar_zenith, times, pressure=101325., use_delta_kt_prime=True,
19271927
19281928 Parameters
19291929 ----------
1930- ghi : array-like
1930+ ghi : numeric
19311931 Global horizontal irradiance. See :term:`ghi`. [Wm⁻²]
19321932
1933- solar_zenith : array-like
1933+ solar_zenith : numeric
19341934 True (not refraction-corrected) solar zenith angles. See
19351935 :term:`solar_zenith`. [°]
19361936
@@ -1964,9 +1964,9 @@ def dirint(ghi, solar_zenith, times, pressure=101325., use_delta_kt_prime=True,
19641964
19651965 Returns
19661966 -------
1967- dni : array-like
1968- The modeled direct normal irradiance, as provided by the
1969- DIRINT model . [Wm⁻²]
1967+ dni : numeric or pd.Series
1968+ Estimated direct normal irradiance. Returns float if all inputs
1969+ are scalar, pd.Series otherwise . [Wm⁻²]
19701970
19711971 Notes
19721972 -----
@@ -1983,7 +1983,8 @@ def dirint(ghi, solar_zenith, times, pressure=101325., use_delta_kt_prime=True,
19831983 Global Horizontal to Direct Normal Insolation", Technical Report No.
19841984 SERI/TR-215-3087, Golden, CO: Solar Energy Research Institute, 1987.
19851985 """
1986-
1986+ scalar_input = np .isscalar (solar_zenith )
1987+
19871988 disc_out = disc (ghi , solar_zenith , times , pressure = pressure ,
19881989 min_cos_zenith = min_cos_zenith , max_zenith = max_zenith )
19891990 airmass = disc_out ['airmass' ]
@@ -1998,9 +1999,12 @@ def dirint(ghi, solar_zenith, times, pressure=101325., use_delta_kt_prime=True,
19981999 dirint_coeffs = _dirint_coeffs (times , kt_prime , solar_zenith , w ,
19992000 delta_kt_prime )
20002001
2002+
20012003 # Perez eqn 5
20022004 dni = disc_out ['dni' ] * dirint_coeffs
20032005
2006+ if scalar_input :
2007+ return float (dni .iloc [0 ])
20042008 return dni
20052009
20062010
@@ -2160,6 +2164,7 @@ def _dirint_bins(times, kt_prime, zenith, w, delta_kt_prime):
21602164 return kt_prime_bin , zenith_bin , w_bin , delta_kt_prime_bin
21612165
21622166
2167+
21632168def dirindex (ghi , ghi_clear , dni_clear , zenith , times , pressure = 101325. ,
21642169 use_delta_kt_prime = True , temp_dew = None , min_cos_zenith = 0.065 ,
21652170 max_zenith = 87 ):
0 commit comments