add visualization for ENTSO-E energy transfers to and from Ukraine

This commit is contained in:
2025-01-29 00:28:53 +02:00
parent 9359c2b676
commit 14b705c835
2 changed files with 749 additions and 0 deletions

View File

@@ -0,0 +1,326 @@
---
title: Візуалізація руху електроенергії з та в Україну за даними ENTSO-E
date: 2024-07-21T20:20:24+03:00
draft: true
load_vega: true
---
{{< vega-lite id="entso-e-bar" dataUrl="https://github.com/olehomelchenko/ua-entso-e-transfers/raw/main/output.json">}}
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": {
"url": "https://raw.githubusercontent.com/olehomelchenko/ua-entso-e-transfers/main/output_daily.json"
},
"width": 600,
"height": 400,
"title": "За даними ENTSO-E",
"config": {
"background": "#FFF",
"padding": {
"top": 30,
"right": 30,
"bottom": 30,
"left": 30
},
"title": {
"font": "Menlo, Lucida Console, Monospace",
"fontSize": 14,
"fontWeight": "normal",
"color": "#005",
"dy": -3,
"anchor": "middle",
"subtitleFont": "Menlo, Lucida Console, Monospace",
"subtitleColor": "#337",
"subtitlePadding": 5
},
"legend": {
"layout": {
"bottom": {
"anchor": "middle"
}
},
"orient": "bottom",
"gradientLength": 500,
"labelLimit": 500,
"columns": 3,
"clipHeight": 15,
"rowPadding": 10,
"gridAlign": "none",
"labelFont": "Menlo, Lucida Console, Monospace",
"titleFont": "Menlo, Lucida Console, Monospace",
"titleFontWeight": "normal",
"titlePadding": 5,
"titleAlign": "center",
"titleAnchor": "middle",
"titleLimit": 500,
"titleColor": "#005"
},
"text": {
"font": "Menlo, Lucida Console, Monospace",
"color": "#005"
},
"axis": {
"labelFont": "Menlo, Lucida Console, Monospace",
"labelColor": "#005",
"titleFont": "Menlo, Lucida Console, Monospace",
"titleColor": "#337"
},
},
"selection": {
"categoryFilter": {
"type": "single",
"fields": [
"Country"
],
"bind": {
"input": "select",
"name": "Вибір країни",
"options": [
null,
"Hungary",
"Moldova",
"Poland",
"Romania",
"Slovakia"
]
}
}
},
"transform": [
{
"calculate": "datum.Export_from_UA * -1",
"as": "export_neg"
},
{
"calculate": "datum.Export_from_UA - datum.Import_from_UA",
"as": "balance"
},
{
"filter": {
"selection": "categoryFilter"
}
}
],
"mark": {
"type": "bar",
"tooltip": true
},
"encoding": {
"x": {
"timeUnit": "yearmonthdate",
"field": "Date",
"type": "temporal",
"title": "Month of the year"
},
"y": {
"aggregate": "sum",
"field": "Import_to_UA",
"type": "quantitative",
"title": "Import/Export, mW"
},
"y2": {
"field": "export_neg"
},
"color": {
"field": "Country",
"type": "nominal"
}
}
}
{{< /vega-lite >}}
{{< vega-lite id="entso-e-dynamics" dataUrl="https://github.com/olehomelchenko/ua-entso-e-transfers/raw/main/output.json">}}
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": {
"url": "https://raw.githubusercontent.com/olehomelchenko/ua-entso-e-transfers/main/output.json"
},
"config": {
"background": "#FFF",
"padding": {
"top": 30,
"right": 30,
"bottom": 30,
"left": 30
},
"title": {
"font": "Menlo, Lucida Console, Monospace",
"fontSize": 14,
"fontWeight": "normal",
"color": "#005",
"dy": -3,
"anchor": "middle",
"subtitleFont": "Menlo, Lucida Console, Monospace",
"subtitleColor": "#337",
"subtitlePadding": 5
},
"legend": {
"layout": {
"bottom": {
"anchor": "middle"
}
},
"orient": "bottom",
"gradientLength": 500,
"labelLimit": 500,
"columns": 3,
"clipHeight": 15,
"rowPadding": 10,
"gridAlign": "none",
"labelFont": "Menlo, Lucida Console, Monospace",
"titleFont": "Menlo, Lucida Console, Monospace",
"titleFontWeight": "normal",
"titlePadding": 5,
"titleAlign": "center",
"titleAnchor": "middle",
"titleLimit": 500,
"titleColor": "#005"
},
"text": {
"font": "Menlo, Lucida Console, Monospace",
"color": "#005"
},
"axis": {
"labelFont": "Menlo, Lucida Console, Monospace",
"labelColor": "#005",
"titleFont": "Menlo, Lucida Console, Monospace",
"titleColor": "#337"
},
},
"transform": [
{
"calculate": "substring(datum.Time, 0, 2)",
"as": "Hour"
},
{
"calculate": "substring(datum.Country, 0, 3)",
"as": "cntr"
},
{
"calculate": "datum.Export_from_UA * -1",
"as": "export_neg"
},
],
"vconcat": [
{
"hconcat": [
{
"title": "Avg. Transfer to/from Ukraine by Hour",
"transform": [
{
"filter": {
"param": "brush"
}
},
],
"mark": "area",
"encoding": {
"x": {
"field": "Hour",
"type": "ordinal",
"axis": {
"title": ""
}
},
"y": {
"field": "Import_to_UA",
"type": "quantitative",
"aggregate": "average",
"title": "Transfer, MW",
"scale": {
"domain": [
-200,
500
]
}
},
"y2": {
"field": "export_neg",
"aggregate": "average"
}
}
},
{"transform": [
{
"filter": {
"param": "brush"
}
},
],
"title": ["Share of Import ","by Country"],
"encoding": {
"theta": {
"field": "Import_to_UA",
"type": "quantitative",
"aggregate": "sum",
"stack": true
},
"color": {
"field": "Country",
"type": "nominal",
"legend": null
}
},
"layer": [
{
"mark": {
"type": "arc",
"tooltip": true,
"outerRadius": 60
}
},
{
"mark": {
"type": "text",
"radius": 80
},
"encoding": {
"text": {
"field": "cntr",
"type": "nominal"
}
}
}
]
}
]
},
{
"width": 480,
"height": 60,
"mark": "area",
"params": [
{
"name": "brush",
"select": {
"type": "interval",
"encodings": [
"x"
]
}
}
],
"encoding": {
"x": {
"field": "Date",
"type": "temporal"
},
"y": {
"field": "Import_to_UA",
"type": "quantitative",
"aggregate": "sum",
"axis": {
"tickCount": 3,
"grid": false
}
}
}
}
]
}
{{< /vega-lite >}}