EnergieID / entsoe-py

Python client for the ENTSO-E API (european network of transmission system operators for electricity)
MIT License
428 stars 188 forks source link

Cross-Border Physical Flow with several same position/value are not parsed. #97

Open ThomasAuriel opened 3 years ago

ThomasAuriel commented 3 years ago

The api is currently unable to collect data on the Cross-Border Physical Flow DE-NO

https://transparency.entsoe.eu/transmission-domain/physicalFlow/show?name=&defaultValue=false&viewType=GRAPH&areaType=BORDER_CTY&atch=false&dateTime.dateTime=18.01.2021+00:00|CET|DAY&border.values=CTY|10Y1001A1001A83F!CTY_CTY|10Y1001A1001A83F_CTY_CTY|10YNO-0--------C&dateTime.timezone=CET_CEST&dateTime.timezone_input=CET+(UTC+1)+/+CEST+(UTC+2)

The time step of this data is 15min instead of 1hr. But this is not the source of the issue.

The soup library, once the xml parsed, returns several position/flows with the same value. This is confusing for the function _parse_crossborder_flows_timeseries(soup) :

def _parse_crossborder_flows_timeseries(soup):
    """
    Parameters
    ----------
    soup : bs4.element.tag

    Returns
    -------
    pd.Series
    """
    positions = []
    flows = []
    for point in soup.find_all("point"):
        positions.append(int(point.find("position").text))
        flows.append(float(point.find("quantity").text))

    series = pd.Series(index=positions, data=flows)
    series = series.sort_index()
    series.index = _parse_datetimeindex(soup)

    return series

The soup first positions are :

<position>1</position>, <position>1</position>, <position>1</position>, <position>1</position>, <position>1</position>,
<position>1</position>, <position>1</position>, <position>1</position>, <position>1</position>, <position>1</position>,
<position>1</position>, <position>1</position>, <position>1</position>, <position>1</position>, <position>1</position>,
<position>1</position>, <position>1</position>, <position>1</position>, <position>1</position>, <position>1</position>,
<position>1</position>, <position>1</position>, <position>1</position>, <position>1</position>, <position>1</position>,
<position>1</position>, <position>1</position>, <position>1</position>, <position>1</position>, <position>1</position>,
<position>1</position>, <position>1</position>, <position>1</position>, <position>1</position>, <position>1</position>,
<position>1</position>, <position>1</position>, <position>1</position>, <position>1</position>, <position>1</position>,
<position>1</position>, <position>1</position>, <position>1</position>, <position>1</position>, <position>1</position>,
<position>1</position>, <position>1</position>, <position>1</position>, <position>1</position>, <position>1</position>,
<position>1</position>, <position>1</position>, <position>1</position>, <position>1</position>, <position>1</position>,
<position>1</position>, <position>1</position>, <position>1</position>, <position>1</position>, <position>1</position>,
<position>1</position>, <position>1</position>, <position>1</position>, <position>1</position>, <position>1</position>,
<position>1</position>, <position>1</position>, <position>1</position>, <position>1</position>, <position>1</position>,
<position>1</position>, <position>1</position>, <position>1</position>, <position>1</position>, <position>2</position>,
<position>3</position>, <position>4</position>, <position>5</position>, <position>6</position>, <position>7</position>,
<position>8</position>, <position>9</position>, <position>10</position>, <position>11</position>, <position>12</position>,
<position>13</position>, <position>14</position>, <position>15</position>, <position>16</position>, <position>17</position>,
<position>18</position>, <position>19</position>, <position>20</position>, <position>21</position>, <position>22</position>
FrankBoermanTenneT commented 3 years ago

do you have a python code that shows this crashing? I was planning on using this data so was concerned when I saw this but when I run this:

start=pd.Timestamp('20210118', tz='Europe/Amsterdam')
end=pd.Timestamp('20210119', tz='Europe/Amsterdam')
df = clientP.query_crossborder_flows('DE', 'NO', start=start, end=end)

I get perfectly fine data with latest version of the package.

fboerman commented 3 years ago

hi @ThomasAuriel does the last comment fix your issue?