Skip to content

Commit

Permalink
Fixed limitation of 5000 on multiple indicator and hourly data query
Browse files Browse the repository at this point in the history
  • Loading branch information
nhcb committed Oct 20, 2022
1 parent 50cb4f5 commit a67804b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 19 deletions.
2 changes: 1 addition & 1 deletion entsog/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def decorator(func):
@wraps(func)
def documents_wrapper(*args, **kwargs):
frames = []
for offset in range(0, 5000 + n, n):
for offset in range(0, 250_000 + n, n):
try:
frame = func(*args, offset=offset, **kwargs)
sleep(0.25)
Expand Down
2 changes: 1 addition & 1 deletion entsog/entsog.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from .parsers import *

__title__ = "entsog-py"
__version__ = "0.9.7"
__version__ = "1.0.0"
__author__ = "nhcb"
__license__ = "MIT"

Expand Down
2 changes: 1 addition & 1 deletion entsog/mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def code(self):
interruptible_interruption_actual = "Interruptible Interruption Actual – Interrupted",
interruptible_interruption_planned = "Interruptible Interruption Planned - Interrupted",
interruptible_total = "Interruptible Total",
nominations = "Nominations",
nomination = "Nomination",
physical_flow = "Physical Flow",
firm_interruption_capacity_planned = "Planned interruption of firm capacity",
renomination = "Renomination",
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ client.query_tariffs_sim(start = start, end = end, country_code = country_code)
interruptible_interruption_actual : "Interruptible Interruption Actual – Interrupted",
interruptible_interruption_planned : "Interruptible Interruption Planned - Interrupted",
interruptible_total : "Interruptible Total",
nominations : "Nominations",
nomination : "Nomination",
physical_flow : "Physical Flow",
firm_interruption_capacity_planned : "Planned interruption of firm capacity",
renomination : "Renomination",
Expand Down Expand Up @@ -127,7 +127,7 @@ operational_options = {
'interruptible_interruption_actual' : "Interruptible Interruption Actual – Interrupted",
'interruptible_interruption_planned' : "Interruptible Interruption Planned - Interrupted",
'interruptible_total' : "Interruptible Total",
'nominations' : "Nominations",
'nomination' : "Nomination",
'physical_flow' : "Physical Flow",
'firm_interruption_capacity_planned' : "Planned interruption of firm capacity",
'renomination' : "Renomination",
Expand Down
31 changes: 17 additions & 14 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

client = EntsogPandasClient()

start = pd.Timestamp('20220912', tz='Europe/Brussels')
start = pd.Timestamp('20220918', tz='Europe/Brussels')
end = pd.Timestamp('20220920', tz='Europe/Brussels')
country_code = 'NL' # Netherlands

Expand Down Expand Up @@ -41,7 +41,7 @@
'interruptible_interruption_actual' : "Interruptible Interruption Actual – Interrupted",
'interruptible_interruption_planned' : "Interruptible Interruption Planned - Interrupted",
'interruptible_total' : "Interruptible Total",
'nominations' : "Nominations",
'nomination' : "Nomination",
'physical_flow' : "Physical Flow",
'firm_interruption_capacity_planned' : "Planned interruption of firm capacity",
'renomination' : "Renomination",
Expand All @@ -55,19 +55,22 @@

#client.query_operational_data(start = start, end = end, country_code = country_code, indicators = ['renomination', 'physical_flow'])
# You should use this when you want to query operational data for the entirety of continental europe.
data = client.query_operational_data_all(start = start, end = end,period_type = 'day', indicators = ['renomination', 'physical_flow'])
data = client.query_operational_data_all(start = start, end = end,period_type = 'hour', indicators = ['renomination', 'physical_flow', 'nomination'])
print(data)
print(data['url'])
# Example for if you would like to see Fluxys points.
points = client.query_operator_point_directions()
mask = points['connected_operators'].str.contains('Fluxys')
masked_points = points[mask]
print(masked_points)

keys = []
for idx, item in masked_points.iterrows():
keys.append(f"{item['operator_key']}{item['point_key']}{item['direction_key']}")
print(keys)
data = client.query_operational_point_data(start = start, end = end, indicators = ['physical_flow'], point_directions = keys, verbose = False)
data.to_csv("test.csv")

print(data.head())
# # Example for if you would like to see Fluxys points.
# points = client.query_operator_point_directions()
# mask = points['connected_operators'].str.contains('Fluxys')
# masked_points = points[mask]
# print(masked_points)

# keys = []
# for idx, item in masked_points.iterrows():
# keys.append(f"{item['operator_key']}{item['point_key']}{item['direction_key']}")
# print(keys)
# data = client.query_operational_point_data(start = start, end = end, indicators = ['physical_flow'], point_directions = keys, verbose = False)

# print(data.head())

0 comments on commit a67804b

Please sign in to comment.