h2lib-tests 13.1.202__py3-none-any.whl → 13.1.301__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- h2lib_tests/test_h2lib.py +25 -0
- {h2lib_tests-13.1.202.dist-info → h2lib_tests-13.1.301.dist-info}/METADATA +2 -2
- {h2lib_tests-13.1.202.dist-info → h2lib_tests-13.1.301.dist-info}/RECORD +5 -6
- {h2lib_tests-13.1.202.dist-info → h2lib_tests-13.1.301.dist-info}/WHEEL +1 -1
- h2lib_tests/utils.py +0 -72
- {h2lib_tests-13.1.202.dist-info → h2lib_tests-13.1.301.dist-info}/top_level.txt +0 -0
h2lib_tests/test_h2lib.py
CHANGED
@@ -74,6 +74,31 @@ def test_sensors():
|
|
74
74
|
npt.assert_array_equal(data[:, 1:4], r[:, 3:6])
|
75
75
|
|
76
76
|
|
77
|
+
@pytest.mark.parametrize('time_stop', [1, 10])
|
78
|
+
def test_write_output(time_stop):
|
79
|
+
|
80
|
+
model_path = tfp + "minimal/"
|
81
|
+
if os.path.isfile(model_path + 'res/tmp.hdf5'):
|
82
|
+
os.remove(model_path + 'res/tmp.hdf5')
|
83
|
+
with H2Lib() as h2:
|
84
|
+
htc = HTCFile(model_path + 'htc/minimal.htc')
|
85
|
+
htc.simulation.time_stop = time_stop
|
86
|
+
htc.output.buffer = 1000
|
87
|
+
htc.output.add_sensor('general', 'step', [0.9, 1, 2])
|
88
|
+
htc.output.add_sensor('general', 'step', [1, 1, 2])
|
89
|
+
htc.set_name('tmp')
|
90
|
+
htc.save()
|
91
|
+
h2.init('htc/tmp.htc', model_path)
|
92
|
+
h2.run(1)
|
93
|
+
|
94
|
+
time, data, _ = gtsdf.load(model_path + 'res/tmp.hdf5')
|
95
|
+
assert data.shape == (10, 2)
|
96
|
+
npt.assert_array_equal(time, np.arange(.1, 1.1, .1))
|
97
|
+
if 0:
|
98
|
+
plt.plot(time, data)
|
99
|
+
plt.show()
|
100
|
+
|
101
|
+
|
77
102
|
def test_set_windspeed_uvw():
|
78
103
|
with H2Lib() as h2:
|
79
104
|
pos = [0, 0, -119]
|
@@ -2,11 +2,10 @@ h2lib_tests/__init__.py,sha256=VjSqfGg8BzdmSjfSFhJh4hZbYZ_cME7xp9EWFKHQphA,61
|
|
2
2
|
h2lib_tests/dtu10mw.py,sha256=a7SXfyDwDQPastYKb5CgghOQcYfgO1eTwGrd-H3Enok,4374
|
3
3
|
h2lib_tests/test_calc.py,sha256=VNLfr2J9R2Jy9xTbdZ9dfbQ4dCwr7H7nbZRI3yP69fQ,2152
|
4
4
|
h2lib_tests/test_ellipsys_couplings.py,sha256=69I_2h_PMfuIUgxnlLp_6bkS5IEpWMWnnPV1sRrWEp0,2399
|
5
|
-
h2lib_tests/test_h2lib.py,sha256=
|
5
|
+
h2lib_tests/test_h2lib.py,sha256=ZKp8pfQQpCUQ7IBXypTmvewbJwTQowSiCEt6t4R9TgY,13384
|
6
6
|
h2lib_tests/test_h2rotor.py,sha256=kaE9AFDYSPaMFSgBAbeegd7-l6Z_4_BsQaWie0k32q4,6210
|
7
7
|
h2lib_tests/test_mpi.py,sha256=emBgXRAvvFFOsVrAziiQCUZvEF9HS5Wc-x4KqqltQP0,6835
|
8
8
|
h2lib_tests/test_multiprocessinterface.py,sha256=h2o4havtK6IuMXsplNjGUa3VxOnbpEYGxdrrAKQilj0,1470
|
9
|
-
h2lib_tests/utils.py,sha256=Kj1WxegDt0SR-l9jNKnTIDx9QczoYi-7LUnWSSDcTKM,2859
|
10
9
|
h2lib_tests/test_files/__init__.py,sha256=9e6ZUPb42e0wf2E1rutdcTM8hROcWFRVPXtZriU3ySw,50
|
11
10
|
h2lib_tests/test_files/my_test_cls.py,sha256=7ZDsFkxrLfOY6q00U5Y-daxfuhATK-K5H04RP-VmQdE,850
|
12
11
|
h2lib_tests/test_files/DTU_10_MW/control/dtu_we_controller.dll,sha256=C5T_CuAFtIuDgCXSYAoNu24yKPwj2nWOeORacJbLN9s,1134592
|
@@ -80,7 +79,7 @@ h2lib_tests/test_files/minimal/res/minimal_mann_turb.hdf5,sha256=Q3cs3bZyplZjBpo
|
|
80
79
|
h2lib_tests/test_files/minimal/turb/hawc2_mann_l33.6_ae0.1000_g3.9_h0_512xd32xd16_2.000x3.00x4.00_s0001_u,sha256=byiorJmXDL6uKFbyfXthHTjJdm6ELvLR2lS202KrhRI,1048576
|
81
80
|
h2lib_tests/test_files/minimal/turb/hawc2_mann_l33.6_ae0.1000_g3.9_h0_512xd32xd16_2.000x3.00x4.00_s0001_v,sha256=cxK5Rfgfm3gyJsEYi_KlmYY8DIIl_G0aizN2jt18Glc,1048576
|
82
81
|
h2lib_tests/test_files/minimal/turb/hawc2_mann_l33.6_ae0.1000_g3.9_h0_512xd32xd16_2.000x3.00x4.00_s0001_w,sha256=xs61jAwhP3fIR1P5Oa8ovEt2baLoF8uCNs6pKIT8L4o,1048576
|
83
|
-
h2lib_tests-13.1.
|
84
|
-
h2lib_tests-13.1.
|
85
|
-
h2lib_tests-13.1.
|
86
|
-
h2lib_tests-13.1.
|
82
|
+
h2lib_tests-13.1.301.dist-info/METADATA,sha256=lxqq_mHrbO-kMkpeI_HsljxE8rary1_h-KUUFM1F5RY,349
|
83
|
+
h2lib_tests-13.1.301.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
|
84
|
+
h2lib_tests-13.1.301.dist-info/top_level.txt,sha256=WufAL3LO35YJBhWg1AfgTjSld-6l_WuRkXAkNKczUrM,12
|
85
|
+
h2lib_tests-13.1.301.dist-info/RECORD,,
|
h2lib_tests/utils.py
DELETED
@@ -1,72 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
|
3
|
-
import subprocess
|
4
|
-
from pathlib import Path
|
5
|
-
from platform import architecture
|
6
|
-
import tempfile
|
7
|
-
|
8
|
-
# Avoid
|
9
|
-
# urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1124)>
|
10
|
-
# in some docker images
|
11
|
-
import ssl
|
12
|
-
try:
|
13
|
-
_create_unverified_https_context = ssl._create_unverified_context
|
14
|
-
except AttributeError:
|
15
|
-
# Legacy Python that doesn't verify HTTPS certificates by default
|
16
|
-
pass
|
17
|
-
else:
|
18
|
-
# Handle target environment that doesn't support HTTPS verification
|
19
|
-
ssl._create_default_https_context = _create_unverified_https_context
|
20
|
-
|
21
|
-
|
22
|
-
def install_license(platform=None):
|
23
|
-
if platform is None:
|
24
|
-
if os.name == 'nt':
|
25
|
-
if architecture()[0][:2] == '32':
|
26
|
-
platform = 'win32'
|
27
|
-
else:
|
28
|
-
platform = 'x64'
|
29
|
-
else:
|
30
|
-
platform = 'linux'
|
31
|
-
from urllib.request import Request, urlopen
|
32
|
-
print("Starting license installation")
|
33
|
-
p = Path('hawc2-%s' % platform.replace("x64", 'win64'))
|
34
|
-
|
35
|
-
if 'CI_PRIVATE_PAT' in os.environ:
|
36
|
-
CI_PRIVATE_PAT = os.environ['CI_PRIVATE_PAT']
|
37
|
-
|
38
|
-
# Download the licensefile installer
|
39
|
-
url = "http://gitlab.windenergy.dtu.dk/api/v4/projects/2447/jobs/artifacts/main/raw/"
|
40
|
-
|
41
|
-
job, exe = {'win32': ('build-Windows', 'license_manager.exe'),
|
42
|
-
'x64': ('build-Windows', 'license_manager.exe'),
|
43
|
-
'linux': ('build-Linux', 'license_manager')}[platform]
|
44
|
-
path = f"{exe}?job={job}"
|
45
|
-
req = Request(url + path)
|
46
|
-
req.add_header('PRIVATE-TOKEN', CI_PRIVATE_PAT)
|
47
|
-
print(f"license_manager GET status:{urlopen(req).code}")
|
48
|
-
|
49
|
-
with tempfile.TemporaryDirectory() as tmpdirname:
|
50
|
-
exe = os.path.join(tmpdirname, exe)
|
51
|
-
cfg = os.path.join(tmpdirname, "HAWC2-ci.cfg")
|
52
|
-
with open(f"{exe}", 'wb+') as fid:
|
53
|
-
fid.write(urlopen(req).read())
|
54
|
-
if platform == "linux":
|
55
|
-
os.chmod(exe, 0o755)
|
56
|
-
|
57
|
-
# Download the keygen license file
|
58
|
-
url = "http://gitlab.windenergy.dtu.dk/api/v4/projects/1203/jobs/artifacts/ci_runner/raw/"
|
59
|
-
path = "keygen_license/HAWC2-ci.cfg?job=all_license_files"
|
60
|
-
req = Request(url + path)
|
61
|
-
req.add_header('PRIVATE-TOKEN', CI_PRIVATE_PAT)
|
62
|
-
print(f"License file GET status:{urlopen(req).code}")
|
63
|
-
with open(cfg, 'wb+') as fid:
|
64
|
-
fid.write(urlopen(req).read())
|
65
|
-
|
66
|
-
# Install license
|
67
|
-
print(f"Installing license on {platform}")
|
68
|
-
status = subprocess.run([os.path.abspath(exe), 'install', '-y', 'hawc2', cfg])
|
69
|
-
print(f"Status: {status.returncode}")
|
70
|
-
print(f"StdOut: {status.stdout}")
|
71
|
-
print(f"StdErr: {status.stderr}")
|
72
|
-
status = subprocess.run([os.path.abspath(exe), 'info', 'hawc2', 'installed'])
|
File without changes
|