Skip to content

Commit

Permalink
Feature/hungary (electricitymaps#68)
Browse files Browse the repository at this point in the history
* Initial commit (see electricitymaps#65)

* Added exchanges

* Added HU exchanges
  • Loading branch information
corradio authored Sep 20, 2016
1 parent 3bec007 commit ef80708
Show file tree
Hide file tree
Showing 8 changed files with 241 additions and 135 deletions.
59 changes: 59 additions & 0 deletions api/static/app/countryconfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
function addCountryConfiguration(countries) {
countries['DE'].data.capacity = {
biomass: 8970,
coal: 28310 + 21140,
gas: 28490,
hydro: 5590,
nuclear: 10790,
oil: 4240,
solar: 39630,
wind: 3740 + 42460,
};
countries['DK'].data.capacity = {
hydro: 0,
nuclear: 0,
solar: 790,
wind: 5070,
};
countries['ES'].data.capacity = {
coal: 11482,
gas: 3498 + 27206,
hydro: 17787 + 2106,
nuclear: 7866,
solar: 4672 + 2300,
wind: 23002,
};
countries['FI'].data.capacity = {
hydro: 3080,
nuclear: 2860,
wind: 1000
};
countries['FR'].data.capacity = {
nuclear: 63130,
oil: 6670,
coal: 2930,
hydro: 10326 + 8204 + 4965,
gas: 6121,
wind: 10358,
solar: 6580
};
countries['GB'].data.capacity = {
wind: 13500,
nuclear: 9000,
hydro: 1550,
gas: 38000,
solar: 8780
};
countries['NO'].data.capacity = {
hydro: 31000,
nuclear: 0,
solar: 0,
wind: 856,
};
countries['SE'].data.capacity = {
hydro: 16200,
nuclear: 8849,
solar: 79,
wind: 6025
};
}
107 changes: 107 additions & 0 deletions api/static/app/exchangeconfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
var EXCHANGES_CONFIG = [
// DK
{
countries: ['DE', 'DK'],
lonlat: [9.3, 54.9],
rotation: 0
},
{
countries: ['SE', 'DK'],
lonlat: [13, 55.7],
rotation: -100
},
{
countries: ['DK', 'NO'],
lonlat: [8.8, 58],
rotation: -25
},
// GB
{
countries: ['GB', 'FR'],
lonlat: [0, 50.4],
rotation: 160
},
{
countries: ['IE', 'GB'],
lonlat: [-5.7, 53],
rotation: 100
},
{
countries: ['NL', 'GB'],
lonlat: [3.3, 52.4],
rotation: -90
},
// FR
{
countries: ['FR', 'ES'],
lonlat: [0.3, 42.9],
rotation: -160
},
{
countries: ['FR', 'DE'],
lonlat: [5.7, 49.8],
rotation: 50
},
{
countries: ['FR', 'CH'],
lonlat: [6.5, 46.7],
rotation: 90
},
{
countries: ['FR', 'IT'],
lonlat: [6.5, 44.5],
rotation: 70
},
// RO
{
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
},
// HU
{
countries: ['HU', 'SK'],
lonlat: [19.615617, 48.204006],
rotation: 0
},
{
countries: ['HU', 'UA'],
lonlat: [22.526994, 48.240603],
rotation: 35
},
{
countries: ['HU', 'RS'],
lonlat: [19.494768, 46.112673],
rotation: 180
},
{
countries: ['HU', 'HR'],
lonlat: [17.407365, 45.967775],
rotation: 210
},
{
countries: ['HU', 'AT'],
lonlat: [16.605363, 47.444264],
rotation: -60
}
];
137 changes: 2 additions & 135 deletions api/static/app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,84 +38,6 @@ if (!nobrowsercheck && !isChrome()) {
.range(['black', 'orange'])
.domain([300, 440]);

var EXCHANGES_CONFIG = [
{
countries: ['DE', 'DK'],
lonlat: [9.3, 54.9],
rotation: 0
},
{
countries: ['SE', 'DK'],
lonlat: [13, 55.7],
rotation: -100
},
{
countries: ['GB', 'FR'],
lonlat: [0, 50.4],
rotation: 160
},
{
countries: ['DK', 'NO'],
lonlat: [8.8, 58],
rotation: -25
},
{
countries: ['IE', 'GB'],
lonlat: [-5.7, 53],
rotation: 100
},
{
countries: ['NL', 'GB'],
lonlat: [3.3, 52.4],
rotation: -90
},
{
countries: ['FR', 'ES'],
lonlat: [0.3, 42.9],
rotation: -160
},
{
countries: ['FR', 'DE'],
lonlat: [5.7, 49.8],
rotation: 50
},
{
countries: ['FR', 'CH'],
lonlat: [6.5, 46.7],
rotation: 90
},
{
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
}
];

// Set up objects
var countryMap = new CountryMap('.map', co2color);
var exchangeLayer = new ExchangeLayer('.map');
Expand Down Expand Up @@ -316,63 +238,8 @@ if (!nobrowsercheck && !isChrome()) {
countries[countryCode].data.neighborCo2 = {};
});

countries['DE'].data.capacity = {
biomass: 8970,
coal: 28310 + 21140,
gas: 28490,
hydro: 5590,
nuclear: 10790,
oil: 4240,
solar: 39630,
wind: 3740 + 42460,
};
countries['DK'].data.capacity = {
hydro: 0,
nuclear: 0,
solar: 790,
wind: 5070,
};
countries['ES'].data.capacity = {
coal: 11482,
gas: 3498 + 27206,
hydro: 17787 + 2106,
nuclear: 7866,
solar: 4672 + 2300,
wind: 23002,
};
countries['FI'].data.capacity = {
hydro: 3080,
nuclear: 2860,
wind: 1000
};
countries['FR'].data.capacity = {
nuclear: 63130,
oil: 6670,
coal: 2930,
hydro: 10326 + 8204 + 4965,
gas: 6121,
wind: 10358,
solar: 6580
};
countries['GB'].data.capacity = {
wind: 13500,
nuclear: 9000,
hydro: 1550,
gas: 38000,
solar: 8780
};
countries['NO'].data.capacity = {
hydro: 31000,
nuclear: 0,
solar: 0,
wind: 856,
};
countries['SE'].data.capacity = {
hydro: 16200,
nuclear: 8849,
solar: 79,
wind: 6025
};
// Load country configs
addCountryConfiguration(countries);

// Populate with realtime production data
d3.keys(production.data).forEach(function(countryCode) {
Expand Down
2 changes: 2 additions & 0 deletions api/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
<script src="app/browsercheck.js"></script>
<script src="app/co2eq.js"></script>
<script src="app/countrymap.js"></script>
<script src="app/countryconfig.js"></script>
<script src="app/exchangeconfig.js"></script>
<script src="app/horizontalcolorbar.js"></script>
<script src="app/exchangelayer.js"></script>
<script src="app/countrytable.js"></script>
Expand Down
2 changes: 2 additions & 0 deletions feeder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ RUN apt-get install -y maven
RUN apt-get install -y libgrib-api-dev && pip install numpy==1.10.1 pyproj==1.9.4
RUN git clone https://github.com/cambecc/grib2json && \
cd grib2json && mvn package && tar -xvf target/grib2json-0.8.0-SNAPSHOT.tar.gz
# Install g++ for Cython required by panda
RUN apt-get install -y g++
# Only add requirements to enable cached builds when it is unchanged
ADD requirements.txt /home/requirements.txt
RUN pip install -r requirements.txt
Expand Down
2 changes: 2 additions & 0 deletions feeder/feeder.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from parsers.FI import fetch_FI
from parsers.FR import fetch_FR
from parsers.GB import fetch_GB
from parsers.HU import fetch_HU
from parsers.LT import fetch_LT
from parsers.LV import fetch_LV
from parsers.NO import fetch_NO
Expand All @@ -28,6 +29,7 @@
fetch_FI,
fetch_FR,
fetch_GB,
fetch_HU,
fetch_LT,
fetch_LV,
fetch_NO,
Expand Down
Loading

0 comments on commit ef80708

Please sign in to comment.