{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Modelling Solar generation across Multiple Sites - Part 1\n", "\n", "This example shows how `timeserio` helps building deep learning models for time series forecasting. Especially,\n", "we deal with the case of many related timeseries.\n", "\n", "We demonstrate some core functionality and concepts, without striving for model accuracy or seeking out additional features like historic weather forecasts.\n", "\n", "We will be using the dataset on solar (photo-voltaic, PV) generation potential across Europe, as collected by [SETIS](https://setis.ec.europa.eu/EMHIRES-datasets). The dataset presents solar generation, normalized to the solar capacity installed as of 2015." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Download the data" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "--2019-07-10 10:14:11-- https://setis.ec.europa.eu/sites/default/files/EMHIRES_DATA/Solar/EMHIRESPV_country_level.zip\n", "Resolving setis.ec.europa.eu (setis.ec.europa.eu)... 139.191.207.52\n", "Connecting to setis.ec.europa.eu (setis.ec.europa.eu)|139.191.207.52|:443... connected.\n", "HTTP request sent, awaiting response... 200 OK\n", "Length: 93401258 (89M) [application/zip]\n", "Saving to: ‘EMHIRESPV_country_level.zip’\n", "\n", "EMHIRESPV_country_l 100%[===================>] 89.07M 4.15MB/s in 17s \n", "\n", "2019-07-10 10:14:28 (5.16 MB/s) - ‘EMHIRESPV_country_level.zip’ saved [93401258/93401258]\n", "\n", "Archive: EMHIRESPV_country_level.zip\n", " inflating: EMHIRESPV_TSh_CF_Country_19862015.xlsx \n" ] } ], "source": [ "!mkdir -p ~/tmp/datasets; cd ~/tmp/datasets; wget https://setis.ec.europa.eu/sites/default/files/EMHIRES_DATA/Solar/EMHIRESPV_country_level.zip; unzip -o EMHIRESPV_country_level.zip; rm EMHIRESPV_country_level.zip" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Download data and save in a more performant format" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 1min 32s, sys: 268 ms, total: 1min 33s\n", "Wall time: 1min 33s\n" ] } ], "source": [ "%%time\n", "df = pd.read_excel(\"~/tmp/datasets/EMHIRESPV_TSh_CF_Country_19862015.xlsx\")" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | Time_step | \n", "Date | \n", "Year | \n", "Month | \n", "Day | \n", "Hour | \n", "AL | \n", "AT | \n", "BA | \n", "BE | \n", "... | \n", "NO | \n", "PL | \n", "PT | \n", "RO | \n", "RS | \n", "SI | \n", "SK | \n", "SE | \n", "XK | \n", "UK | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "1 | \n", "1986-01-01 00:00:00 | \n", "1986 | \n", "1 | \n", "1 | \n", "0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "... | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "
1 | \n", "2 | \n", "1986-01-01 01:00:00 | \n", "1986 | \n", "1 | \n", "1 | \n", "1 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "... | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "
2 | \n", "3 | \n", "1986-01-01 02:00:00 | \n", "1986 | \n", "1 | \n", "1 | \n", "2 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "... | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "
3 rows × 41 columns
\n", "\n", " | country | \n", "generation | \n", "prediction | \n", "
---|---|---|---|
0 | \n", "AL | \n", "0.167597 | \n", "0.173074 | \n", "
1 | \n", "AT | \n", "0.125796 | \n", "0.126038 | \n", "
2 | \n", "BA | \n", "0.134952 | \n", "0.136902 | \n", "