Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,33 @@ cd solcast-api-python-sdk
pip install .
```

The vanilla version doesn't have any dependency. For full functionality,
for example for getting the data into `DataFrames`, and for development, use the `[all]` tag:
The base solcast sdk install requires only the python standard library.
Pandas is the only optional dependency that adds functionality to the package.

```commandline
pip install .[all] for the dev libs
pip install solcast pandas
```

The example notebooks use a variety of optional dependencies to showcase different
ways in which the Solcast API may be used. To install these dependencies run

```commandline
pip install solcast[all]
```


## Basic Usage

```python
from solcast import live

df = live.radiation_and_weather(
res = live.radiation_and_weather(
latitude=-33.856784,
longitude=151.215297,
output_parameters=['air_temp', 'dni', 'ghi']
).to_pandas()
)
res.to_dict()
res.to_pandas() # requires optional pandas installation
```

Don't forget to set your [account Api Key](https://toolkit.solcast.com.au/register) with:
Expand All @@ -57,6 +67,15 @@ They are executed on `unmetered locations` and as such won't consume your reques
pytest tests
```

## Docs

From the directory run
```bash
mkdocs build
mkdocs serve
```
In a browser navigate to `localhost:8000` to see the documentation.

### Formatters and Linters

| Language | Formatter/Linter |
Expand Down
1 change: 1 addition & 0 deletions docs/api/pandafiableresponse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: solcast.api.PandafiableResponse
43 changes: 21 additions & 22 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
# Welcome to Solcast
A simple Python SDK that wraps [Solcast's API](https://docs.solcast.com.au/).
A simple Python SDK that wraps [Solcast's API](https://docs.solcast.com.au/).

## Install
From the directory run the following command:
```bash
```bash
pip install --user solcast
```
!!! tip

for full functionality install **all**: `pip install --user solcast[all]`
for full functionality install **pandas**: `pip install --user solcast pandas`

The example notebooks use a variety of optional dependencies to showcase different
ways in which the Solcast API may be used. To install these dependencies run

```commandline
pip install --user solcast[all]
```

## Usage
!!! warning
!!! warning

To access Solcast data you will need a [commercial API key](https://toolkit.solcast.com.au/register). If you have the API key already,
you can use it with this library either as an environment variable called SOLCAST_API_KEY,
or you can pass it as an argument `api_key` when you call one of the library's methods.
or you can pass it as an argument `api_key` when you call one of the library's methods.

Fetching live radiation and weather data:

Expand All @@ -40,7 +47,7 @@ from solcast.unmetered_locations import UNMETERED_LOCATIONS
sydney = UNMETERED_LOCATIONS['Sydney Opera House']

res = forecast.rooftop_pv_power(
latitude=sydney['latitude'],
latitude=sydney['latitude'],
longitude=sydney['longitude'],
period='PT5M',
capacity=5, # 5KW
Expand All @@ -49,22 +56,22 @@ res = forecast.rooftop_pv_power(
)
```


Where the data returned is a timeseries, the response can be converted to a Pandas DataFrame as follows. This is available for all the modules apart from `pv_power_sites`.
All response data can be extracted in Python dictionary format.

```python
df = res.to_pandas()
d = res.to_dict()
```
!!! info
Pandas is not installed by default to keep the environment light. It is installed with the [all] tag

For all the modules, data can be extracted in Python dictionary format.
If pandas is installed, timeseries responses can be converted to a Pandas DataFrame using the ``.to_pandas()`` method.

```python
df = res.to_dict()
df = res.to_pandas()
```
!!! info
Pandas is not installed by default to keep the environment light.


Available modules are
Available modules are

| Module | API Docs |
|------------------|------------------------------------------|
Expand All @@ -76,14 +83,6 @@ Available modules are
| `aggregations` | [solcast.aggregations](aggregations.md) |


## Docs
from the directory run
```bash
mkdocs build
mkdocs serve
```
In a browser navigate to `localhost:8000` to see the documentation.

## Contributing & License
Any type of suggestion and code contribution is welcome as PRs and/or Issues.
This repository is licensed under MIT (see LICENSE).
15 changes: 3 additions & 12 deletions docs/notebooks/1.3 Getting Data - Make Concurrent Requests.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,6 @@
"It is important to note that it is possible to exceed your rate limit as you increase the number of parallel downloads, which may cause some requests to fail!"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"# ! pip install pandas matplotlib"
]
},
{
"cell_type": "code",
"execution_count": 1,
Expand Down Expand Up @@ -82,7 +73,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -223,8 +214,8 @@
" df.append(res.to_pandas())\n",
" else:\n",
" # NOTE for production purposes you will need to deal with API failures, e.g. due rate-limiting!\n",
" pass \n",
" \n",
" pass\n",
"\n",
"df = pd.concat(df)\n",
"df"
]
Expand Down
Loading