""" This simple example reads data from an INSTANCE curve Have a look at the documentation for further information: """ import wapi import pandas as pd import matplotlib.pyplot as plt ############################################ # Insert the path to your config file here! my_config_file = 'path/to/your/config.ini' ############################################ # Create a session to Connect to Wattsight Database session = wapi.Session(config_file=my_config_file) # define curve name to read, in this case temperature forecast for Germany curve_name = 'tt de con ec00 °c cet min15 f' # get the curve curve = session.get_curve(name=curve_name) # An INSTANCE curve contains a timeseries for each defined issue date # read timeseries data with issue date 01.01.2018 00:00 issue_date = pd.Timestamp('2018-1-1 00:00') ts = curve.get_instance(issue_date=issue_date) # convert to pandas.Series object s = ts.to_pandas() # plot curve using the integrated plot function of pandas s.plot()
import pandas as pd import numpy as np from scipy.stats import norm import dash_bootstrap_components as dbc import dash_html_components as html import dash_core_components as dcc import plotly.graph_objects as go from plotly.subplots import make_subplots from dash.dependencies import Input, Output, State import plotly.express as px import datetime as dt from app import app config_file_path = './/configfile.ini' session = wapi.Session(config_file=config_file_path) actual_consumption = session.get_curve( name='con de mwh/h cet min15 a').get_data( data_from='2021-03-20T00:00Z', data_to='2021-03-23T00:00Z').to_pandas().rename('act') forcast_consumption = session.get_curve( name='con de ec00 mwh/h cet min15 f').get_latest( data_from='2021-03-20T12:00Z').to_pandas().rename('fct')[:100] forcast_consumption = pd.merge(forcast_consumption, actual_consumption, how='outer', left_index=True, right_index=True) forcast_consumption = forcast_consumption[ forcast_consumption['act'].isnull()]['fct']
#pip install wapi-python first import wapi import pandas as pd import numpy as np import matplotlib.pyplot as plt session = wapi.Session( client_id='0Le.lY6.VzLuNCdwNNrX64aB6R8AI6I7', client_secret= 'BS35Qwr8NWLTZTG6obeAJpUtNVDuKwo.Y05joYoDs8nsLjYG5idmm7nXnBk9Y_vwXJrmHkjoEigJh4yZ4kMNqxV79XYT9rPbUZRG' ) print('Enter the Dataset Name') dataset = 'pro de wnd ec00 mwh/h cet min15 f' #dataset = input() #input: pro de wnd ec00 mwh/h cet min15 f (this is the forecasted production of wind power, DE) def getdata(name1): curve = session.get_curve(name=name1) ts = curve.get_instance(issue_date='2021-03-20T00:00') pd_s = ts.to_pandas() return pd_s data = getdata x = data(dataset) supply = x.to_frame()