-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from hydroframe/test_1pt_1hr
add scenario for test_1pt_1hr to compare local,remote with smallest size
- Loading branch information
Showing
3 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
""" | ||
Performance test for the scenario to 1 point for 1 hour of CONUS2 | ||
using hf_hydrodata. | ||
""" | ||
|
||
# pylint: disable=C0301,W1514,R0914 | ||
|
||
import time | ||
import hf_hydrodata as hf | ||
import utils | ||
|
||
|
||
def test_scenario(request): | ||
""" | ||
Test the scenario to get 1 hour of 1 point and | ||
create logging artifact with performance information. | ||
""" | ||
|
||
local_remote = utils.register_email_pin("public") | ||
(start_time_str, end_time_str) = utils.get_1h_duration(request) | ||
|
||
t0 = time.time() | ||
_execute_scenario(start_time_str, end_time_str) | ||
t1 = time.time() | ||
duration = round(t1 - t0, 2) | ||
scenario_name = "read_1_hour_1_point" | ||
utils.write_log(scenario_name, request, local_remote, duration) | ||
|
||
|
||
def _execute_scenario(start_time_str, end_time_str): | ||
"""Execute the scenario to be tested""" | ||
|
||
bounds = [4057, 1914, 4058, 1915] | ||
options = { | ||
"dataset": "CW3E", | ||
"period": "hourly", | ||
"dataset_version": "1.0", | ||
"variable": "precipitation", | ||
"start_time": start_time_str, | ||
"end_time": end_time_str, | ||
"grid_bounds": bounds, | ||
"nomask": "true", | ||
} | ||
data = hf.get_gridded_data(options) | ||
assert data.shape == (1, 1, 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters