@@ -674,7 +674,8 @@ def complete_irradiance(self, times=None, weather=None):
674
674
self .weather = weather
675
675
if times is not None :
676
676
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 )
678
679
icolumns = set (self .weather .columns )
679
680
wrn_txt = ("This function is not safe at the moment.\n " +
680
681
"Results can be too high or negative.\n " +
@@ -683,10 +684,12 @@ def complete_irradiance(self, times=None, weather=None):
683
684
684
685
if {'ghi' , 'dhi' } <= icolumns and 'dni' not in icolumns :
685
686
logging .debug ('Estimate dni from ghi and dhi' )
687
+ clearsky = self .location .get_clearsky (
688
+ times , solar_position = self .solar_position )
686
689
self .weather .loc [:, 'dni' ] = pvlib .irradiance .dni (
687
690
self .weather .loc [:, 'ghi' ], self .weather .loc [:, 'dhi' ],
688
691
self .solar_position .zenith ,
689
- clearsky_dni = self . location . get_clearsky ( times ). dni ,
692
+ clearsky_dni = clearsky [ ' dni' ] ,
690
693
clearsky_tolerance = 1.1 )
691
694
elif {'dni' , 'dhi' } <= icolumns and 'ghi' not in icolumns :
692
695
warnings .warn (wrn_txt , UserWarning )
@@ -753,7 +756,8 @@ def prepare_inputs(self, times=None, irradiance=None, weather=None):
753
756
if times is not None :
754
757
self .times = times
755
758
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 )
757
761
758
762
self .airmass = self .location .get_airmass (
759
763
solar_position = self .solar_position , model = self .airmass_model )
0 commit comments