Skip to content

Commit 3e015cb

Browse files
epc stream fully working even for arrays
1 parent 3387aac commit 3e015cb

8 files changed

Lines changed: 390 additions & 103 deletions

File tree

energyml-utils/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ src/energyml/utils/converter/
3939

4040
# Other files
4141
requirements.txt
42+
.github/
43+
44+
4245
#doc/
4346
sample/
4447
gen*/

energyml-utils/example/main_stream_sample.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import sys
33
import logging
44
from energyml.utils.epc_stream import EpcStreamReader, RelsUpdateMode
5-
from energyml.eml.v2_3.commonv2 import Citation, ExternalDataArrayPart,
5+
from energyml.eml.v2_3.commonv2 import Citation, ExternalDataArrayPart
66
from energyml.resqml.v2_2.resqmlv2 import (
77
TriangulatedSetRepresentation,
88
BoundaryFeatureInterpretation,
@@ -14,15 +14,18 @@
1414
PointGeometry,
1515
Point3DExternalArray,
1616
)
17+
18+
from energyml.resqml.v2_0_1.resqmlv2 import TrianglePatch as TrianglePatchV2_0_1
1719
from energyml.utils.introspection import epoch_to_date, epoch
1820
from energyml.utils.epc import as_dor, gen_uuid, get_obj_identifier
1921
from energyml.utils.constants import EPCRelsRelationshipType, MimeType
2022

2123
from energyml.opc.opc import Relationship
24+
import numpy as np
2225

2326

24-
CONST_H5_PATH = "wip/external_data.h5"
25-
CONST_CSV_PATH = "wip/external_data.csv"
27+
CONST_H5_PATH = "external_data.h5"
28+
CONST_CSV_PATH = "external_data.csv"
2629

2730

2831
def sample_objects():
@@ -250,8 +253,20 @@ def test_create_epc_v3_with_different_external_files(path: str):
250253
tr_set_id,
251254
relationships=[Relationship(type_value=str(EPCRelsRelationshipType.EXTERNAL_RESOURCE), target=h5_file_path)],
252255
)
253-
254-
epc.write_array()
256+
257+
epc.write_array(
258+
proxy=tr_set_id,
259+
path_in_external=f"/RESQML/{tr_set_id}/triangles",
260+
array=np.array([0, 1, 2, 2, 3, 0], dtype=np.int32),
261+
external_uri=CONST_H5_PATH,
262+
)
263+
264+
epc.write_array(
265+
proxy=tr_set_id,
266+
path_in_external=f"/RESQML/{tr_set_id}/points",
267+
array=np.array([[0.0, 0.0, 0.0], [1.0, 0.0, 0.0], [1.0, 1.0, 0.0]], dtype=np.float32),
268+
external_uri=CONST_CSV_PATH,
269+
)
255270

256271
# Create an
257272

energyml-utils/example/main_test_3D.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ def export_all_representation_in_memory(epc_path: str, output_dir: str, regex_ty
135135
import logging
136136

137137
logging.basicConfig(level=logging.DEBUG)
138-
# epc_file = "rc/epc/testingPackageCpp.epc"
139-
epc_file = "rc/epc/output-val.epc"
138+
epc_file = "rc/epc/testingPackageCpp.epc"
139+
# epc_file = "rc/epc/output-val.epc"
140140
# epc_file = "rc/epc/Volve_Horizons_and_Faults_Depth_originEQN.epc"
141141
output_directory = Path("exported_meshes") / Path(epc_file).name.replace(".epc", "_3D_export")
142142
# export_all_representation(epc_file, output_directory)
143143
# export_all_representation(epc_file, output_directory, regex_type_filter="Wellbore")
144-
# export_all_representation(epc_file, str(output_directory), regex_type_filter="")
145-
export_all_representation_in_memory(epc_file, str(output_directory), regex_type_filter="")
144+
export_all_representation(epc_file, str(output_directory), regex_type_filter="")
145+
# export_all_representation_in_memory(epc_file, str(output_directory), regex_type_filter="")

0 commit comments

Comments
 (0)