diff --git a/README.md b/README.md index 4e1bf152f0..acab4f9bac 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ Each country has a GHG mass flow that depends on neighboring countries. In order - Latvia: [energinet.dk](http://www.energinet.dk/EN/El/Sider/Det-nordiske-elsystem.aspx) - Lithuania: [energinet.dk](http://www.energinet.dk/EN/El/Sider/Det-nordiske-elsystem.aspx) - Norway: [energinet.dk](http://www.energinet.dk/EN/El/Sider/Det-nordiske-elsystem.aspx) +- Romania: [Transelectrica](http://www.transelectrica.ro/en/web/tel/home) - Spain: [REE](https://demanda.ree.es/generacion_acumulada.html) - Sweden: [energinet.dk](http://www.energinet.dk/EN/El/Sider/Det-nordiske-elsystem.aspx) diff --git a/api/static/app/main.js b/api/static/app/main.js index 5f3c7503dc..a7ed5b9855 100644 --- a/api/static/app/main.js +++ b/api/static/app/main.js @@ -88,6 +88,31 @@ if (!nobrowsercheck && !isChrome()) { countries: ['FR', 'IT'], lonlat: [6.5, 44.5], rotation: 70 + }, + { + countries: ['RO', 'HU'], + lonlat: [21.8074107, 47.1141229], + rotation: -70 + }, + { + countries: ['RO', 'UA'], + lonlat: [24.821959, 47.768595], + rotation: 0 + }, + { + countries: ['RO', 'MD'], + lonlat: [28.009764, 47.003312], + rotation: 60 + }, + { + countries: ['RO', 'BG'], + lonlat: [25.609385, 43.674878], + rotation: 180 + }, + { + countries: ['RO', 'RS'], + lonlat: [21.469049, 44.947107], + rotation: -140 } ]; @@ -388,7 +413,7 @@ if (!nobrowsercheck && !isChrome()) { -countries[o].data.exchange[d] ]; pair.netFlow = d3.mean(netFlows); - if (pair.netFlow == undefined) + if (pair.netFlow === undefined) return; pair.co2 = function () { return pair.countries.map(function (k) { return countries[k].data.co2; }); diff --git a/feeder/feeder.py b/feeder/feeder.py index 68cd447694..f2c31106f6 100644 --- a/feeder/feeder.py +++ b/feeder/feeder.py @@ -11,6 +11,7 @@ from parsers.LT import fetch_LT from parsers.LV import fetch_LV from parsers.NO import fetch_NO +from parsers.RO import fetch_RO from parsers.SE import fetch_SE @@ -30,8 +31,8 @@ fetch_LT, fetch_LV, fetch_NO, + fetch_RO, fetch_SE - ] # Set up stats diff --git a/feeder/parsers/RO.py b/feeder/parsers/RO.py new file mode 100644 index 0000000000..1ef4cd48f9 --- /dev/null +++ b/feeder/parsers/RO.py @@ -0,0 +1,44 @@ +import arrow +import dateutil +import requests + +COUNTRY_CODE = 'RO' + +def fetch_RO(): + url = 'http://www.transelectrica.ro/sen-filter' + data = {} + for item in requests.get(url).json(): + d = list(item.iteritems())[0] + data[d[0]] = d[1] + + obj = { + 'countryCode': COUNTRY_CODE, + 'datetime': arrow.get(data['row1_HARTASEN_DATA'], "YY/M/D HH:mm:ss").replace( + tzinfo=dateutil.tz.gettz('Europe/Bucharest')).datetime + } + obj['consumption'] = { + 'unknown': float(data['CONS']) + } + # According to http://www.transelectrica.ro/widget/web/tel/sen-harta/-/harta_WAR_SENOperareHartaportlet + # BALT and UCRS (for Baltic and Ukraine South) are categorized under Bulgary on transelectrica website. We did the same here. + obj['exchange'] = { + 'BG': float(data.get('VARN', 0)) + float(data.get('DOBR', 0)) + float(data.get('KOZL1', 0)) + float(data.get('KOZL2', 0)) + float(data.get('BALT', 0)) + float(data.get('UCRS', 0)), + 'HU': float(data.get('SAND', 0)) + float(data.get('BEKE1', 0)) + float(data.get('BEKE2', 0)), + 'MD': float(data.get('COSE', 0)) + float(data.get('UNGE', 0)) + float(data.get('CIOA', 0)) + float(data.get('GOTE', 0)), + 'RS': float(data.get('DJER', 0)) + float(data.get('PAN1', 0)) + float(data.get('PAN2', 0)) + float(data.get('KUSJ', 0)) + float(data.get('SIP_', 0)) + float(data.get('KIKI', 0)), + 'UA': float(data.get('VULC', 0)) + float(data.get('MUKA', 0)) + float(data.get('COD1', 0)) + } + obj['production'] = { + 'biomass': float(data['BMASA']), + 'coal': float(data['CARB']), + 'gas': float(data['GAZE']), + 'hydro': float(data['APE']), + 'nuclear': float(data['NUCL']), + 'solar': float(data['FOTO']), + 'wind': float(data['EOLIAN']) + } + + return obj + +if __name__ == '__main__': + print fetch_RO()