diff --git a/README.md b/README.md index aa5fc58aaa..51738b4e68 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ Each country has a GHG mass flow that depends on neighboring countries. In order - Great Britain: [ENTSOE](https://transparency.entsoe.eu/content/static_content/Static%20content/web%20api/Guide.html) - Greece: [ENTSOE](https://transparency.entsoe.eu/content/static_content/Static%20content/web%20api/Guide.html) - Hungary: [ENTSOE](https://transparency.entsoe.eu/content/static_content/Static%20content/web%20api/Guide.html) +- Iceland [LANDSNET](http://amper.landsnet.is/MapData/api/measurements) - Ireland: [ENTSOE](https://transparency.entsoe.eu/content/static_content/Static%20content/web%20api/Guide.html) - Italy: [ENTSOE](https://transparency.entsoe.eu/content/static_content/Static%20content/web%20api/Guide.html) - Latvia: [ENTSOE](https://transparency.entsoe.eu/content/static_content/Static%20content/web%20api/Guide.html) @@ -71,6 +72,7 @@ Each country has a GHG mass flow that depends on neighboring countries. In order - Great Britain: [ENTSO-E](https://transparency.entsoe.eu/generation/r2/installedGenerationCapacityAggregation/show) - Greece: [ENTSO-E](https://transparency.entsoe.eu/generation/r2/installedGenerationCapacityAggregation/show) - Hungary: [ENTSO-E](https://transparency.entsoe.eu/generation/r2/installedGenerationCapacityAggregation/show) +- Iceland: [Statistics Iceland](http://px.hagstofa.is/pxen/pxweb/en/Atvinnuvegir/Atvinnuvegir__orkumal/IDN02101.px) - Ireland - All production types: [ENTSO-E](https://transparency.entsoe.eu/generation/r2/installedGenerationCapacityAggregation/show) - Wind: [IWEA](http://www.iwea.com/index.cfm/page/windenergyfaqs?#q21) diff --git a/feeder/feeder.py b/feeder/feeder.py index 73fd0064d3..7a54f6955e 100644 --- a/feeder/feeder.py +++ b/feeder/feeder.py @@ -8,6 +8,7 @@ from bson.binary import Binary from pymemcache.client.base import Client +from parsers import IS from parsers import FR from parsers import ENTSOE from parsers import weather @@ -105,6 +106,7 @@ 'GR': ENTSOE.fetch_production, 'HU': ENTSOE.fetch_production, 'IE': ENTSOE.fetch_production, + 'IS': IS.fetch_production, 'IT': ENTSOE.fetch_production, 'LT': ENTSOE.fetch_production, 'LU': ENTSOE.fetch_production, diff --git a/feeder/parsers/ENTSOE.py b/feeder/parsers/ENTSOE.py index 07aa969f91..b95df0e42c 100644 --- a/feeder/parsers/ENTSOE.py +++ b/feeder/parsers/ENTSOE.py @@ -271,13 +271,15 @@ def get_wind(values): if 'Wind Onshore' in values or 'Wind Offshore' in values: return values.get('Wind Onshore', 0) + values.get('Wind Offshore', 0) +def get_geothermal(values): + if 'Geothermal' in values: + return values.get('Geothermal', 0); + def get_unknown(values): - if 'Geothermal' in values \ - or 'Marine' in values \ + if 'Marine' in values \ or 'Other renewable' in values \ or 'Other' in values: - return values.get('Geothermal', 0) + \ - values.get('Marine', 0) + \ + return values.get('Marine', 0) + \ values.get('Other renewable', 0) + \ values.get('Other', 0) @@ -335,6 +337,7 @@ def fetch_production(country_code, session=None): 'oil': get_oil(production_values), 'solar': production_values.get('Solar', None), 'wind': get_wind(production_values), + 'geothermal': get_geothermal(production_values), 'unknown': get_unknown(production_values) }, 'storage': { diff --git a/feeder/parsers/IS.py b/feeder/parsers/IS.py new file mode 100644 index 0000000000..7d14839270 --- /dev/null +++ b/feeder/parsers/IS.py @@ -0,0 +1,75 @@ +import requests +from datetime import datetime +from collections import defaultdict +import xml.etree.ElementTree as ET +import json + +STATIONS = { + + # http://www.landsvirkjun.com/company/powerstations/ + 'Bjarnaflag': 'geothermal', # No data? + 'BLANDA_F': 'hydro', + 'BUDAR_O': 'hydro', + 'BURF_F': 'hydro', + 'FLJOTSDA': 'hydro', + 'Hafio': 'wind', # No data? + 'HRAUN_F': 'hydro', + 'IRAFOS_F': 'hydro', + 'KRAFLA_F': 'geothermal', + 'LAXA_F': 'hydro', + 'LAXARVAT': 'hydro', + 'laxa': 'hydro', # No data? + 'LJOSIF_F': 'hydro', + 'SIG_F': 'hydro', + 'Steingrimsstod': 'hydro', # No data? + 'SULTAR_F': 'hydro', + 'VATNSHAM': 'hydro', + + # https://en.wikipedia.org/wiki/List_of_power_stations_in_Iceland + 'KOLVID': 'geothermal', + 'LAGARF': 'hydro', + 'MJOLKA': 'hydro', + 'REY': 'geothermal', + 'X_NESJAV': 'geothermal', + 'SVA': 'geothermal', +} + +def fetch_production(country_code='IS', session=None): + + # Query Landsnet for latest power production data for Iceland + r = session or requests.session() + url = 'http://amper.landsnet.is/MapData/api/measurements' + response = r.get(url) + json_obj = json.loads(response.text) + + # Set zero values for energy sources Iceland doesn't use at all + # Iceland does use some wind and gas but we don't have data for those + production = defaultdict(float) + production["solar"] = 0; + production["biomass"] = 0; + production["nuclear"] = 0; + production["coal"] = 0; + + # Calculate production values for each power station + # The Landsnet API includes measurements for non-generating + # stations (e.g. capacitor banks) so ignore any not in our list + for key, value in STATIONS.items(): + items = [item for item in json_obj if item["substation"] == key and item["MW"] >= 0] + mw = sum(item['MW'] for item in items) + production[value] = production[value] + mw; + + # Get datetime for last update (e.g. 2017-02-02T14:35:00) + totalpowerflow = next(item for item in json_obj if item["key"] == "TOTAL_POWER_FLOW") + datetime_last = datetime.strptime(totalpowerflow["time"], '%Y-%m-%dT%H:%M:%S') + + data = { + 'countryCode': country_code, + 'production': dict(production), + 'datetime': datetime_last, + 'storage': {}, + 'source': 'landsnet.is', + } + return data + +if __name__ == '__main__': + print fetch_production() \ No newline at end of file diff --git a/shared/co2eq_parameters.js b/shared/co2eq_parameters.js index e5739b2109..b3b8eb2313 100644 --- a/shared/co2eq_parameters.js +++ b/shared/co2eq_parameters.js @@ -9,6 +9,7 @@ defaultCo2eqFootprint = { 'oil': 650, 'solar': 45, 'wind': 12, + 'geothermal': 24, 'unknown': 700, // assume conventional 'other': 700 // same as 'unknown'. Here for backward compatibility }; // in gCo2eq/kWh diff --git a/web/app/configs/capacities.json b/web/app/configs/capacities.json index 8f79f9d33d..8f585346a4 100644 --- a/web/app/configs/capacities.json +++ b/web/app/configs/capacities.json @@ -176,6 +176,20 @@ "wind": 3025 } }, + "IS": { + "capacity": { + "biomass": 0, + "oil": 117, + "coal": 0, + "hydro": 1986, + "geothermal": 665, + "nuclear": 0, + "gas": 0, + "unknown": 0, + "solar": 0, + "wind": 3 + } + }, "IT": { "capacity": { "hydro": 22382, diff --git a/web/app/countrytable.js b/web/app/countrytable.js index 22f9aa8853..95617e831d 100644 --- a/web/app/countrytable.js +++ b/web/app/countrytable.js @@ -24,6 +24,7 @@ function CountryTable(selector, co2Color) { 'solar': '#f27406', 'hydro': '#2772b2', 'biomass': '#166a57', + 'geothermal': 'yellow', 'nuclear': '#AEB800', 'gas': '#bb2f51', 'coal': '#ac8c35', @@ -42,6 +43,7 @@ function CountryTable(selector, co2Color) { 'solar', 'hydro', 'hydro storage', + 'geothermal', 'biomass', 'nuclear', 'gas',