Skip to content

Commit 8e6ad0c

Browse files
committed
Merge branch 'main' into move-test-files
2 parents d5512f1 + 22364d8 commit 8e6ad0c

File tree

6 files changed

+51
-4
lines changed

6 files changed

+51
-4
lines changed

ci/requirements-py3.12.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ dependencies:
2525
- statsmodels
2626
- pip:
2727
- nrel-pysam>=2.0
28-
# - solarfactors # required shapely<2 isn't available for 3.12
28+
- solarfactors

docs/sphinx/source/whatsnew/v0.11.3.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,18 @@ Deprecations
1010

1111
Enhancements
1212
~~~~~~~~~~~~
13+
* :py:func:`~pvlib.irradiance.gti_dirint` now raises an informative message
14+
when input data don't include values with AOI<90 (:issue:`1342`, :pull:`2347`)
1315
* Fix a bug in :py:func:`pvlib.bifacial.get_irradiance_poa` which may have yielded non-zero
1416
ground irradiance when the sun was below the horizon. (:issue:`2245`, :pull:`2359`)
17+
* Fix a bug where :py:func:`pvlib.transformer.simple_efficiency` could only be imported
18+
using the `from pvlib.transformer` syntax (:pull:`2388`)
1519

1620
Documentation
1721
~~~~~~~~~~~~~
1822
* Fix Procedural and Object Oriented simulation examples having slightly different results, in :ref:`introtutorial`. (:issue:`2366`, :pull:`2367`)
1923
* Restructure the user guide with subsections (:issue:`2302`, :pull:`2310`)
24+
* Add references for :py:func:`pvlib.snow.loss_townsend`. (:issue:`2383`, :pull:`2384`)
2025

2126
Testing
2227
~~~~~~~
@@ -38,5 +43,8 @@ Contributors
3843
~~~~~~~~~~~~
3944
* Rajiv Daxini (:ghuser:`RDaxini`)
4045
* Mark Campanelli (:ghuser:`markcampanelli`)
46+
* Cliff Hansen (:ghuser:`cwhanse`)
4147
* Jason Lun Leung (:ghuser:`jason-rpkt`)
4248
* Manoj K S (:ghuser:`manojks1999`)
49+
* Kurt Rhee (:ghuser:`kurt-rhee`)
50+
* Ayush jariyal (:ghuser:`ayushjariyal`)

pvlib/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@
2727
temperature,
2828
tools,
2929
tracking,
30+
transformer,
3031
)

pvlib/irradiance.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2368,6 +2368,9 @@ def gti_dirint(poa_global, aoi, solar_zenith, solar_azimuth, times,
23682368
irradiance, Solar Energy 122, 1037-1046.
23692369
:doi:`10.1016/j.solener.2015.10.024`
23702370
"""
2371+
# check input data and raise Exceptions where data will cause the
2372+
# algorithm to fail
2373+
_gti_dirint_check_input(aoi)
23712374

23722375
aoi_lt_90 = aoi < 90
23732376

@@ -2399,6 +2402,17 @@ def gti_dirint(poa_global, aoi, solar_zenith, solar_azimuth, times,
23992402
return output
24002403

24012404

2405+
def _gti_dirint_check_input(aoi):
2406+
r"""
2407+
Helper for gti_dirint
2408+
2409+
Raises Exceptions from input data that cause the algorithm to fail.
2410+
"""
2411+
if not (aoi < 90).any():
2412+
raise ValueError("There are no times with AOI < 90. "
2413+
"gti_dirint requires some data with AOI < 90.")
2414+
2415+
24022416
def _gti_dirint_lt_90(poa_global, aoi, aoi_lt_90, solar_zenith, solar_azimuth,
24032417
times, surface_tilt, surface_azimuth, pressure=101325.,
24042418
use_delta_kt_prime=True, temp_dew=None, albedo=.25,

pvlib/snow.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,16 +278,23 @@ def loss_townsend(snow_total, snow_events, surface_tilt, relative_humidity,
278278
axis to the module edge.
279279
280280
The parameter `string_factor` is an enhancement added to the model after
281-
publication of [1]_ per private communication with the model's author. The
282-
definition for snow events documented above is also based on private
283-
communication with the model's author.
281+
publication of [1]_, as described in [2]_.
282+
The definition for snow events documented above is based on [3]_.
284283
285284
References
286285
----------
287286
.. [1] Townsend, Tim & Powers, Loren. (2011). Photovoltaics and snow: An
288287
update from two winters of measurements in the SIERRA. 37th IEEE
289288
Photovoltaic Specialists Conference, Seattle, WA, USA.
290289
:doi:`10.1109/PVSC.2011.6186627`
290+
.. [2] Townsend, T. and Previtali, J. (2023). A Fresh Dusting: Current
291+
Uses of the Townsend Snow Model. In "Photovoltaic Reliability
292+
Workshop (PVRW) 2023 Proceedings: Posters.", ed. Silverman,
293+
T. J. Dec. 2023. NREL/CP-5900-87918.
294+
Available at: https://www.nrel.gov/docs/fy25osti/90585.pdf
295+
.. [3] Townsend, T. (2013). Predicting PV Energy Loss Caused by Snow.
296+
Solar Power International, Chicago IL.
297+
:doi:`10.13140/RG.2.2.14299.68647`
291298
'''
292299

293300
# unit conversions from cm and m to in, from C to K, and from % to fraction

tests/test_irradiance.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,23 @@ def test_gti_dirint():
928928
assert_frame_equal(output, expected)
929929

930930

931+
def test_gti_dirint_data_error():
932+
times = pd.DatetimeIndex(
933+
['2014-06-24T06-0700', '2014-06-24T09-0700', '2014-06-24T12-0700'])
934+
poa_global = np.array([20, 300, 1000])
935+
zenith = np.array([80, 45, 20])
936+
azimuth = np.array([90, 135, 180])
937+
surface_tilt = 30
938+
surface_azimuth = 180
939+
940+
aoi = np.array([100, 170, 110])
941+
with pytest.raises(
942+
ValueError, match="There are no times with AOI < 90"):
943+
irradiance.gti_dirint(
944+
poa_global, aoi, zenith, azimuth, times, surface_tilt,
945+
surface_azimuth)
946+
947+
931948
def test_erbs():
932949
index = pd.DatetimeIndex(['20190101']*3 + ['20190620'])
933950
ghi = pd.Series([0, 50, 1000, 1000], index=index)

0 commit comments

Comments
 (0)