Repository: electricitymaps/electricitymaps-contrib

Issue:
Generation from "Pumped storage" in France FR
At the moment, the bar charts on the map only show pumped storage consumption for France. But RTE also has data for pumped storage generation. This is currently not displayed on the map, because the "hydro" category of RTE includes all three types "hydro storage+run of river+pumped storage". But there is a seperate "pumping" category for consumption of the pumped storages (pumping).
http://www.rte-france.com/en/eco2mix/eco2mix-mix-energetique-en

![image](https://user-images.githubusercontent.com/25743609/36091018-a6c4db5a-0fe2-11e8-8913-b87ddf4b8419.png)

After selecting the hydro category, you'll see "details" below it. Selecting "details" you will see this, incuding the breakdown by hydro type:
![image](https://user-images.githubusercontent.com/25743609/36091149-122d4940-0fe3-11e8-80ad-7ddce689c08f.png)

The most recent dataset for France can also be downloaded here:
http://www.rte-france.com/en/eco2mix/eco2mix-telechargement-en

The FR.py parser seems to use this URL http://www.rte-france.com/getEco2MixXml.php?type=donneesMarche&dateDeb={}&dateFin={}&mode=NORM for getting the data. Maybe there is a similar one for the hydro breakdown by type to seperate pumped storage generation from it.


Discussion:
We do actually already save pumping data:
![image](https://user-images.githubusercontent.com/1655848/36385123-ec89c466-1591-11e8-8fbd-14b38d3d7027.png)
The problem is that I wouldn't know how conventional + run-of-the-river can be separated into hydro "discharge". Did you have something in mind?
Hi @corradio!

Correct, the **consumption** for hydro storage **pumping** is covered already, because pumping is included in that XML request in FR.py.

The live-breakdown for hydro by type is available, see the image below. I don't know if there is any way/request for XML data to access the detailed graph for Hydro with the seperate hydro types.

It would be nice (if not obligatory) having highly-flexible **pumped storage generation** shown in its respective bar, because this is absolutely essential for the not-so-flexible French nuclear-based electricity system (for quick ramping and peaks).

![image](https://user-images.githubusercontent.com/25743609/36385626-4d127804-1593-11e8-82b2-4d4887257c44.png)
good catch!! Didn't understand that we could split generation. I'm fixing this right away.

Resolving patch:
diff --git a/parsers/FR.py b/parsers/FR.py
--- a/parsers/FR.py
+++ b/parsers/FR.py
@@ -16,6 +16,7 @@
 }
 MAP_STORAGE = {
     'Pompage': 'hydro',
+    'Hydraulique': 'hydro',
 }
 
 
@@ -33,38 +34,36 @@ def fetch_production(country_code='FR', session=None):
         'source': 'rte-france.com',
     }
     for item in mixtr.getchildren():
-        if item.get('granularite') != 'Global':
-            continue
         key = item.get('v')
+        granularite = item.get('granularite')
         value = None
         for value in item.getchildren():
             pass
-        if key in MAP_GENERATION:
-            data['production'][MAP_GENERATION[key]] = float(value.text)
-        elif key in MAP_STORAGE:
-            data['storage'][MAP_STORAGE[key]] = -1 * float(value.text)
+        if key == 'Hydraulique':
+            # Hydro is a special case!
+            if granularite == 'Global':
+                continue
+            elif granularite in ['FEE', 'LAC']:
+                if not MAP_GENERATION[key] in data['production']:
+                    data['production'][MAP_GENERATION[key]] = 0
+                # Run of the river or conventional
+                data['production'][MAP_GENERATION[key]] += float(value.text)
+            elif granularite == 'STT':
+                if not MAP_STORAGE[key] in data['storage']:
+                    data['storage'][MAP_STORAGE[key]] = 0
+                # Pumped storage generation
+                data['storage'][MAP_STORAGE[key]] += -1 * float(value.text)
+        elif granularite == 'Global':
+            if key in MAP_GENERATION:
+                data['production'][MAP_GENERATION[key]] = float(value.text)
+            elif key in MAP_STORAGE:
+                if not MAP_STORAGE[key] in data['storage']:
+                    data['storage'][MAP_STORAGE[key]] = 0
+                data['storage'][MAP_STORAGE[key]] += -1 * float(value.text)
 
     data['datetime'] = arrow.get(arrow.get(obj[1].text).datetime,
         'Europe/Paris').replace(minutes=+(int(value.attrib['periode']) * 15.0)).datetime
 
-    # Fetch imports
-    # url = 'http://www.rte-france.com/getEco2MixXml.php?type=echcom&&dateDeb={}&dateFin={}&mode=NORM'.format(formatted_date, formatted_date)
-    # response = r.get(url)
-    # obj = ET.fromstring(response.content)
-    # parsed = {}
-    # for item in obj[7].getchildren():
-    #     value = None
-    #     for value in item: pass
-    #     parsed[item.get('v')] = float(value.text)
-
-    # data['exchange'] = {
-    #     'CH': parsed['CH'],
-    #     'GB': parsed['GB'],
-    #     'ES': parsed['ES'],
-    #     'IT': parsed['IT'],
-    #     'DE': parsed['DB'] # Germany + Belgium redirected to Germany
-    # }
-
     return data
 
 


Test patch: