nhcb / entsog-py

Python client for the ENTSOG API
MIT License
18 stars 4 forks source link

Issue with country code #15

Open ClareO9 opened 1 year ago

ClareO9 commented 1 year ago

Hi, when trying to use the EntsogPandasClient I get the following error on 'country_code'.

TypeError: query_operational_data() got an unexpected keyword argument 'country_code'

I would like to pull the data by country but I also struggled with identifying a way to do this when looking at the ENTSOG API user manual as well. It looks like in mappings.py that there was code developed to map the operator labels to countries, but not sure how to resolve the error when running the sample code for NL. The gazprom example with the plot runs perfectly.

Thank you!

nhcb commented 1 year ago

Hi @ClareO9,

Thanks for using the package.

The issue you have encountered is due to me not having updated the documentation.

I have removed the country functionality a while back due to the ENTSOG API requiring either an operator or a pointdirection parameter, but not a country key. Therefore, I had to iterate through operators within an country which was very error prone. Therefore, I decided it would be better to retrieve simply all data instead.

It's still possible to retrieve only the point_directions from the Netherlands. You will need to get the full list of direction keys from the other API endpoints. However, I recommend that you should obtain the full operational_point_data, that is do not enter point_direction, as this additional parameter is also somewhat error prone (especially if you have more than 50 point direction keys).

keys = ... # Dutch pointdirecton keys
data = client.query_operational_point_data(start = start, end = end, indicators = ['physical_flow'], point_directions = keys, verbose = False)
# Preferred:
data = client.query_operational_point_data(start =start, end = end, indicators = ['physcal_flow'])
# Filter afterward