Difference between revisions of "EMD-API - Wind Energy Index Service"

From Wiki-WindPRO
Jump to navigation Jump to search
Line 1: Line 1:
 
[[Category:EMD-API]][[Image:wind-energy-in-dk.png|thumb|350px|right|Comissioning of On-Shore Wind Turbines in Denmark.]][[File:EMDAPI_451x303.jpg|thumb|350px|right]]
 
[[Category:EMD-API]][[Image:wind-energy-in-dk.png|thumb|350px|right|Comissioning of On-Shore Wind Turbines in Denmark.]][[File:EMDAPI_451x303.jpg|thumb|350px|right]]
 
== Introduction ==
 
== Introduction ==
The wind-energy-index service is available as a global service - providing reliable wind-index information for turbine locations in any part of the world.
+
The Wind Energy Index Service is available as a global service - providing reliable wind-index information for turbine locations in any part of the world.
The service is available from a REST / OPENAPI interface. This page describes how to install the service - and how to consume it from a python client. Resources for the OpenAPI standard and the data model are here:  
+
The service is available from a REST / OPENAPI interface. This page describes how to install the service - and how to consume it from a Python client. Resources for the OpenAPI standard and the data model are here:  
  
 
* [https://swagger.io/specification/ OpenAPI-standard] - at Swagger / Smartbear
 
* [https://swagger.io/specification/ OpenAPI-standard] - at Swagger / Smartbear
Line 8: Line 8:
  
 
Please note:   
 
Please note:   
* This EMD-API introduction is aimed at programmers, modellers or analysts who are working with machine-driven interfaces and workflows, typically using programming languages like [https://www.python.org/ python] or [https://www.r-project.org/about.html R].  
+
* This EMD-API introduction is aimed at programmers, modellers or analysts who are working with machine-driven interfaces and workflows, typically using programming languages like [https://www.python.org/ Python] or [https://www.r-project.org/about.html R].  
* Also note, that we provide a python (jupyter notebook) example to get you kick-started in using our API-services and to integrate towards your own services and tools.
+
* Also note, that we provide a Python (Jupyter Notebook) example to get you kick-started in using our API-services and to integrate towards your own services and tools.
  
 
== Access ==
 
== Access ==
Line 18: Line 18:
 
* EMD-API Wind Energy Index UI (API) - [https://api.emd.dk/wind-index/ui/ here].
 
* EMD-API Wind Energy Index UI (API) - [https://api.emd.dk/wind-index/ui/ here].
  
Any tehnical questions on our Wind Energy Index Services can be addressed to our Senior Wind Energy Consultant Henrik S. Pedersen: [mailto:hsp@emd.dk hsp@emd.dk].
+
Any technical questions on our Wind Energy Index Services can be addressed to our Senior Wind Energy Consultant Henrik S. Pedersen: [mailto:hsp@emd.dk hsp@emd.dk].
  
 
== Data Model - Wind Energy Index Service ==
 
== Data Model - Wind Energy Index Service ==
The EMD wind-energy-index service is documented in a REST based API using the OpenAPI Specification. You can view the interfaces and download the interfaces as json or yaml, [https://api.emd.dk/wind-index/ui/ here]. The service provides the following functionality:
+
The EMD Wind Energy Index Service is documented in a REST based API using the OpenAPI Specification. You can view the interfaces and download the interfaces as JSON or YAML, [https://api.emd.dk/wind-index/ui/ here]. The service provides the following functionality:
  
 
* ''List Turbines'': Available turbines with their identification ID. The list is private and will return all turbines connected to your account.
 
* ''List Turbines'': Available turbines with their identification ID. The list is private and will return all turbines connected to your account.
Line 32: Line 32:
  
 
* ''month_index'': Wind energy index for current month (seen in comparison to reference period of 2004-2018)
 
* ''month_index'': Wind energy index for current month (seen in comparison to reference period of 2004-2018)
* ''month_abnormality_index'': Deviation of current month seen in comparison to average-index of the same month in full reference period (eg. index for january-2020 divided by average-january-2004-2018).
+
* ''month_abnormality_index'': Deviation of current month seen in comparison to average-index of the same month in full reference period (e.g. index for January-2020 divided by average-January-2004-2018).
 
* ''last12_month_index'': Average index of the previous 12 month (including the month of consideration) compared to reference period (2004-2018).
 
* ''last12_month_index'': Average index of the previous 12 month (including the month of consideration) compared to reference period (2004-2018).
 
* ''predicted_production'': Estimated production for the month (kWh).
 
* ''predicted_production'': Estimated production for the month (kWh).
* ''last_full_quarter_index'': Average index for the previous calender quarter (e.g. when requesting data from 2019-02 (february), this index returned will be from 2018-Q4)
+
* ''last_full_quarter_index'': Average index for the previous calendar quarter (e.g. when requesting data from 2019-02 (February), this index returned will be from 2018-Q4)
* ''last_full_year_index'': Average index for the previous calender year (e.g. when requesting data from 2019-02 (february), this index returned will be from 2018)
+
* ''last_full_year_index'': Average index for the previous calendar year (e.g. when requesting data from 2019-02 (February), this index returned will be from 2018)
  
 
== Python - Installation ==  
 
== Python - Installation ==  
[[File:turbinelocation_sample.png|thumb|350px|right|Turbine Location from EMD-API.]]The simplest way to use the EMDAPI with python is to install the client software in a virtual environment. If you are using CONDA or [https://docs.conda.io/en/latest/miniconda.html MINICONDA], we recommend that you create a new virtual environment and use a recent 3.x version of python. When the virtual environment is created, then activate the environment.
+
[[File:turbinelocation_sample.png|thumb|350px|right|Turbine Location from EMD-API.]]The simplest way to use the EMDAPI with Python is to install the client software in a virtual environment. If you are using CONDA or [https://docs.conda.io/en/latest/miniconda.html MINICONDA], we recommend that you create a new virtual environment and use a recent 3.x version of Python. When the virtual environment is created, then activate the environment.
  
 
''Open your Anaconda Prompt. Copy-paste the following lines:''
 
''Open your Anaconda Prompt. Copy-paste the following lines:''
Line 47: Line 47:
 
</pre>
 
</pre>
  
Install the required packages needed in order to do data-science and use the examples provided within the jupyter notebooks. We have have validated this setup using specific package versions (used in the commands below).  
+
Install the required packages needed in order to do data-science and use the examples provided within the Jupyter Notebooks. We have validated this setup using specific package versions (used in the commands below).  
  
 
''In the  Anaconda Prompt, copy-paste the following lines, one by one:''
 
''In the  Anaconda Prompt, copy-paste the following lines, one by one:''
Line 56: Line 56:
 
</pre>
 
</pre>
  
Download the [https://help.emd.dk/mediawiki/images/d/df/20201210_python_client_generated_windindex.zip zip-file] holding the OpenAPI python client for the emdapi wind-index-service. <br>
+
Download the [https://help.emd.dk/mediawiki/images/d/df/20201210_python_client_generated_windindex.zip zip-file] holding the OpenAPI Python client for the emdapi wind-index-service. <br>
 
Unpack the file and install it within your virtual environment:
 
Unpack the file and install it within your virtual environment:
  
Line 66: Line 66:
 
== Python and Jupyter Notebook Examples for Demonstration and Test ==
 
== Python and Jupyter Notebook Examples for Demonstration and Test ==
 
[[File:windindex_krogstrupenge.png|thumb|450px|right|Wind Index From Years 2018-2019 with Reference Period (2004-2018)]]
 
[[File:windindex_krogstrupenge.png|thumb|450px|right|Wind Index From Years 2018-2019 with Reference Period (2004-2018)]]
In order to test your setup and learn how-to use the EMDAPI Wind Energy Index Service, we suggest that you download our jupyter-notebook and python examples - [https://help.emd.dk/mediawiki/images/e/e7/20201217_EMDAPI_WindIndexService.zip here].<br>
+
In order to test your setup and learn how-to use the EMDAPI Wind Energy Index Service, we suggest that you download our Jupyter Notebook and Python examples - [https://help.emd.dk/mediawiki/images/e/e7/20201217_EMDAPI_WindIndexService.zip here].<br>
 
Unpack the zip files and run the command below in your terminal or command-shell.<br>
 
Unpack the zip files and run the command below in your terminal or command-shell.<br>
If jupyter prompts for you to select another python-kernel, then select the emdapiwindindex kernel (may also be selected directly from the 'Kernel' drop-down menu).
+
If Jupyter prompts for you to select another Python-kernel, then select the emdapiwindindex kernel (may also be selected directly from the 'Kernel' drop-down menu).
  
''In the Anaconda Prompt: Move to the folder, where you have saved the jupyter-notebook examples. Copy paste the following line to open jupyter notebook from where you can open the examples.''  
+
''In the Anaconda Prompt: Move to the folder, where you have saved the Jupyter Notebook examples. Copy paste the following line to open Jupyter Notebook from where you can open the examples.''  
 
<pre>
 
<pre>
 
jupyter notebook
 
jupyter notebook
 
</pre>
 
</pre>
  
Within the internet-browser (and jupyter user-interface), run select the notebook file (*.ipynb). <br>
+
Within the internet-browser (and Jupyter user-interface), run select the Jupyter Notebook file (*.ipynb). <br>
Then work your way through through the example provided:
+
Then work your way through the example provided:
  
 
# ''emdapi_windindexservice.ipynb'' Demonstration of login to the system, plotting turbine data and requesting wind-energy-index data.
 
# ''emdapi_windindexservice.ipynb'' Demonstration of login to the system, plotting turbine data and requesting wind-energy-index data.
 
# ''emdapi_windindex_python.py'': Python code to demonstrate API login and requests for data (to execute - simply run ''python emdapi_windindex_python.py'' in your conda environment)
 
# ''emdapi_windindex_python.py'': Python code to demonstrate API login and requests for data (to execute - simply run ''python emdapi_windindex_python.py'' in your conda environment)
  
Make sure that the new emdapi virtual enviroment (python-kernel) is available to be used with jupyter-notebook environment:
+
Make sure that the new emdapi virtual environment (python-kernel) is available to be used with Jupyter Notebook environment:
 
<pre>
 
<pre>
 
python -m ipykernel install --user --name=emdapiwindindex
 
python -m ipykernel install --user --name=emdapiwindindex
Line 87: Line 87:
  
 
== Client Software Other Languages and Tools ==
 
== Client Software Other Languages and Tools ==
REST and OpenAPI is easily consumed from a lot of software tools. It is perfectly possible that your preferred language is supported. OpenAPI works well with languages such as - but not limited to - C#, R, python, java, php, scala and swift. Just download the YAML or JSON service description and use the [https://editor.swagger.io/ Swagger Editor] or [https://github.com/OpenAPITools/openapi-generator OpenAPI Generator] to generate the client libraries for your preferred software. Then you are ready to integrate towards your preferred systems and workflows.
+
REST and OpenAPI is easily consumed from a lot of software tools. It is perfectly possible that your preferred language is supported. OpenAPI works well with languages such as - but not limited to - C#, R, Python, Java, PHP, Scala and Swift. Just download the YAML or JSON service description and use the [https://editor.swagger.io/ Swagger Editor] or [https://github.com/OpenAPITools/openapi-generator OpenAPI Generator] to generate the client libraries for your preferred software. Then you are ready to integrate towards your preferred systems and workflows.
  
To generate the client libries yourself - one possible process is to:
+
To generate the client libraries yourself - one possible approach is to:
  
 
# Download the OpenAPI (openapi.yaml or openapi.json) description files - [https://api.emd.dk/wind-index/openapi.yaml here-yaml] or [https://api.emd.dk/wind-index/openapi.json here-json]
 
# Download the OpenAPI (openapi.yaml or openapi.json) description files - [https://api.emd.dk/wind-index/openapi.yaml here-yaml] or [https://api.emd.dk/wind-index/openapi.json here-json]
# Load it into the swagger editor - [https://editor.swagger.io here]
+
# Load it into the Swagger editor - [https://editor.swagger.io here]
# Choose to "Generate Client" from the drop-down menu within the swagger editor.
+
# Choose to "Generate Client" from the drop-down menu within the Swagger editor.

Revision as of 11:49, 18 December 2020

Comissioning of On-Shore Wind Turbines in Denmark.
EMDAPI 451x303.jpg

Introduction

The Wind Energy Index Service is available as a global service - providing reliable wind-index information for turbine locations in any part of the world. The service is available from a REST / OPENAPI interface. This page describes how to install the service - and how to consume it from a Python client. Resources for the OpenAPI standard and the data model are here:

Please note:

  • This EMD-API introduction is aimed at programmers, modellers or analysts who are working with machine-driven interfaces and workflows, typically using programming languages like Python or R.
  • Also note, that we provide a Python (Jupyter Notebook) example to get you kick-started in using our API-services and to integrate towards your own services and tools.

Access

The API is currently (December 2020) in beta-release. To see more documentation and to access the data-services, please visit the API through the following URL's:

  • EMD-API Overview (Wiki) - here.
  • EMD-API Main Page (API) - here.
  • EMD-API Wind Energy Index UI (API) - here.

Any technical questions on our Wind Energy Index Services can be addressed to our Senior Wind Energy Consultant Henrik S. Pedersen: hsp@emd.dk.

Data Model - Wind Energy Index Service

The EMD Wind Energy Index Service is documented in a REST based API using the OpenAPI Specification. You can view the interfaces and download the interfaces as JSON or YAML, here. The service provides the following functionality:

  • List Turbines: Available turbines with their identification ID. The list is private and will return all turbines connected to your account.
  • Turbine Details: Name, data-availability, hub-height, position-latitude, position-longitude, power-curve, control-strategy, rated-power, training-start, training-end, time-zone.
  • Wind Energy Index Data: Month-wind-index, month-anomaly-index, month-predicted-production, last-quarter-index, last-12-months-average-index
    • Request data for all months between 1990 and present
    • Request data for specific month between 1990 and present

Reference index period is the 15-year period from 2004-2018 (both years inclusive). Currently, the following parameters are returned from the wind-energy-index tables:

  • month_index: Wind energy index for current month (seen in comparison to reference period of 2004-2018)
  • month_abnormality_index: Deviation of current month seen in comparison to average-index of the same month in full reference period (e.g. index for January-2020 divided by average-January-2004-2018).
  • last12_month_index: Average index of the previous 12 month (including the month of consideration) compared to reference period (2004-2018).
  • predicted_production: Estimated production for the month (kWh).
  • last_full_quarter_index: Average index for the previous calendar quarter (e.g. when requesting data from 2019-02 (February), this index returned will be from 2018-Q4)
  • last_full_year_index: Average index for the previous calendar year (e.g. when requesting data from 2019-02 (February), this index returned will be from 2018)

Python - Installation

Turbine Location from EMD-API.

The simplest way to use the EMDAPI with Python is to install the client software in a virtual environment. If you are using CONDA or MINICONDA, we recommend that you create a new virtual environment and use a recent 3.x version of Python. When the virtual environment is created, then activate the environment.

Open your Anaconda Prompt. Copy-paste the following lines:

conda create -n emdapiwindindex python=3.8.5
conda activate emdapiwindindex

Install the required packages needed in order to do data-science and use the examples provided within the Jupyter Notebooks. We have validated this setup using specific package versions (used in the commands below).

In the Anaconda Prompt, copy-paste the following lines, one by one:

conda install -c conda-forge pandas=1.1.0 numpy=1.19.1 matplotlib=3.3.1 pyproj=3.0.0
conda install -c conda-forge jupyter=1.0.0 ipykernel=5.3.4 
pip install tilemapbase

Download the zip-file holding the OpenAPI Python client for the emdapi wind-index-service.
Unpack the file and install it within your virtual environment:

In the Anaconda Prompt: Move to the folder, where you have unpacked the zipped file. Copy-paste the following line:

python setup.py install

Python and Jupyter Notebook Examples for Demonstration and Test

Wind Index From Years 2018-2019 with Reference Period (2004-2018)

In order to test your setup and learn how-to use the EMDAPI Wind Energy Index Service, we suggest that you download our Jupyter Notebook and Python examples - here.
Unpack the zip files and run the command below in your terminal or command-shell.
If Jupyter prompts for you to select another Python-kernel, then select the emdapiwindindex kernel (may also be selected directly from the 'Kernel' drop-down menu).

In the Anaconda Prompt: Move to the folder, where you have saved the Jupyter Notebook examples. Copy paste the following line to open Jupyter Notebook from where you can open the examples.

jupyter notebook

Within the internet-browser (and Jupyter user-interface), run select the Jupyter Notebook file (*.ipynb).
Then work your way through the example provided:

  1. emdapi_windindexservice.ipynb Demonstration of login to the system, plotting turbine data and requesting wind-energy-index data.
  2. emdapi_windindex_python.py: Python code to demonstrate API login and requests for data (to execute - simply run python emdapi_windindex_python.py in your conda environment)

Make sure that the new emdapi virtual environment (python-kernel) is available to be used with Jupyter Notebook environment:

python -m ipykernel install --user --name=emdapiwindindex

Client Software Other Languages and Tools

REST and OpenAPI is easily consumed from a lot of software tools. It is perfectly possible that your preferred language is supported. OpenAPI works well with languages such as - but not limited to - C#, R, Python, Java, PHP, Scala and Swift. Just download the YAML or JSON service description and use the Swagger Editor or OpenAPI Generator to generate the client libraries for your preferred software. Then you are ready to integrate towards your preferred systems and workflows.

To generate the client libraries yourself - one possible approach is to:

  1. Download the OpenAPI (openapi.yaml or openapi.json) description files - here-yaml or here-json
  2. Load it into the Swagger editor - here
  3. Choose to "Generate Client" from the drop-down menu within the Swagger editor.