8000 Accept albedo in weather input to ModelChain.run_model method by cwhanse · Pull Request #1478 · pvlib/pvlib-python · GitHub
[go: up one dir, main page]

Skip to content

Accept albedo in weather input to ModelChain.run_model method #1478

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 32 commits into from
Aug 19, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d0c52b6
permit albedo to be a Series
cwhanse Jun 9, 2022
e64a940
work on modelchain
cwhanse Jun 10, 2022
de34639
Merge branch 'master' of https://github.com/pvlib/pvlib-python into a…
cwhanse Jun 13, 2022
0fa45e8
fix tests
cwhanse Jun 13, 2022
cdf853e
shh stickler, docstrings
cwhanse Jun 13, 2022
b3ee156
improve coverage
cwhanse Jun 13, 2022
9e1ce0e
improve coverage correctly
cwhanse Jun 13, 2022
59a37da
finalize coverage, stickler
cwhanse Jun 13, 2022
0295dd0
whatsnew
cwhanse Jun 13, 2022
b9a7308
from review
cwhanse Jun 13, 2022
e518996
Merge branch 'master' of https://github.com/pvlib/pvlib-python into a…
cwhanse Jun 20, 2022
e4c5fa5
don't mutate inputs
cwhanse Jun 20, 2022
acb3657
get_irradiance in tracking.py
cwhanse Jun 20, 2022
2bd97b8
shh stickler
cwhanse Jun 20, 2022
5f0d455
shh stickler
cwhanse Jun 20, 2022
0a10e56
improvements from review
cwhanse Jun 21, 2022
122e992
Merge branch 'pvlib:master' into albedo
cwhanse Jun 21, 2022
cbe2099
update whatsnew
cwhanse Jun 21, 2022
15ff086
Merge branch 'master' of https://github.com/pvlib/pvlib-python into a…
cwhanse Jun 21, 2022
d787675
Merge branch 'albedo' of https://github.com/cwhanse/pvlib-python into…
cwhanse Jun 21, 2022
18a4ed1
Apply suggestions from code review
cwhanse Jun 23, 2022
e2e9f5e
docstring improvements
cwhanse Jun 23, 2022
18bb4d5
Merge branch 'master' into albedo
cwhanse Jul 22, 2022
0bde3c7
Apply suggestions from code review
cwhanse Jul 30, 2022
2ea9c97
Update pvlib/tests/test_irradiance.py
cwhanse Jul 30, 2022
ab2c11a
from review
cwhanse Jul 30, 2022
4340bb0
one more
cwhanse Jul 30, 2022
6193147
more use of fixture, add Array.get_irradiance test
cwhanse Aug 1, 2022
0ecfb7d
more decimal places
cwhanse Aug 1, 2022
af6ff0e
spacing
cwhanse Aug 10, 2022
100a8a1
line length
cwhanse Aug 17, 2022
1a835b1
write albedo from system.arrays to ModelChainResult
cwhanse Aug 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
improvements from review
  • Loading branch information
cwhanse committed Jun 21, 2022
commit 0a10e56772eeb25b57631a7fda826e7ff5a5209e
22 changes: 11 additions & 11 deletions pvlib/pvsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ def get_aoi(self, solar_zenith, solar_azimuth):

@_unwrap_single_value
def get_irradiance(self, solar_zenith, solar_azimuth, dni, ghi, dhi,
dni_extra=None, airmass=None,
albedo=None, dni_extra=None, airmass=None,
model='haydavies', **kwargs):
"""
Uses the :py:func:`irradiance.get_total_irradiance` function to
Expand All @@ -345,18 +345,21 @@ def get_irradiance(self, solar_zenith, solar_azimuth, dni, ghi, dhi,

Parameters
----------
solar_zenith : float or Series.
solar_zenith : float or Series
Solar zenith angle.
solar_azimuth : float or Series.
solar_azimuth : float or Series
Solar azimuth angle.
dni : float or Series or tuple of float or Series
Direct Normal Irradiance. [W/m2]
ghi : float or Series or tuple of float or Series
Global horizontal irradiance. [W/m2]
dhi : float or Series or tuple of float or Series
Diffuse horizontal irradiance. [W/m2]
dni_extra : None, float or Series, default None
Extraterrestrial direct normal irradiance [W/m2]
albedo : None, float or Series, default None
Ground surface albedo. [unitless]
dni_extra : None, float, Series or tuple of float or Series,
default None
Extraterrestrial direct normal irradiance. [W/m2]
airmass : None, float or Series, default None
Airmass. [unitless]
model : String, default 'haydavies'
Expand Down Expand Up @@ -387,17 +390,14 @@ def get_irradiance(self, solar_zenith, solar_azimuth, dni, ghi, dhi,
ghi = self._validate_per_array(ghi, system_wide=True)
dhi = self._validate_per_array(dhi, system_wide=True)

try:
albedo = kwargs.pop('albedo')
except KeyError:
albedo = None
albedo = self._validate_per_array(albedo, system_wide=True)

return tuple(
array.get_irradiance(solar_zenith, solar_azimuth,
dni, ghi, dhi,
albedo,
dni_extra, airmass, model,
albedo=albedo,
dni_extra=dni_extra, airmass=airmass,
model=model,
**kwargs)
for array, dni, ghi, dhi, albedo in zip(
self.arrays, dni, ghi, dhi, albedo
Expand Down
1 change: 0 additions & 1 deletion pvlib/tests/test_modelchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,6 @@ def test_prepare_inputs_albedo_in_weather(
times = pd.date_range(start='20160101 1200-0700',
end='20160101 1800-0700', freq='6H')
mc = ModelChain(sapm_dc_snl_ac_system_Array, location)
# albedo on pvsystem but not in weather
weather = pd.DataFrame({'ghi': 1, 'dhi': 1, 'dni': 1, 'albedo': 0.5},
index=times)
# weather as a single DataFrame
Expand Down
9 changes: 3 additions & 6 deletions pvlib/tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,9 @@ def get_irradiance(self, surface_tilt, surface_azimuth,
dhi = self._validate_per_array(dhi, system_wide=True)

if albedo is None:
try:
albedo = kwargs.pop('albedo')
except KeyError:
# assign default albedo here because SingleAxisTracker
# initializes albedo to None
albedo = 0.25
# assign default albedo here because SingleAxisTracker
# initializes albedo to None
albedo = 0.25

albedo = self._validate_per_array(albedo, system_wide=True)

Expand Down
0