Skip to content

Commit e714a82

Browse files
upload
0 parents  commit e714a82

35 files changed

Lines changed: 2136 additions & 0 deletions

.github/workflows/black.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Lint
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
- uses: psf/black@stable
11+
with:
12+
options: "--check --verbose -C"
13+
src: "./solcast"
14+
jupyter: false

.github/workflows/docs.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Docs
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- main
7+
permissions:
8+
contents: write
9+
jobs:
10+
deploy:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-python@v4
15+
with:
16+
python-version: 3.x
17+
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
18+
- uses: actions/cache@v3
19+
with:
20+
key: mkdocs-material-${{ env.cache_id }}
21+
path: .cache
22+
restore-keys: |
23+
mkdocs-material-
24+
- run: pip install .[docs]
25+
- run: mkdocs gh-deploy --force
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Publish 📦 to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
build-and-publish:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Install pypa/build
16+
run: >-
17+
python3 -m
18+
pip install
19+
build
20+
--user
21+
22+
- name: Build a binary wheel and a source tarball
23+
run: >-
24+
python3 -m
25+
build
26+
--sdist
27+
--wheel
28+
--outdir dist/
29+
.
30+
# - name: Publish distribution 📦 to Test PyPI
31+
# uses: pypa/gh-action-pypi-publish@release/v1
32+
# with:
33+
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
34+
# repository-url: https://test.pypi.org/legacy/
35+
- name: Publish distribution 📦 to PyPI
36+
if: startsWith(github.ref, 'refs/tags')
37+
uses: pypa/gh-action-pypi-publish@release/v1
38+
with:
39+
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/test.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Tests
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
strategy:
8+
matrix:
9+
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
10+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
11+
runs-on: ${{ matrix.os }}
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Set up Python ${{ matrix.python-version }}
15+
uses: actions/setup-python@v4
16+
with:
17+
python-version: ${{ matrix.python-version }}
18+
- name: Install dependencies
19+
run: |
20+
python -m pip install --upgrade pip
21+
pip install .[all]
22+
- name: Test with pytest
23+
env:
24+
SOLCAST_API_KEY: ${{ secrets.SOLCAST_API_KEY }}
25+
run: |
26+
pytest tests

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
public
2+
.idea
3+
*.ipynb_checkpoints
4+
.pytest_cache
5+
tests/__pycache__

LICENSE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright [2023] [Solcast]
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<img src="https://github.com/Solcast/solcast-api-python-sdk/blob/main/docs/img/logo.png?raw=true" width="100" align="right">
2+
3+
# Solcast API Python SDK
4+
5+
<em>simple Python SDK to access the Solcast API</em>
6+
7+
[![Docs](https://github.com/Solcast/solcast-api-python-sdk/actions/workflows/docs.yml/badge.svg)](https://github.com/Solcast/solcast-api-python-sdk/actions/workflows/docs.yml) [![Tests](https://github.com/Solcast/solcast-api-python-sdk/actions/workflows/test.yml/badge.svg)](https://github.com/Solcast/solcast-api-python-sdk/actions/workflows/test.yml) [![Publish 📦 to PyPI](https://github.com/Solcast/solcast-api-python-sdk/actions/workflows/publish-to-pypi.yml/badge.svg)](https://github.com/Solcast/solcast-api-python-sdk/actions/workflows/publish-to-pypi.yml)
8+
9+
---
10+
11+
**Documentation**: <a href="https://solcast.github.io/solcast-api-python-sdk/" target="_blank">https://solcast.github.io/solcast-api-python-sdk/ </a>
12+
13+
## Install
14+
```commandline
15+
git clone https://github.com/Solcast/solcast-api-python-sdk.git
16+
cd solcast-api-python-sdk
17+
pip install .
18+
# also pip install .[all] for the dev libs
19+
```
20+
## Basic Usage
21+
22+
```python
23+
from solcast import live
24+
25+
df = live.radiation_and_weather(
26+
latitude=-33.856784,
27+
longitude=151.215297,
28+
output_parameters=['air_temp', 'dni', 'ghi']
29+
).to_pandas()
30+
```
31+
---
32+
33+
## Contributing
34+
Tests are run against the Solcast API, you will need a key to run them.
35+
They are executed on `unmetered locations` and as such won't consume your credits.
36+
37+
```commandline
38+
pytest tests
39+
```

docs/api/client.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
::: solcast.api.Client

docs/api/response.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
::: solcast.api.Response

docs/forecast.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Forecast
2+
Get irradiance, weather and power forecasts from the present time up to 14 days ahead for
3+
the requested location, derived from satellite (clouds and irradiance over non-polar continental areas,
4+
nowcasted for approx. four hours ahead) and numerical weather models (other data and longer horizons).
5+
More information in the [API docs](https://docs.solcast.com.au/#49090b36-66db-4d0f-89d5-87d19f00bec1).
6+
7+
The module `forecast` has 3 available methods:
8+
9+
| Endpoint | API Docs |
10+
|-------------------------|-------------------------------------------------------------------------------------------|
11+
| `radiation_and_weather` | [details](https://docs.solcast.com.au/?#b78a2ee4-c8e5-4ae6-9fb3-c8bbefe91efc){.md-button} |
12+
| `rooftop_pv_power` | [details](https://docs.solcast.com.au/?#25ff8ad7-e2a8-44be-9d2e-62e0f73cefd6){.md-button} |
13+
| `advanced_pv_power` | [details](https://docs.solcast.com.au/?#0c9d3ccf-e2a4-4583-86a3-f89c8d658fde){.md-button} |
14+
15+
### Example
16+
17+
```python
18+
from solcast import forecast
19+
20+
res = forecast.radiation_and_weather(
21+
latitude=-33.856784,
22+
longitude=151.215297,
23+
output_parameters='air_temp'
24+
)
25+
26+
res.to_pandas().head()
27+
```
28+
29+
| period_end | air_temp |
30+
|:--------------------------|-----------:|
31+
| 2023-08-18 04:00:00+00:00 | 16 |
32+
| 2023-08-18 04:30:00+00:00 | 15 |
33+
| 2023-08-18 05:00:00+00:00 | 15 |
34+
| 2023-08-18 05:30:00+00:00 | 15 |
35+
| 2023-08-18 06:00:00+00:00 | 15 |

0 commit comments

Comments
 (0)