@@ -317,7 +317,7 @@ def __init__(self, system, location,
317
317
self .losses_model = losses_model
318
318
self .orientation_strategy = orientation_strategy
319
319
320
- self .weather = pd . DataFrame ()
320
+ self .weather = None
321
321
self .times = None
322
322
self .solar_position = None
323
323
@@ -687,8 +687,11 @@ def prepare_inputs(self, times=None, irradiance=None, weather=None):
687
687
# Add columns that does not exist and overwrite existing columns
688
688
# Maybe there is a more elegant way to do this. Any ideas?
689
689
if weather is not None :
690
- self .weather = self .weather .combine_first (weather )
691
- self .weather .update (weather )
690
+ if self .weather is None :
691
+ self .weather = weather
692
+ else :
693
+ self .weather = self .weather .combine_first (weather )
694
+ self .weather .update (weather )
692
695
693
696
# The following part could be removed together with the irradiance
694
697
# parameter at version v0.5 or v0.6.
@@ -713,7 +716,15 @@ def prepare_inputs(self, times=None, irradiance=None, weather=None):
713
716
self .aoi = self .system .get_aoi (self .solar_position ['apparent_zenith' ],
714
717
self .solar_position ['azimuth' ])
715
718
716
- if not any ([x in ['ghi' , 'dni' , 'dhi' ] for x in self .weather .columns ]):
719
+ use_clearsky = False
720
+ if self .weather is None :
721
+ use_clearsky = True
722
+ self .weather = pd .DataFrame ()
723
+ else :
724
+ if not any ([x in ['ghi' , 'dni' , 'dhi' ] for x in self .weather .columns ]):
725
+ use_clearsky = True
726
+
727
+ if use_clearsky :
717
728
self .weather [['ghi' , 'dni' , 'dhi' ]] = self .location .get_clearsky (
718
729
self .solar_position .index , self .clearsky_model ,
719
730
zenith_data = self .solar_position ['apparent_zenith' ],
0 commit comments