1616from pvlib import atmosphere , solarposition , tools
1717import pvlib # used to avoid dni name collision in complete_irradiance
1818
19- from pvlib ._deprecation import pvlibDeprecationWarning
19+ from pvlib ._deprecation import pvlibDeprecationWarning , deprecated
2020import warnings
2121
2222
@@ -132,7 +132,9 @@ def _handle_extra_radiation_types(datetime_or_doy, epoch_year):
132132 # a better way to do it.
133133 if isinstance (datetime_or_doy , pd .DatetimeIndex ):
134134 to_doy = tools ._pandas_to_doy # won't be evaluated unless necessary
135- def to_datetimeindex (x ): return x # noqa: E306
135+
136+ def to_datetimeindex (x ):
137+ return x # noqa: E306
136138 to_output = partial (pd .Series , index = datetime_or_doy )
137139 elif isinstance (datetime_or_doy , pd .Timestamp ):
138140 to_doy = tools ._pandas_to_doy
@@ -146,12 +148,14 @@ def to_datetimeindex(x): return x # noqa: E306
146148 tools ._datetimelike_scalar_to_datetimeindex
147149 to_output = tools ._scalar_out
148150 elif np .isscalar (datetime_or_doy ): # ints and floats of various types
149- def to_doy (x ): return x # noqa: E306
151+ def to_doy (x ):
152+ return x # noqa: E306
150153 to_datetimeindex = partial (tools ._doy_to_datetimeindex ,
151154 epoch_year = epoch_year )
152155 to_output = tools ._scalar_out
153156 else : # assume that we have an array-like object of doy
154- def to_doy (x ): return x # noqa: E306
157+ def to_doy (x ):
158+ return x # noqa: E306
155159 to_datetimeindex = partial (tools ._doy_to_datetimeindex ,
156160 epoch_year = epoch_year )
157161 to_output = tools ._array_out
@@ -944,15 +948,18 @@ def reindl(surface_tilt, surface_azimuth, dhi, dni, ghi, dni_extra,
944948
945949 References
946950 ----------
947- .. [1] Reindl, D. T., Beckmann, W. A., Duffie, J. A., 1990a. Diffuse
948- fraction correlations. Solar Energy 45(1), 1-7.
949- :doi:`10.1016/0038-092X(90)90060-P`
950- .. [2] Reindl, D. T., Beckmann, W. A., Duffie, J. A., 1990b. Evaluation of
951- hourly tilted surface radiation models. Solar Energy 45(1), 9-17.
951+ .. [1] D. T. Reindl, "Estimating diffuse radiation on horizontal surfaces
952+ and total radiation on tilted surfaces," M.S. thesis, University of
953+ Wisconsin-Madison, Madison, WI, USA, 1988. Available:
954+ https://web.archive.org/web/20240709013622/https://minds.wisconsin.edu/bitstream/handle/1793/47852/0001.pdf
955+ .. [2] D. T. Reindl, W. A. Beckmann, and J. A. Duffie, "Evaluation of
956+ hourly tilted surface radiation models," Solar Energy, vol. 45,
957+ no. 1, pp. 9–17, 1990.
952958 :doi:`10.1016/0038-092X(90)90061-G`
953- .. [3] Loutzenhiser P. G. et. al., 2007. Empirical validation of models to
959+ .. [3] P. G. Loutzenhiser, H. Manz, C. Felsmann, P. A. Strachan,
960+ T. Frank, and G. M. Maxwell, "Empirical validation of models to
954961 compute solar irradiance on inclined surfaces for building energy
955- simulation. Solar Energy 81(2), 254- 267
962+ simulation," Solar Energy, vol. 81, no. 2, pp. 254– 267, 2007.
956963 :doi:`10.1016/j.solener.2006.03.009`
957964 '''
958965
@@ -1075,7 +1082,7 @@ def perez(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
10751082 airmass : numeric
10761083 Relative (not pressure-corrected) airmass values. If AM is a
10771084 DataFrame it must be of the same size as all other DataFrame
1078- inputs. AM must be >=0 (careful using the 1/sec (z) model of AM
1085+ inputs. AM must be >=0 (careful using the 1/cos (z) model of AM
10791086 generation). [unitless]
10801087
10811088 model : string, default 'allsitescomposite1990'
@@ -1335,7 +1342,7 @@ def perez_driesse(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
13351342 airmass : numeric, optional
13361343 Relative (not pressure-corrected) airmass values. If ``airmass`` is a
13371344 DataFrame it must be of the same size as all other DataFrame
1338- inputs. AM must be >=0 (careful using the 1/sec (z) model of AM
1345+ inputs. AM must be >=0 (careful using the 1/cos (z) model of AM
13391346 generation). [unitless]
13401347
13411348 return_components: bool (optional, default=False)
@@ -1442,7 +1449,7 @@ def _poa_from_ghi(surface_tilt, surface_azimuth,
14421449 Transposition function that includes decomposition of GHI using the
14431450 continuous Erbs-Driesse model.
14441451
1445- Helper function for ghi_from_poa_driesse_2023 .
1452+ Helper function for ghi_from_poa_driesse_2024 .
14461453 '''
14471454 # Contributed by Anton Driesse (@adriesse), PV Performance Labs. Nov., 2023
14481455
@@ -1468,7 +1475,7 @@ def _ghi_from_poa(surface_tilt, surface_azimuth,
14681475 '''
14691476 Reverse transposition function that uses the scalar bisection from scipy.
14701477
1471- Helper function for ghi_from_poa_driesse_2023 .
1478+ Helper function for ghi_from_poa_driesse_2024 .
14721479 '''
14731480 # Contributed by Anton Driesse (@adriesse), PV Performance Labs. Nov., 2023
14741481
@@ -1512,7 +1519,7 @@ def poa_error(ghi):
15121519 return ghi , conv , niter
15131520
15141521
1515- def ghi_from_poa_driesse_2023 (surface_tilt , surface_azimuth ,
1522+ def ghi_from_poa_driesse_2024 (surface_tilt , surface_azimuth ,
15161523 solar_zenith , solar_azimuth ,
15171524 poa_global ,
15181525 dni_extra , airmass = None , albedo = 0.25 ,
@@ -1614,6 +1621,14 @@ def ghi_from_poa_driesse_2023(surface_tilt, surface_azimuth,
16141621 return ghi
16151622
16161623
1624+ ghi_from_poa_driesse_2023 = deprecated (
1625+ since = "0.15.2" ,
1626+ name = "pvlib.irradiance.ghi_from_poa_driesse_2023" ,
1627+ alternative = "pvlib.irradiance.ghi_from_poa_driesse_2024" ,
1628+ removal = "0.17.0" ,
1629+ )(ghi_from_poa_driesse_2024 )
1630+
1631+
16171632def clearsky_index (ghi , ghi_clear , max_clearsky_index = 2.0 ):
16181633 """
16191634 Calculate the clearsky index.
@@ -1964,14 +1979,14 @@ def dirint(ghi, solar_zenith, times, pressure=101325., use_delta_kt_prime=True,
19641979
19651980 Returns
19661981 -------
1967- dni : array-like
1968- The modeled direct normal irradiance, as provided by the
1969- DIRINT model. [Wm⁻²]
1982+ dni : pd.Series
1983+ Estimated direct normal irradiance. [Wm⁻²]
19701984
19711985 Notes
19721986 -----
1973- DIRINT model requires time series data (ie. one of the inputs must
1974- be a vector of length > 2).
1987+ The DIRINT model was developed for time series data with length > 2.
1988+ The implementation in pvlib assumes the data are periodic which may
1989+ affect the first and last DNI values.
19751990
19761991 References
19771992 ----------
@@ -2109,6 +2124,7 @@ def _dirint_bins(times, kt_prime, zenith, w, delta_kt_prime):
21092124 -------
21102125 tuple of kt_prime_bin, zenith_bin, w_bin, delta_kt_prime_bin
21112126 """
2127+
21122128 # @wholmgren: the following bin assignments use MATLAB's 1-indexing.
21132129 # Later, we'll subtract 1 to conform to Python's 0-indexing.
21142130
0 commit comments