mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
tweaking solar api
This commit is contained in:
parent
e43842d980
commit
8aa81a2bf7
2 changed files with 13 additions and 3 deletions
|
|
@ -154,7 +154,9 @@ class GoogleSolarApi:
|
||||||
# Automatically exclude north-facing segments
|
# Automatically exclude north-facing segments
|
||||||
self.exclude_north_facing_segments()
|
self.exclude_north_facing_segments()
|
||||||
# If a property is semi-detached, it's possible for us to include segments from an attached unit
|
# If a property is semi-detached, it's possible for us to include segments from an attached unit
|
||||||
if property_instance.data["built-form"] == "Semi-Detached":
|
if (property_instance.data["built-form"] == "Semi-Detached") and (
|
||||||
|
property_instance.data["extension-count"] == 0
|
||||||
|
):
|
||||||
self.exclude_likely_duplicate_surfaces()
|
self.exclude_likely_duplicate_surfaces()
|
||||||
|
|
||||||
self.roof_area = self.insights_data["solarPotential"]["wholeRoofStats"]['areaMeters2']
|
self.roof_area = self.insights_data["solarPotential"]["wholeRoofStats"]['areaMeters2']
|
||||||
|
|
@ -506,6 +508,7 @@ class GoogleSolarApi:
|
||||||
property_center = self.insights_data["center"]
|
property_center = self.insights_data["center"]
|
||||||
|
|
||||||
deduped_segments = []
|
deduped_segments = []
|
||||||
|
dropped_segments = []
|
||||||
for segment in self.roof_segments:
|
for segment in self.roof_segments:
|
||||||
if not deduped_segments:
|
if not deduped_segments:
|
||||||
deduped_segments.append(segment)
|
deduped_segments.append(segment)
|
||||||
|
|
@ -529,12 +532,16 @@ class GoogleSolarApi:
|
||||||
if current_dist < similar_dist:
|
if current_dist < similar_dist:
|
||||||
deduped_segments.remove(similar_segment)
|
deduped_segments.remove(similar_segment)
|
||||||
deduped_segments.append(segment)
|
deduped_segments.append(segment)
|
||||||
|
dropped_segments.append(similar_segment)
|
||||||
|
else:
|
||||||
|
dropped_segments.append(segment)
|
||||||
|
|
||||||
# If we have a semi-detached property that has duplicated segments, we should expect to half the number of
|
# If we have a semi-detached property that has duplicated segments, we should expect to half the number of
|
||||||
# segments
|
# segments
|
||||||
if len(deduped_segments) < len(self.roof_segments):
|
if len(deduped_segments) < len(self.roof_segments):
|
||||||
if len(deduped_segments) != len(self.roof_segments) / 2:
|
if len(deduped_segments) != len(self.roof_segments) / 2:
|
||||||
raise ValueError("We don't have half the number of segments that we started with")
|
# We don't perform any dropping in this case
|
||||||
|
return
|
||||||
|
|
||||||
# Because the segments are duplicated, but the sizes aren't necessarily split perfectly in half, what
|
# Because the segments are duplicated, but the sizes aren't necessarily split perfectly in half, what
|
||||||
# we need to do is perform the solar analysis and then half the results. We set an indicator which
|
# we need to do is perform the solar analysis and then half the results. We set an indicator which
|
||||||
|
|
|
||||||
|
|
@ -440,7 +440,10 @@ async def trigger_plan(body: PlanTriggerRequest):
|
||||||
logger.info("Performing solar analysis")
|
logger.info("Performing solar analysis")
|
||||||
# TODO: Tidy this up
|
# TODO: Tidy this up
|
||||||
# TODO: If a property is semi-detached, we might get roof surfaces for the main building + the neighbour
|
# TODO: If a property is semi-detached, we might get roof surfaces for the main building + the neighbour
|
||||||
#
|
# TODO: If we can't get high image quality, should we use the solar API? Maybe just for semi-detached units with
|
||||||
|
# extensions, since it doesn't seem to do a great job
|
||||||
|
# TODO: For simple properties, we should do a comparison/check between the solar API's roof area and the
|
||||||
|
# basic estimate of roof area
|
||||||
building_ids = [
|
building_ids = [
|
||||||
{
|
{
|
||||||
"building_id": p.building_id,
|
"building_id": p.building_id,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue