@@ -674,7 +674,8 @@ def complete_irradiance(self, times=None, weather=None):
674674 self .weather = weather
675675 if times is not None :
676676 self .times = times
677- self .solar_position = self .location .get_solarposition (self .times )
677+ self .solar_position = self .location .get_solarposition (
678+ self .times , method = self .solar_position_method )
678679 icolumns = set (self .weather .columns )
679680 wrn_txt = ("This function is not safe at the moment.\n " +
680681 "Results can be too high or negative.\n " +
@@ -683,10 +684,12 @@ def complete_irradiance(self, times=None, weather=None):
683684
684685 if {'ghi' , 'dhi' } <= icolumns and 'dni' not in icolumns :
685686 logging .debug ('Estimate dni from ghi and dhi' )
687+ clearsky = self .location .get_clearsky (
688+ times , solar_position = self .solar_position )
686689 self .weather .loc [:, 'dni' ] = pvlib .irradiance .dni (
687690 self .weather .loc [:, 'ghi' ], self .weather .loc [:, 'dhi' ],
688691 self .solar_position .zenith ,
689- clearsky_dni = self . location . get_clearsky ( times ). dni ,
692+ clearsky_dni = clearsky [ ' dni' ] ,
690693 clearsky_tolerance = 1.1 )
691694 elif {'dni' , 'dhi' } <= icolumns and 'ghi' not in icolumns :
692695 warnings .warn (wrn_txt , UserWarning )
@@ -753,7 +756,8 @@ def prepare_inputs(self, times=None, irradiance=None, weather=None):
753756 if times is not None :
754757 self .times = times
755758
756- self .solar_position = self .location .get_solarposition (self .times )
759+ self .solar_position = self .location .get_solarposition (
760+ self .times , method = self .solar_position_method )
757761
758762 self .airmass = self .location .get_airmass (
759763 solar_position = self .solar_position , model = self .airmass_model )
0 commit comments