How to
Structure of the page
The main usage of this page is the providing of datasets . These datasets are also associated with descriptive posts .
Search and Filter
You can filter posts and datasets by type, energy sources and projets or search for e.g. technical terms (e.g. solar).
Download
On the dataset pages there are download buttons. The data is provided as JSON result.
PostgREST API
The REST interface can be used for advanced work with the data. You can find more information about REST here.
The download buttons use REST for a database query:
opendata.ffe.de/api/od/v_opendata?id_opendata=eq.16
Therefore a view (v_opendata) provides the data as well as metadata. In order to simplify access and further use, the metadata of datasets on the Open Energy Platform (oep_metadata) were used as a model. Additional metadata like the years (simulation years) and weather years of the data, a citation suggestion and a key for the FfE internal online library are grouped as metadata_ffe.
All data on the FfE Open Data Portal have a spatial reference. This reference consists of the combination of id_region and id_regiontype. Another view (v_opendata_geom) provides the data with generalized PostGIS geometries (EPSG: 4326):
opendata.ffe.de/api/od/v_opendata_geom?id_opendata=eq.16
To access only the raw data without metadata you can query the database table itself like this:
opendata.ffe.de/api/od/opendata?id_opendata=eq.16
By modifying the url, additional filter criteria can be realized. This can be used to create user-specific queries:
opendata.ffe.de/api/od/opendata?id_opendata=eq.16&&year=eq.2050
Datasets from the project DemandRegio access a separate database:
opendata.ffe.de/api/dr/demandregio_spatial_description?select=oep_metadata,demandregio_spatial(*)&&id_spatial=eq.1 (data with metadata)
opendata.ffe.de/api/dr/demandregio_spatial?id_spatial=eq.1&&year=eq.1997 (filtered raw data)
Python
You can also access opendata.ffe.de from Python. The following snippets can be used as a template.
Create a chart:
import requests import pandas as pd import matplotlib.pyplot as plt url = 'https://opendata.ffe.de/api/dr/' id_temporal = '17' internal_id = '' id_region = '9162000' year = '2010' table = 'demandregio_temporal' table_description = table + '_description' datafilter_description = '?id_temporal=eq.' + id_temporal datafilter = '?id_temporal=eq.'+id_temporal+'&&id_region=eq.'+id_region+'&&year_weather=eq.' + year if internal_id=='': datafilter = datafilter else: datafilter = datafilter + '&&internal_id=eq.{'+internal_id+'}' result = requests.get(url + table_description+datafilter_description) df = pd.read_json(result.content) lbl_y = df['title'][0] + ' in ' + df['units'][0] result = requests.get(url + table + datafilter) df = pd.read_json(result.content) data_y= df['values'][0] plt.plot(data_y[0:500]) plt.xlabel("hour of the year " + str(year)) plt.ylabel(lbl_y) plt.show()
Export as csv-file:
import requests import pandas as pd # Valid download link # https://opendata.ffe.de/api/dr/demandregio_spatial?id_spatial=eq.25&&year=eq.2017 url = 'https://opendata.ffe.de/api/dr/' id_spatial = '25' internal_id = '' year = '2017' table = 'demandregio_spatial' table_description = table + '_description' datafilter_description = '?id_spatial=eq.' + id_spatial datafilter = '?id_spatial=eq.'+id_spatial+'&&year=eq.' + year if internal_id=='': datafilter = datafilter else: datafilter = datafilter + '&&internal_id=eq.{'+internal_id+'}' result = requests.get(url + table + datafilter) df = pd.read_json(result.content) df.to_csv(r'C:\FfE\out.csv', index = False)
Matlab
You can also access opendata.ffe.de from Matlab. The following snippet can be used as a template.
% clc % clear all % close all url = 'https://opendata.ffe.de/api/dr/'; id_temporal = '17'; %internal_id = ''; id_region = '9162000'; year = '2010'; table_name = 'demandregio_temporal'; table_description = [table_name,'_description']; filter_description = ['?id_temporal=eq.',id_temporal]; filter = ['?id_temporal=eq.',id_temporal,'&&id_region=eq.',id_region,'&&year_weather=eq.', year]; metauri=[url,table_description,filter_description]; %% %Metadata metadata = urlread(metauri); jmetadatadata = jsondecode(metadata); %% uri = [url,table_name]; option = weboptions('ContentType','json'); data = webread(uri,'id_temporal','eq.17','id_region','eq.9162000','year_weather','eq.2010',option); %% startdate = datetime(2010,1,1,0,0,0); enddate = datetime(2010,12,31,0,0,0); time = startdate:minutes(15):enddate; plot(time(1:500),data.values(1:500)) datetick('x','dd-mmm-yyyy HH:MM')