Metadata-Version: 2.1
Name: statnett-api-client
Version: 0.1.3
Summary: Statnett API Client
Home-page: https://github.com/viktorsapozhok/statnett-api-client
Author: Alex Piskun
Author-email: piskun.aleksey@gmail.com
License: UNKNOWN
Keywords: Statnett,API,Nordic power flow,Nordic power balance
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: requests
Requires-Dist: pandas (>=0.24.0)

# Statnett API Client

Client presents methods for reading real-time Nordic power balance data provided 
by the Norwegian Transmission System Operator ([statnett.no](https://www.statnett.no/)). 

The full list of topics accessible via Statnett REST API can be seen [here](http://driftsdata.statnett.no/restapi).

Client supports reading of the following topics:

* [Nordic Power Balance](https://www.statnett.no/en/for-stakeholders-in-the-power-industry/data-from-the-power-system/#nordic-power-balance)
* [Nordic Power Flow](https://www.statnett.no/en/for-stakeholders-in-the-power-industry/data-from-the-power-system/#nordic-power-flow)
* [Grid Frequency](https://www.statnett.no/en/for-stakeholders-in-the-power-industry/data-from-the-power-system/#nordic-power-balance)

## Installation

To install the Client, simply use pip:

```
$ pip install statnett_api_client
``` 

## Basic Usage

```python
from statnett_api_client import get_flow, get_balance, get_frequency

# read power flow  
flow = get_flow(fmt='pandas')

# read balance data
balance = get_balance(fmt='pandas')

# read grid frequency
freq = get_frequency(fmt='pandas')
```

## Parameters

You can specify format of returned object using `fmt` parameter.  

```python
# this will return flow in json format 
flow = get_flow(fmt='json')
# this will return pandas dataframe
flow = get_flow(fmt='pandas')
```

Specify `date2index` if you want to add dates to dataframe index.

```python
flow = get_balance(fmt='pandas', date2index=True)
```

By default, the time is in UTC. To add a column with Central European Time (CET), 
you need to specify `time_cet` parameter.

```python
frequency = get_frequency(fmt='pandas', date2index=True, time_cet=True)
```

Sometimes it can be useful to add `hour` column to result dataframe. It can be achieved by 
specifying `add_hour` parameter. If `time_cet` is True, then two columns are added, 
`hour_utc` and `hour_cet`.   

```python
flow = get_flow(fmt='pandas', time_cet=True, add_hour=True)
```

To get frequency data for time period, you need to scecify `date_from` parameter. Supports only for 
`frequency` topic.

```python
freq = get_frequency(fmt='pandas', date_from='2019-06-07 21:30')
```

## License

The Client is released under [MIT License](https://github.com/viktorsapozhok/statnett-api-client/blob/master/LICENSE). 


