Skip to content

Commit fbf1e30

Browse files
authored
Merge branch 'main' into diffuse-components-support
2 parents 8d698e3 + 35c9e61 commit fbf1e30

12 files changed

Lines changed: 123 additions & 149 deletions

File tree

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Contributing
22
============
33

4-
We welcome your contributions! Please see the [contributing](http://pvlib-python.readthedocs.io/en/latest/contributing.html) page for information about how to contribute.
4+
We welcome your contributions! Please see the [contributing](https://pvlib-python.readthedocs.io/en/stable/contributing/index.html) page for information about how to contribute.

docs/examples/system-models/oedi_9068.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"""
88
# %%
99
# This example model uses satellite-based solar resource data from the
10-
# NSRDB PSM3. This approach is useful for pre-construction energy modeling
10+
# NSRDB PSM4. This approach is useful for pre-construction energy modeling
1111
# and in retrospective analyses where the system’s own irradiance
1212
# measurements are not present or unreliable.
1313
#
@@ -135,17 +135,18 @@
135135
#
136136
# The system does have measured plane-of-array irradiance data, but the
137137
# measurements suffer from row-to-row shading and tracker stalls. In this
138-
# example, we will use weather data taken from the NSRDB PSM3 for the year
138+
# example, we will use weather data taken from the NSRDB PSM4 for the year
139139
# 2019.
140140

141141
api_key = 'DEMO_KEY'
142142
email = 'your_email@domain.com'
143143

144144
keys = ['ghi', 'dni', 'dhi', 'temp_air', 'wind_speed',
145145
'albedo', 'precipitable_water']
146-
psm3, psm3_metadata = pvlib.iotools.get_nsrdb_psm4_conus(latitude, longitude,
146+
psm4, psm4_metadata = pvlib.iotools.get_nsrdb_psm4_conus(latitude, longitude,
147147
api_key, email,
148-
year=2019, interval=5,
148+
year=2019,
149+
time_step=5,
149150
parameters=keys,
150151
map_variables=True,
151152
leap_day=True)
@@ -167,20 +168,20 @@
167168
# module fraction and returns the average irradiance over the total module
168169
# surface.
169170

170-
solar_position = location.get_solarposition(psm3.index)
171+
solar_position = location.get_solarposition(psm4.index)
171172
tracker_angles = mount.get_orientation(
172173
solar_position['apparent_zenith'],
173174
solar_position['azimuth']
174175
)
175-
dni_extra = pvlib.irradiance.get_extra_radiation(psm3.index)
176+
dni_extra = pvlib.irradiance.get_extra_radiation(psm4.index)
176177

177178
# note: this system is monofacial, so only calculate irradiance for the
178179
# front side:
179180
averaged_irradiance = pvlib.bifacial.infinite_sheds.get_irradiance_poa(
180181
tracker_angles['surface_tilt'], tracker_angles['surface_azimuth'],
181182
solar_position['apparent_zenith'], solar_position['azimuth'],
182183
gcr, axis_height, pitch,
183-
psm3['ghi'], psm3['dhi'], psm3['dni'], psm3['albedo'],
184+
psm4['ghi'], psm4['dhi'], psm4['dni'], psm4['albedo'],
184185
model='haydavies', dni_extra=dni_extra,
185186
)
186187

@@ -191,14 +192,14 @@
191192

192193
cell_temperature_steady_state = pvlib.temperature.faiman(
193194
poa_global=averaged_irradiance['poa_global'],
194-
temp_air=psm3['temp_air'],
195-
wind_speed=psm3['wind_speed'],
195+
temp_air=psm4['temp_air'],
196+
wind_speed=psm4['wind_speed'],
196197
**temperature_model_parameters,
197198
)
198199

199200
cell_temperature = pvlib.temperature.prilliman(
200201
cell_temperature_steady_state,
201-
psm3['wind_speed'],
202+
psm4['wind_speed'],
202203
unit_mass=module_unit_mass
203204
)
204205

@@ -215,7 +216,7 @@
215216
'poa_direct': averaged_irradiance['poa_direct'],
216217
'poa_diffuse': averaged_irradiance['poa_diffuse'],
217218
'cell_temperature': cell_temperature,
218-
'precipitable_water': psm3['precipitable_water'], # for the spectral model
219+
'precipitable_water': psm4['precipitable_water'], # for the spectral model
219220
})
220221
model.run_model_from_poa(weather_inputs)
221222

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@ Enhancements
2020
~~~~~~~~~~~~
2121
* Add support for diffuse irradiance components to :py:func:`pvlib.irradiance.isotropic`
2222
when ``return_components=True``. (:issue:`2750`, :pull:`2787`)
23+
* Ensure all timezones are available in all OSs. (:issue:`2795`, :pull:`2809`)
2324

2425

2526
Documentation
2627
~~~~~~~~~~~~~
28+
* Fix broken link in GitHub Contributing tab. (:issue:`2628`, :pull:`2806`)
29+
* Fixed broken ``interval`` keyword argument in the ``oedi_9068`` gallery
30+
example; the correct parameter name is ``time_step``. (:issue:`2791`)
2731

2832

2933
Testing
@@ -40,8 +44,14 @@ Requirements
4044

4145
Maintenance
4246
~~~~~~~~~~~
47+
* Removed unused internal function ``clearsky._is_leap_year`` (:issue:`2768`, :pull:`2813`)
48+
* Fix documentation builds on runner images lacking link-type timezones. (:issue:`2795`, :pull:`2809`)
4349

4450

4551
Contributors
4652
~~~~~~~~~~~~
47-
53+
* Eesh Saxena (:ghuser:`eeshsaxena`)
54+
* Karl Hill (:ghuser:`karlhillx`)
55+
* Mathias Aschwanden (:ghuser:`maschwanden`)
56+
* Yonry Zhu (:ghuser:`yonryzhu`)
57+
* Darshan Gowda (:ghuser:`dgowdaan-cmyk`)
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
.. _whatsnew_0_16_0:
2+
3+
4+
v0.16.0
5+
Breaking Changes
6+
~~~~~~~~~~~~~~~~
7+
* Change output type of :py:func:`pvlib.irradiance.perez` and
8+
:py:func:`pvlib.irradiance.perez_driesse` from ``OrderedDict`` to ``dict`` when
9+
``return_components=True`` to be consistent with other models.
10+
(:pull:`2789`)
11+
* Remove empty ``poa_horizon`` key from the ``diffuse_components`` output of
12+
:py:func:`pvlib.irradiance.haydavies`.
13+
(:pull:`2788`)
14+
15+
16+
Deprecations
17+
~~~~~~~~~~~~
18+
19+
20+
Bug fixes
21+
~~~~~~~~~
22+
23+
24+
Enhancements
25+
~~~~~~~~~~~~
26+
27+
28+
Documentation
29+
~~~~~~~~~~~~~
30+
31+
32+
Testing
33+
~~~~~~~
34+
35+
36+
Benchmarking
37+
~~~~~~~~~~~~
38+
39+
40+
Requirements
41+
~~~~~~~~~~~~
42+
43+
44+
Maintenance
45+
~~~~~~~~~~~
46+
47+
48+
Contributors
49+
~~~~~~~~~~~~
50+
* Carolina Crespo (:ghuser:`cbcrespo`)

pvlib/bifacial/infinite_sheds.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,6 @@ def _poa_sky_diffuse_pv(dhi, gcr, surface_tilt):
4545
Integrated view factors from the shaded and unshaded parts of
4646
the row slant height to the sky.
4747
48-
Parameters
49-
----------
50-
f_x : numeric
51-
Fraction of row slant height from the bottom that is shaded from
52-
direct irradiance. [unitless]
53-
surface_tilt : numeric
54-
Surface tilt angle in degrees from horizontal, e.g., surface facing up
55-
= 0, surface facing horizon = 90. [degree]
56-
gcr : float
57-
Ratio of row slant length to row spacing (pitch). [unitless]
58-
npoints : int, default 100
59-
Number of points for integration. [unitless]
60-
6148
A detailed calculation would be
6249
6350
dhi * (f_x * vf_shade_sky_integ + (1 - f_x) * vf_noshade_sky_integ)
@@ -73,9 +60,6 @@ def _poa_sky_diffuse_pv(dhi, gcr, surface_tilt):
7360
7461
Parameters
7562
----------
76-
f_x : numeric
77-
Fraction of row slant height from the bottom that is shaded from
78-
direct irradiance. [unitless]
7963
dhi : numeric
8064
Diffuse horizontal irradiance (DHI). [W/m^2]
8165
gcr : float

pvlib/clearsky.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -220,22 +220,6 @@ def lookup_linke_turbidity(time, latitude, longitude, filepath=None,
220220
return linke_turbidity
221221

222222

223-
def _is_leap_year(year):
224-
"""Determine if a year is leap year.
225-
226-
Parameters
227-
----------
228-
year : numeric
229-
230-
Returns
231-
-------
232-
isleap : array of bools
233-
"""
234-
isleap = ((np.mod(year, 4) == 0) &
235-
((np.mod(year, 100) != 0) | (np.mod(year, 400) == 0)))
236-
return isleap
237-
238-
239223
def _interpolate_turbidity(lts, time):
240224
"""
241225
Interpolated monthly Linke turbidity onto daily values.

pvlib/irradiance.py

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ def haydavies(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
857857
858858
Returns
859859
--------
860-
numeric, OrderedDict, or DataFrame
860+
numeric, dict, or DataFrame
861861
Return type controlled by ``return_components`` argument.
862862
If `False`, ``sky_diffuse`` is returned.
863863
If `True`, ``diffuse_components`` is returned.
@@ -866,13 +866,11 @@ def haydavies(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
866866
The sky diffuse component of the solar radiation on a tilted
867867
surface. [Wm⁻²]
868868
869-
diffuse_components : OrderedDict (array input) or DataFrame (Series input)
869+
diffuse_components : dict (array input) or DataFrame (Series input)
870870
Keys/columns are:
871871
* poa_sky_diffuse: Total sky diffuse
872872
* poa_isotropic
873873
* poa_circumsolar
874-
* poa_horizon (always zero, not accounted for by the
875-
Hay-Davies model)
876874
877875
Notes
878876
------
@@ -930,14 +928,11 @@ def haydavies(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
930928
sky_diffuse = poa_isotropic + poa_circumsolar
931929

932930
if return_components:
933-
diffuse_components = OrderedDict()
934-
diffuse_components['poa_sky_diffuse'] = sky_diffuse
935-
936-
# Calculate the individual components
937-
diffuse_components['poa_isotropic'] = poa_isotropic
938-
diffuse_components['poa_circumsolar'] = poa_circumsolar
939-
diffuse_components['poa_horizon'] = np.where(
940-
np.isnan(diffuse_components['poa_isotropic']), np.nan, 0.)
931+
diffuse_components = {
932+
'poa_sky_diffuse': sky_diffuse,
933+
'poa_isotropic': poa_isotropic,
934+
'poa_circumsolar': poa_circumsolar
935+
}
941936

942937
if isinstance(sky_diffuse, pd.Series):
943938
diffuse_components = pd.DataFrame(diffuse_components)
@@ -1179,7 +1174,7 @@ def perez(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
11791174
11801175
Returns
11811176
--------
1182-
numeric, OrderedDict, or DataFrame
1177+
numeric, dict, or DataFrame
11831178
Return type controlled by `return_components` argument.
11841179
If ``return_components=False``, `sky_diffuse` is returned.
11851180
If ``return_components=True``, `diffuse_components` is returned.
@@ -1188,7 +1183,7 @@ def perez(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
11881183
The sky diffuse component of the solar radiation on a tilted
11891184
surface.
11901185
1191-
diffuse_components : OrderedDict (array input) or DataFrame (Series input)
1186+
diffuse_components : dict (array input) or DataFrame (Series input)
11921187
Keys/columns are:
11931188
* poa_sky_diffuse: Total sky diffuse
11941189
* poa_isotropic
@@ -1275,13 +1270,12 @@ def perez(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
12751270
sky_diffuse = np.where(np.isnan(airmass), 0, sky_diffuse)
12761271

12771272
if return_components:
1278-
diffuse_components = OrderedDict()
1279-
diffuse_components['poa_sky_diffuse'] = sky_diffuse
1280-
1281-
# Calculate the different components
1282-
diffuse_components['poa_isotropic'] = dhi * term1
1283-
diffuse_components['poa_circumsolar'] = dhi * term2
1284-
diffuse_components['poa_horizon'] = dhi * term3
1273+
diffuse_components = {
1274+
'poa_sky_diffuse': sky_diffuse,
1275+
'poa_isotropic': dhi * term1,
1276+
'poa_circumsolar': dhi * term2,
1277+
'poa_horizon': dhi * term3
1278+
}
12851279

12861280
# Set values of components to 0 when sky_diffuse is 0
12871281
mask = sky_diffuse == 0
@@ -1421,7 +1415,7 @@ def perez_driesse(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
14211415
14221416
Returns
14231417
--------
1424-
numeric, OrderedDict, or DataFrame
1418+
numeric, dict, or DataFrame
14251419
Return type controlled by `return_components` argument.
14261420
If ``return_components=False``, `sky_diffuse` is returned.
14271421
If ``return_components=True``, `diffuse_components` is returned.
@@ -1430,7 +1424,7 @@ def perez_driesse(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
14301424
The sky diffuse component of the solar radiation on a tilted
14311425
surface.
14321426
1433-
diffuse_components : OrderedDict (array input) or DataFrame (Series input)
1427+
diffuse_components : dict (array input) or DataFrame (Series input)
14341428
Keys/columns are:
14351429
* poa_sky_diffuse: Total sky diffuse
14361430
* poa_isotropic
@@ -1495,13 +1489,12 @@ def perez_driesse(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
14951489
sky_diffuse = np.maximum(dhi * (term1 + term2 + term3), 0)
14961490

14971491
if return_components:
1498-
diffuse_components = OrderedDict()
1499-
diffuse_components['poa_sky_diffuse'] = sky_diffuse
1500-
1501-
# Calculate the different components
1502-
diffuse_components['poa_isotropic'] = dhi * term1
1503-
diffuse_components['poa_circumsolar'] = dhi * term2
1504-
diffuse_components['poa_horizon'] = dhi * term3
1492+
diffuse_components = {
1493+
'poa_sky_diffuse': sky_diffuse,
1494+
'poa_isotropic': dhi * term1,
1495+
'poa_circumsolar': dhi * term2,
1496+
'poa_horizon': dhi * term3
1497+
}
15051498

15061499
if isinstance(sky_diffuse, pd.Series):
15071500
diffuse_components = pd.DataFrame(diffuse_components)
@@ -3192,8 +3185,8 @@ def _liujordan(zenith, transmittance, airmass, dni_extra=1367.0):
31923185
transmittance: float
31933186
Atmospheric transmittance between 0 and 1.
31943187
3195-
pressure: float, default 101325.0
3196-
Air pressure
3188+
airmass: numeric
3189+
Optical air mass. [unitless]
31973190
31983191
dni_extra: float, default 1367.0
31993192
Direct irradiance incident at the top of the atmosphere.

pvlib/pvsystem.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ def get_iam(self, aoi, iam_model='physical'):
395395
aoi : numeric or tuple of numeric
396396
The angle of incidence in degrees.
397397
398-
aoi_model : string, default 'physical'
398+
iam_model : string, default 'physical'
399399
The IAM model to be used. Valid strings are 'physical', 'ashrae',
400400
'martin_ruiz', 'sapm' and 'interp'.
401401
Returns
@@ -1188,7 +1188,7 @@ def get_iam(self, aoi, iam_model='physical'):
11881188
aoi : numeric
11891189
The angle of incidence in degrees.
11901190
1191-
aoi_model : string, default 'physical'
1191+
iam_model : string, default 'physical'
11921192
The IAM model to be used. Valid strings are 'physical', 'ashrae',
11931193
'martin_ruiz', 'sapm' and 'interp'.
11941194

pvlib/solarposition.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ def sun_rise_set_transit_ephem(times, latitude, longitude,
516516
517517
Parameters
518518
----------
519-
time : pandas.DatetimeIndex
519+
times : pandas.DatetimeIndex
520520
Must be localized
521521
latitude : float
522522
Latitude in degrees, positive north of equator, negative to south

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ dependencies = [
1717
'requests',
1818
'scipy >= 1.7.2',
1919
'h5py',
20+
'tzdata', # ensure all timezones are available in all installs for consistency GH#2795
2021
]
2122
license = "BSD-3-Clause"
2223
classifiers = [

0 commit comments

Comments
 (0)