Skip to content
Snippets Groups Projects
Commit 0559aabe authored by Carsten Hinz's avatar Carsten Hinz
Browse files

started documenting benchmark.py

parent 0e1d9ebb
No related branches found
No related tags found
Loading
......@@ -8,7 +8,7 @@ The request to the database also allows a statistical analysis of the requested
The mean and standard deviation of all stations within a cell are computed.
The tool handles the request to the database over the REST API and the subsequent processing.
The results are provided as xarray objects for subsequent processing by the user.
The results of the gridding are provided as xarray objects for subsequent processing by the user.
This project is in beta with the intended basic functionalities.
The documentation is work in progress.
......@@ -70,6 +70,7 @@ quality_controll.ipynb
```
Notebook for downloading and visualization of data.
The data are downloaded and reused for subsequent executions of this notebook.
The gridding is done on the downloaded data. Gridded data are not saved to disc.
# Supported Grids
......
......@@ -16,6 +16,8 @@ TEST_ROOT = Path(__file__).parent
def get_toar_response(start, end):
"""manual request to the TOAR database
"""
end_with_padding = end + timedelta(1)
response = requests.get(
......@@ -35,6 +37,8 @@ def get_toar_response(start, end):
def wait_for_data(response):
"""waiting for data of a manual request
"""
tries = 0
while True:
print(f"n tries: {tries}")
......@@ -53,6 +57,8 @@ def wait_for_data(response):
def time_toar_response(start, end):
"""benchmark with manual creation of request to TOAR database
"""
print(f"starting request for {start}-{end}")
timer_start = datetime.now()
......@@ -64,6 +70,8 @@ def time_toar_response(start, end):
def wait_for_client_response(client, sample):
"""waiting for response. get_data throws exception after 30min, if results are not available.
"""
for half_hours in range(20):
try:
client.get_data(sample)
......@@ -74,10 +82,15 @@ def wait_for_client_response(client, sample):
def time_rest_client_response(start, end):
print(f"starting request for {start}-{end}")
path_cache = TEST_ROOT / "temp_data_cache"
path_data = TEST_ROOT / "temp_data"
path_cache.mkdir(parents=True, exist_ok=True)
path_data.mkdir(parents=True, exist_ok=True)
rest_client = AnalysisServiceDownload(
STATISTICS_ENDPOINT,
TEST_ROOT / "temp_data_cache",
TEST_ROOT / "temp_data",
path_cache,
path_data,
use_downloaded=False,
)
time_window = TimeSample(start, end, SAMPLING)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment