Skip to content

Commit 76d89c3

Browse files
Uwe KrienUwe Krien
Uwe Krien
authored and
Uwe Krien
committed
make parameters optional if attributes are already set
1 parent 9ff9fe4 commit 76d89c3

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

pvlib/modelchain.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ def effective_irradiance_model(self):
607607
fd*self.total_irrad['poa_diffuse'])
608608
return self
609609

610-
def complete_irradiance(self, times, weather):
610+
def complete_irradiance(self, times=None, weather=None):
611611
"""
612612
Determine the missing irradiation columns. Only two of the following
613613
data columns (dni, ghi, dhi) are needed to calculate the missing data.
@@ -619,19 +619,23 @@ def complete_irradiance(self, times, weather):
619619
Parameters
620620
----------
621621
times : DatetimeIndex
622-
Date and time index of the irradiation data
622+
Times at which to evaluate the model. Can be None if attribute
623+
`times` is already set.
623624
weather : pandas.DataFrame
624625
Table with at least two columns containing one of the following data
625-
sets: dni, dhi, ghi
626+
sets: dni, dhi, ghi. Can be None if attribute `weather` is already
627+
set.
626628
627629
Returns
628630
-------
629631
pandas.DataFrame
630632
Containing the missing column of the data sets passed with the
631633
weather DataFrame.
632634
"""
633-
self.weather = weather
634-
self.times = times
635+
if weather is not None:
636+
self.weather = weather
637+
if times is not None:
638+
self.times = times
635639
self.solar_position = self.location.get_solarposition(self.times)
636640
icolumns = set(self.weather.columns)
637641
wrn_txt = ("This function is not safe at the moment.\n" +

0 commit comments

Comments
 (0)