|
1 | 1 | from .api import Client, PandafiableResponse |
2 | | -from .urls import base_url, historic_radiation_and_weather, historic_rooftop_pv_power |
| 2 | +from .urls import ( |
| 3 | + base_url, |
| 4 | + historic_radiation_and_weather, |
| 5 | + historic_rooftop_pv_power, |
| 6 | + historic_advanced_pv_power, |
| 7 | +) |
3 | 8 |
|
4 | 9 |
|
5 | 10 | def radiation_and_weather( |
@@ -99,3 +104,46 @@ def rooftop_pv_power( |
99 | 104 | params["duration"] = duration |
100 | 105 |
|
101 | 106 | return client.get(params) |
| 107 | + |
| 108 | + |
| 109 | +def advanced_pv_power( |
| 110 | + resource_id: int, start: str, end: str = None, duration: str = None, **kwargs |
| 111 | +) -> PandafiableResponse: |
| 112 | + """ |
| 113 | + Get historical high spec PV power estimated actuals for the requested site, |
| 114 | + derived from satellite (clouds and irradiance over non-polar continental areas) |
| 115 | + and numerical weather models (other data). |
| 116 | +
|
| 117 | + Args: |
| 118 | + resource_id: a Solcast resource id |
| 119 | + start: datetime-like, first day of the requested period |
| 120 | + end: optional, datetime-like, last day of the requested period |
| 121 | + duration: optional, ISO_8601 compliant duration for the historic data. |
| 122 | + Must be within 31 days of the start_date. |
| 123 | + **kwargs: additional keyword arguments to be passed through as URL parameters to the Solcast API |
| 124 | +
|
| 125 | + See https://docs.solcast.com.au/ for full list of parameters. |
| 126 | + """ |
| 127 | + client = Client( |
| 128 | + base_url=base_url, |
| 129 | + endpoint=historic_advanced_pv_power, |
| 130 | + response_type=PandafiableResponse, |
| 131 | + ) |
| 132 | + |
| 133 | + assert (end is None and duration is not None) | ( |
| 134 | + duration is None and end is not None |
| 135 | + ), "only one of duration or end" |
| 136 | + |
| 137 | + params = { |
| 138 | + "resource_id": resource_id, |
| 139 | + "start": start, |
| 140 | + "format": "json", |
| 141 | + **kwargs, |
| 142 | + } |
| 143 | + |
| 144 | + if end is not None: |
| 145 | + params["end"] = end |
| 146 | + if duration is not None: |
| 147 | + params["duration"] = duration |
| 148 | + |
| 149 | + return client.get(params) |
0 commit comments