diff --git a/backend/apis/GoogleSolarApi.py b/backend/apis/GoogleSolarApi.py index 13c7abb4..e930fcff 100644 --- a/backend/apis/GoogleSolarApi.py +++ b/backend/apis/GoogleSolarApi.py @@ -309,7 +309,7 @@ class GoogleSolarApi: } ) - panel_performance = pd.DataFrame(panel_performance) + panel_performance = pd.DataFrame([panel_performance]) if panel_performance.empty: self.panel_performance = pd.DataFrame( @@ -329,12 +329,30 @@ class GoogleSolarApi: return # We can have duplicate configurations + panel_performance = panel_performance.drop_duplicates() # If we look at the building level, we don't include any projects fewer than 10 panels, otherwise the # minimum is 4 min_panels = 10 if is_building else 4 panel_performance = panel_performance[panel_performance["n_panels"] >= min_panels] + if panel_performance.empty: + self.panel_performance = pd.DataFrame( + columns=[ + "n_panels", + "yearly_dc_energy", + "total_cost", + "panneled_roof_area", + "array_wattage", + "initial_ac_kwh_per_year", + "lifetime_ac_kwh", + "roi", + "expected_payback_years", + "lifetime_dc_kwh" + ] + ) + return + panel_performance["initial_ac_kwh_per_year"] = panel_performance["yearly_dc_energy"] * self.dc_to_ac_rate # Remove anything where the total ac energy is less than half of the array wattage