Skip to main content

OWI data 2 pandas is a package developed to ease the interaction with the OWI measurement data API

Project description

OWI data 2 pandas

OWI data 2 pandas is a package developed to ease the interaction with the OWI measurement data API.

Basic use

The most common use of the package is to query a fixed period of data:

Connection

Connecting to the API happens through the API class:

from owi_data_2_pandas.io import API

user = 'user_name' # replace with you user name
password = 'your_password'  # Replace with your password

root = r"http://10.0.0.138/api/v1/"

owi = API(api_root=root, username=user, password=password)

Querying for measurement data

Once an instance of the API class is made, you can get a Pandas DataFrame with your data in it. To do so you'll need to specify both the period of interest, the location and the metrics you would need.

In the example below we will query the period from 15/11/2018 till 16/11/2018 for BBC01 wind speed data:

import datetime
from pytz import utc

dt_start =  datetime.datetime(2018,11,15,tzinfo=utc)
dt_stop  = datetime.datetime(2018,11,16,tzinfo=utc)
df = owi.query((dt_start, dt_stop), location='bbc01', metrics=['mean_BB_C01_windspeed'])

This returns a Pandas DataFrame object.

Other useful queries

Check user groups

The permissions of a user a organized in so-called user groups. You can see the user groups allocated to the user through:

owi.groups

Check available parameters/metrics for a location

A list of available parameters/metrics for a given location can be obtained through:

owi.metrics(location='BBC01')

Advanced use

Interaction with dw_database and DynaWindFrame

The current package was designed without the use of the OWI-lab internal package dw_database. However should a user want to import the results of the API into a dw_database.utils.DynaWindFrame then this is easily achieved:

from dw_database.utils import DynawindFrame, Turbine

dwf = DynawindFrame(df=df, location=Turbine('BBC01'))

Basic troubleshooting

Some basic tips for initial troubleshooting:

  • Check that you can reach the server by sending a ping to the server
  • Check that you have the permissions (e.g. through the use of the groups query)
  • Check for typo's in your locations or metrics (e.g. use the metrics query)

Authors

owi_data_2_pandas was written in the context of the efforts of the OWI-lab, a Belgian research effort to bring down the cost of offshore wind.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

owi_data_api_2_pandas-0.1.0-py3-none-any.whl (6.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page