Skip to content

Commit acb7d20

Browse files
PProfizimoe-ad
andauthored
feat(hdf5): assign .h5 files to hdf5 key (#2838)
Co-authored-by: Muhammed Adedigba <68085496+moe-ad@users.noreply.github.com>
1 parent 49285c4 commit acb7d20

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/ansys/dpf/core/data_sources.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ def set_result_file_path(
173173
# Look for another extension for .h5 and .cff files
174174
if key == "" and extension in [".h5", ".cff"]:
175175
key = self.guess_second_key(str(filepath))
176+
if key == "" and extension == ".h5":
177+
key = "h5dpf"
176178
if key == "":
177179
self._api.data_sources_set_result_file_path_utf8(self, str(filepath))
178180
else:

tests/test_datasources.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ def test_set_resultpath_data_sources_cff(server_type):
103103
assert data_sources.result_key == "cas"
104104

105105

106+
def test_auto_key_data_sources_h5dpf(server_type):
107+
data_sources = dpf.core.DataSources(result_path="test.h5", server=server_type)
108+
assert data_sources.result_key == "h5dpf"
109+
110+
106111
def test_set_resultpath_data_sources_cfx_res(server_type):
107112
from ansys.dpf.core import examples
108113

0 commit comments

Comments
 (0)