Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/ThanosGkou/entsoe-py
Browse files Browse the repository at this point in the history
  • Loading branch information
ThanosGkou committed Jul 29, 2023
2 parents 66b96ff + 4c288c5 commit 685fc4a
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/publish-to-test-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ on:
jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@master
- name: Set up Python 3.7
- name: Set up Python 3.10
uses: actions/setup-python@v1
with:
python-version: 3.7
python-version: '3.10'
- name: Install pypa/build
run: >-
python -m
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ client.query_net_position(country_code, start, end, dayahead=True)
client.query_load(country_code, start, end)
client.query_load_forecast(country_code, start, end)
client.query_wind_and_solar_forecast(country_code, start, end, psr_type=None)
query_intraday_wind_and_solar_forecast(country_code, start, end, psr_type=None)
client.query_generation_forecast(country_code, start, end)
client.query_generation(country_code, start, end, psr_type=None)
client.query_generation_per_plant(country_code, start, end, psr_type=None)
Expand Down Expand Up @@ -118,6 +119,7 @@ client.query_load_forecast(country_code, start=start,end=end)
client.query_load_and_forecast(country_code, start=start, end=end)
client.query_generation_forecast(country_code, start=start,end=end)
client.query_wind_and_solar_forecast(country_code, start=start,end=end, psr_type=None)
query_intraday_wind_and_solar_forecast(country_code, start, end, psr_type=None)
client.query_generation(country_code, start=start,end=end, psr_type=None)
client.query_generation_per_plant(country_code, start=start,end=end, psr_type=None)
client.query_installed_generation_capacity(country_code, start=start,end=end, psr_type=None)
Expand All @@ -129,7 +131,7 @@ client.query_unavailability_of_generation_units(country_code, start=start,end=en
client.query_unavailability_of_production_units(country_code, start, end, docstatus=None, periodstartupdate=None, periodendupdate=None)
client.query_unavailability_transmission(country_code_from, country_code_to, start, end, docstatus=None, periodstartupdate=None, periodendupdate=None)
client.query_withdrawn_unavailability_of_generation_units(country_code, start, end)
client.query_import(country_code, start, end)
client.query_physical_crossborder_allborders(country_code, start, end, export)
client.query_generation_import(country_code, start, end)
client.query_procured_balancing_capacity(country_code, start, end, process_type, type_marketagreement_type=None)

Expand Down
8 changes: 5 additions & 3 deletions entsoe/mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def code(self):
LV = '10YLV-1001A00074', 'Latvia, AST BZ / CA / MBA', 'Europe/Riga',
LT = '10YLT-1001A0008Q', 'Lithuania, Litgrid BZ / CA / MBA', 'Europe/Vilnius',
LU = '10YLU-CEGEDEL-NQ', 'Luxembourg, CREOS CA', 'Europe/Luxembourg',
LU_BZN = '10Y1001A1001A82H', 'Luxembourg', 'Europe/Luxembourg',
MT = '10Y1001A1001A93C', 'Malta, Malta BZ / CA / MBA', 'Europe/Malta',
ME = '10YCS-CG-TSO---S', 'Montenegro, CGES BZ / CA / MBA', 'Europe/Podgorica',
GB = '10YGB----------A', 'National Grid BZ / CA/ MBA', 'Europe/London',
Expand Down Expand Up @@ -178,6 +179,7 @@ def code(self):
'A02': 'Final',
'A05': 'Active',
'A09': 'Cancelled',
'A13': 'Withdrawn',
'X01': 'Estimated'}

BSNTYPE = {'A29': 'Already allocated capacity (AAC)',
Expand Down Expand Up @@ -278,8 +280,8 @@ def code(self):
'CH': ['AT', 'DE_AT_LU', 'DE_LU', 'FR', 'IT_NORD', 'IT_NORD_CH'],
'AT': ['CH', 'CZ', 'DE_LU', 'HU', 'IT_NORD', 'SI'],
'CZ': ['AT', 'DE_AT_LU', 'DE_LU', 'PL', 'SK'],
'GB': ['BE', 'FR', 'IE_SEM', 'NL'],
'NO_2': ['DE_LU', 'DK_1', 'NL', 'NO_1', 'NO_5'],
'GB': ['BE', 'FR', 'IE_SEM', 'NL', 'NO_2'],
'NO_2': ['DE_LU', 'DK_1', 'NL', 'NO_1', 'NO_5', 'GB'],
'HU': ['AT', 'HR', 'RO', 'RS', 'SK', 'UA'],
'IT_NORD': ['CH', 'DE_AT_LU', 'FR', 'SI', 'AT', 'IT_CNOR'],
'ES': ['FR', 'PT'],
Expand All @@ -296,7 +298,7 @@ def code(self):
'IE_SEM': ['GB'],
'BA': ['HR', 'ME', 'RS'],
'NO_1': ['NO_2', 'NO_3', 'NO_5', 'SE_3'],
'SE_4': ['DE_AT_LU', 'DE_LU', 'DK_2', 'LT', 'PL'],
'SE_4': ['DE_AT_LU', 'DE_LU', 'DK_2', 'LT', 'PL', 'SE_3'],
'NO_5': ['NO_1', 'NO_2', 'NO_3'],
'SK': ['CZ', 'HU', 'PL', 'UA'],
'EE': ['FI', 'LV', 'RU'],
Expand Down
17 changes: 13 additions & 4 deletions entsoe/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,10 +522,17 @@ def _parse_imbalance_volumes_timeseries(soup) -> pd.DataFrame:
-------
pd.DataFrame
"""
flow_direction_factor = {
'A01': 1, # in
'A02': -1 # out
}[soup.find('flowdirection.direction').text]

flow_direction = soup.find('flowdirection.direction')
if flow_direction:
# time series uses flow direction codes
flow_direction_factor = {
'A01': 1, # in
'A02': -1 # out
}[flow_direction.text]
else:
# time series uses positive and negative values
flow_direction_factor = 1

df = pd.DataFrame(columns=['Imbalance Volume'])

Expand Down Expand Up @@ -884,6 +891,8 @@ def _unavailability_gen_ts(soup: bs4.BeautifulSoup) -> list:

HEADERS_UNAVAIL_TRANSM = ['created_doc_time',
'docstatus',
'mrid',
'revision'
'businesstype',
'in_domain',
'out_domain',
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
requests
pytz
beautifulsoup4
beautifulsoup4>=4.11.1
pandas>=1.4.0
tqdm>=4.65.0

0 comments on commit 685fc4a

Please sign in to comment.