EnergieID / entsoe-py

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

lookup_area() fails for XK (Kosovo) #147

Closed MattEwen closed 2 years ago

MattEwen commented 2 years ago

Hiya,

Thanks so much for this package - it makes my life a lot easier. Apologies if this is a known issue/just a mistake I'm making.

When passing Kosovo to any query country_code argument, it is not recognised as a key in the Area class in mappings.py; this happens regardless of whether XK or 10Y1001C--00100H is used. When I check, it is absent in the class:

In: 
import entsoe
entsoe.Area.__members__

Out: 
mappingproxy({'DE_50HZ': <Area.DE_50HZ: '10YDE-VE-------2'>,
              'AL': <Area.AL: '10YAL-KESH-----5'>,
              'DE_AMPRION': <Area.DE_AMPRION: '10YDE-RWENET---I'>,
              'AT': <Area.AT: '10YAT-APG------L'>,
              'BY': <Area.BY: '10Y1001A1001A51S'>,
              'BE': <Area.BE: '10YBE----------2'>,
              'BA': <Area.BA: '10YBA-JPCC-----D'>,
              'BG': <Area.BG: '10YCA-BULGARIA-R'>,
              'CZ_DE_SK': <Area.CZ_DE_SK: '10YDOM-CZ-DE-SKK'>,
              'HR': <Area.HR: '10YHR-HEP------M'>,
              'CWE': <Area.CWE: '10YDOM-REGION-1V'>,
              'CY': <Area.CY: '10YCY-1001A0003J'>,
              'CZ': <Area.CZ: '10YCZ-CEPS-----N'>,
              'DE_AT_LU': <Area.DE_AT_LU: '10Y1001A1001A63L'>,
              'DE_LU': <Area.DE_LU: '10Y1001A1001A82H'>,
              'DK': <Area.DK: '10Y1001A1001A65H'>,
              'DK_1': <Area.DK_1: '10YDK-1--------W'>,
              'DK_2': <Area.DK_2: '10YDK-2--------M'>,
              'DK_CA': <Area.DK_CA: '10Y1001A1001A796'>,
              'EE': <Area.EE: '10Y1001A1001A39I'>,
              'FI': <Area.FI: '10YFI-1--------U'>,
              'MK': <Area.MK: '10YMK-MEPSO----8'>,
              'FR': <Area.FR: '10YFR-RTE------C'>,
              'DE': <Area.DE: '10Y1001A1001A83F'>,
              'GR': <Area.GR: '10YGR-HTSO-----Y'>,
              'HU': <Area.HU: '10YHU-MAVIR----U'>,
              'IS': <Area.IS: 'IS'>,
              'IE_SEM': <Area.IE_SEM: '10Y1001A1001A59C'>,
              'IE': <Area.IE: '10YIE-1001A00010'>,
              'IT': <Area.IT: '10YIT-GRTN-----B'>,
              'IT_SACO_AC': <Area.IT_SACO_AC: '10Y1001A1001A885'>,
              'IT_CALA': <Area.IT_CALA: '10Y1001C--00096J'>,
              'IT_SACO_DC': <Area.IT_SACO_DC: '10Y1001A1001A893'>,
              'IT_BRNN': <Area.IT_BRNN: '10Y1001A1001A699'>,
              'IT_CNOR': <Area.IT_CNOR: '10Y1001A1001A70O'>,
              'IT_CSUD': <Area.IT_CSUD: '10Y1001A1001A71M'>,
              'IT_FOGN': <Area.IT_FOGN: '10Y1001A1001A72K'>,
              'IT_GR': <Area.IT_GR: '10Y1001A1001A66F'>,
              'IT_MACRO_NORTH': <Area.IT_MACRO_NORTH: '10Y1001A1001A84D'>,
              'IT_MACRO_SOUTH': <Area.IT_MACRO_SOUTH: '10Y1001A1001A85B'>,
              'IT_MALTA': <Area.IT_MALTA: '10Y1001A1001A877'>,
              'IT_NORD': <Area.IT_NORD: '10Y1001A1001A73I'>,
              'IT_NORD_AT': <Area.IT_NORD_AT: '10Y1001A1001A80L'>,
              'IT_NORD_CH': <Area.IT_NORD_CH: '10Y1001A1001A68B'>,
              'IT_NORD_FR': <Area.IT_NORD_FR: '10Y1001A1001A81J'>,
              'IT_NORD_SI': <Area.IT_NORD_SI: '10Y1001A1001A67D'>,
              'IT_PRGP': <Area.IT_PRGP: '10Y1001A1001A76C'>,
              'IT_ROSN': <Area.IT_ROSN: '10Y1001A1001A77A'>,
              'IT_SARD': <Area.IT_SARD: '10Y1001A1001A74G'>,
              'IT_SICI': <Area.IT_SICI: '10Y1001A1001A75E'>,
              'IT_SUD': <Area.IT_SUD: '10Y1001A1001A788'>,
              'RU_KGD': <Area.RU_KGD: '10Y1001A1001A50U'>,
              'LV': <Area.LV: '10YLV-1001A00074'>,
              'LT': <Area.LT: '10YLT-1001A0008Q'>,
              'LU': <Area.LU: '10YLU-CEGEDEL-NQ'>,
              'MT': <Area.MT: '10Y1001A1001A93C'>,
              'ME': <Area.ME: '10YCS-CG-TSO---S'>,
              'GB': <Area.GB: '10YGB----------A'>,
              'NL': <Area.NL: '10YNL----------L'>,
              'NO_1': <Area.NO_1: '10YNO-1--------2'>,
              'NO_2': <Area.NO_2: '10YNO-2--------T'>,
              'NO_3': <Area.NO_3: '10YNO-3--------J'>,
              'NO_4': <Area.NO_4: '10YNO-4--------9'>,
              'NO_5': <Area.NO_5: '10Y1001A1001A48H'>,
              'NO': <Area.NO: '10YNO-0--------C'>,
              'PL_CZ': <Area.PL_CZ: '10YDOM-1001A082L'>,
              'PL': <Area.PL: '10YPL-AREA-----S'>,
              'PT': <Area.PT: '10YPT-REN------W'>,
              'MD': <Area.MD: '10Y1001A1001A990'>,
              'RO': <Area.RO: '10YRO-TEL------P'>,
              'RU': <Area.RU: '10Y1001A1001A49F'>,
              'SE_1': <Area.SE_1: '10Y1001A1001A44P'>,
              'SE_2': <Area.SE_2: '10Y1001A1001A45N'>,
              'SE_3': <Area.SE_3: '10Y1001A1001A46L'>,
              'SE_4': <Area.SE_4: '10Y1001A1001A47J'>,
              'RS': <Area.RS: '10YCS-SERBIATSOV'>,
              'SK': <Area.SK: '10YSK-SEPS-----K'>,
              'SI': <Area.SI: '10YSI-ELES-----O'>,
              'GB_NIR': <Area.GB_NIR: '10Y1001A1001A016'>,
              'ES': <Area.ES: '10YES-REE------0'>,
              'SE': <Area.SE: '10YSE-1--------K'>,
              'CH': <Area.CH: '10YCH-SWISSGRIDZ'>,
              'DE_TENNET': <Area.DE_TENNET: '10YDE-EON------1'>,
              'DE_TRANSNET': <Area.DE_TRANSNET: '10YDE-ENBW-----N'>,
              'TR': <Area.TR: '10YTR-TEIAS----W'>,
              'UA': <Area.UA: '10Y1001C--00003F'>,
              'UA_DOBTPP': <Area.UA_DOBTPP: '10Y1001A1001A869'>,
              'UA_BEI': <Area.UA_BEI: '10YUA-WEPS-----0'>,
              'UA_IPS': <Area.UA_IPS: '10Y1001C--000182'>})

This causes a KeyError that can't be handled

My guess is this might have something to do with it being the last member and so being formatted differently (not followed by a comma)? However I really have no idea

<rest of class>
    UA_BEI =        '10YUA-WEPS-----0', 'Ukraine BEI CTA',                              'Europe/Kiev',
    UA_IPS =        '10Y1001C--000182', 'Ukraine IPS CTA',                              'Europe/Kiev',
    XK =            '10Y1001C--00100H', 'Kosovo/ XK CA / XK BZN',                       'Europe/Rome'
MattEwen commented 2 years ago

This issue has today seemingly suddenly resolved itself without me making any changes - I assume I must have done something wrong but I can't think what. Probably can be closed, but will leave for now in case anyone else has experienced this

fboerman commented 2 years ago

Hi,

Sorry for not responding earlier didn't have the time. From a quick glance I don't see what is wrong either but good it resolved itself haha!

Sent from ProtonMail mobile

-------- Original Message -------- On 13 Dec 2021, 16:50, Matt Ewen wrote:

This issue has today seemingly suddenly resolved itself without me making any changes - I assume I must have done something wrong but I can't think what. Probably can be closed, but will leave for now in case anyone else has experienced this

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.