Repository navigation
Add missing Python SDK endpoints #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nik-solcast
wants to merge
2
commits into
main
Choose a base branch
from
feature/python-sdk-endpoint-coverage
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # Schedules | ||
|
|
||
| Retrieve and update availability or curtailment schedules for Premium PV and Wind resources. | ||
|
|
||
| | Method | Purpose | API Docs | | ||
| |---|---|---| | ||
| | `get_resource_schedule` | Retrieve schedule intervals for a time window. | [details](https://docs.solcast.com.au/docs/section/premium#getManageSchedules) | | ||
| | `patch_resource_schedule` | Merge availability and/or curtailment intervals into the schedule. | [details](https://docs.solcast.com.au/docs/section/premium#patchManageSchedules) | | ||
| | `delete_resource_schedule` | Remove schedule data for a time window and schedule type(s). | [details](https://docs.solcast.com.au/docs/section/premium#deleteManageSchedules) | | ||
|
|
||
| ## Retrieve a schedule | ||
|
|
||
| ```python | ||
| from solcast import schedules | ||
|
|
||
| response = schedules.get_resource_schedule( | ||
| resource_id="your-premium-site", | ||
| period_start="2026-01-01T00:00:00Z", | ||
| period_end="2026-01-02T00:00:00Z", | ||
| ) | ||
|
|
||
| data = response.to_dict() | ||
| ``` | ||
|
|
||
| ## Patch schedule intervals | ||
|
|
||
| ```python | ||
| response = schedules.patch_resource_schedule( | ||
| resource_id="your-premium-site", | ||
| availability_schedule=[ | ||
| { | ||
| "period_start": "2026-01-01T00:00:00Z", | ||
| "period_end": "2026-01-01T01:00:00Z", | ||
| "availability": 75, | ||
| } | ||
| ], | ||
| ) | ||
| ``` | ||
|
|
||
| ## Delete schedule data | ||
|
|
||
| ```python | ||
| response = schedules.delete_resource_schedule( | ||
| resource_id="your-premium-site", | ||
| period_start="2026-01-01T00:00:00Z", | ||
| period_end="2026-01-02T00:00:00Z", | ||
| schedule_type="availability,curtailment", | ||
| ) | ||
| ``` | ||
|
|
||
| All methods return the SDK `Response` object. Use `response.to_dict()` to inspect the JSON response. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
nik-solcast marked this conversation as resolved.
Resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| # Wind Power Sites | ||
|
|
||
| Manage Premium Wind power site resources. | ||
|
|
||
| | Method | Purpose | API Docs | | ||
| |---|---|---| | ||
| | `list_wind_power_sites` | List accessible sites, with optional search and filters. | [details](https://docs.solcast.com.au/docs/section/premium#getResourcesWindPowerSites) | | ||
| | `get_wind_power_site` | Retrieve a site by resource ID. | [details](https://docs.solcast.com.au/docs/section/premium#getResourcesWindPowerSite) | | ||
| | `create_wind_power_site` | Create a site. Name, coordinates, and capacity are required. | [details](https://docs.solcast.com.au/docs/section/premium#postResourcesWindPowerSite) | | ||
| | `patch_wind_power_site` | Partially update fields supplied in the request. | [details](https://docs.solcast.com.au/docs/section/premium#patchResourcesWindPowerSite) | | ||
| | `update_wind_power_site` | Replace a site definition. Resource ID, name, coordinates, and capacity are required. | [details](https://docs.solcast.com.au/docs/section/premium#putResourcesWindPowerSite) | | ||
| | `delete_wind_power_site` | Delete a site by resource ID. | [details](https://docs.solcast.com.au/docs/section/premium#deleteResourcesWindPowerSite) | | ||
|
|
||
| ## List and retrieve | ||
|
|
||
| ```python | ||
| from solcast import wind_power_sites | ||
|
|
||
| res = wind_power_sites.list_wind_power_sites(query="Sydney") | ||
| sites = res.to_dict()["results"] | ||
|
|
||
| site = wind_power_sites.get_wind_power_site( | ||
| resource_id="your-wind-resource-id", | ||
| ) | ||
| site.to_dict() | ||
| ``` | ||
|
|
||
| ## Create and update | ||
|
|
||
| Create a site with the required fields and any optional turbine settings: | ||
|
|
||
| ```python | ||
| res = wind_power_sites.create_wind_power_site( | ||
| name="Example wind site", | ||
| latitude=-33.8567, | ||
| longitude=151.2152, | ||
| capacity=5, | ||
| rotor_diameter=120, | ||
| hub_height=100, | ||
| number_of_turbines=2, | ||
| ) | ||
| resource_id = res.to_dict()["resource_id"] | ||
| ``` | ||
|
|
||
| PATCH changes only the fields supplied. PUT replaces the definition and requires the full set of required fields: | ||
|
|
||
| ```python | ||
| wind_power_sites.patch_wind_power_site( | ||
| resource_id=resource_id, | ||
| allow_negative_power=True, | ||
| ) | ||
|
|
||
| wind_power_sites.update_wind_power_site( | ||
| resource_id=resource_id, | ||
| name="Example wind site", | ||
| latitude=-33.8567, | ||
| longitude=151.2152, | ||
| capacity=5, | ||
| rotor_diameter=120, | ||
| hub_height=100, | ||
| number_of_turbines=2, | ||
| ) | ||
| ``` | ||
|
|
||
| ## Delete | ||
|
|
||
| ```python | ||
| wind_power_sites.delete_wind_power_site(resource_id=resource_id) | ||
| ``` | ||
|
|
||
| Each method returns the SDK `Response` object. Use `response.to_dict()` to inspect the JSON response. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this name will lead to confusion. It could be taken to mean that the other measurements are not utility scale, whereas in fact they are. That utility-scale endpoint is mainly used for the super_rapid product.
This is a bit of a mess now, because we have to clearly express what is different between
create_utility_scale_pv_site_measurementsandcreate_pv_site_measurements, with it not being clear that the latter is for premium.Also, I think it is unfortunate that we have ended up with repetitive naming, with the same information in the module name and the function name. Compare with forecasts where it is
forecast.premium_pv_power, notforecast.premium_pv_power_forecast. I should have picked up on that with previous reviews.Analogous with that would be
measurement.create_premium_pvmeasurement.create_premium_windmeasurement.create_standard_pv<- could be what we call non-premium usage?measurement.create_premium_pv_sub_siteetc.
That would be a major breaking change. If we are doing that, I think we should more fully plan it out before we proceed. E.g. when we introduce premium aggregations, do their forecasts go under the
aggregationsmodule or theforecastsmodule?