import logging
import pandas as pd
import plotly as plt
import plotly.express as px
import plotly.graph_objects as go
import numpy as np
import json
import copy
import tim_client
with open('credentials.json') as f:
credentials_json = json.load(f)
TIM_URL = 'https://timws.tangent.works/v4/api'
SAVE_JSON = False
JSON_SAVING_FOLDER = 'logs/'
LOGGING_LEVEL = 'INFO'
level = logging.getLevelName(LOGGING_LEVEL)
logging.basicConfig(level=level, format='[%(levelname)s] %(asctime)s - %(name)s:%(funcName)s:%(lineno)s - %(message)s')
logger = logging.getLogger(__name__)
credentials = tim_client.Credentials(credentials_json['license_key'], credentials_json['email'], credentials_json['password'], tim_url=TIM_URL)
api_client = tim_client.ApiClient(credentials)
api_client.save_json = SAVE_JSON
api_client.json_saving_folder_path = JSON_SAVING_FOLDER
[INFO] 2020-11-03 15:42:44,972 - tim_client.api_client:save_json:66 - Saving JSONs functionality has been disabled [INFO] 2020-11-03 15:42:44,975 - tim_client.api_client:json_saving_folder_path:75 - JSON destination folder changed to logs
data = tim_client.load_dataset_from_csv_file('WindTurbine.csv', sep=';')
nrow, ncol = data.shape
print("Number of rows: ", nrow)
print("Number of columns: ", ncol)
Number of rows: 52547 Number of columns: 3
data.index = pd.to_datetime(data['Date'])
cols = data.columns
fig = plt.subplots.make_subplots(rows=2, cols=1, shared_xaxes=True, vertical_spacing=0.02)
fig.add_trace(go.Scatter(x=data.loc[:, "Date"], y=data.loc[:, "Wind Power"], name="Wind Power"), row=1, col=1)
fig.add_trace(go.Scatter(x=data.loc[:, "Date"], y=data.loc[:, "Wind Speed"], name="Wind Speed"), row=2, col=1)
fig.update_layout(height=700, width=1000, title_text="Data visualization")
fig.show()