88 StringXmlArray ,
99 IntegerXmlArray ,
1010)
11- from energyml .resqml .v2_0_1 .resqmlv2 import WellboreMarkerFrameRepresentation
1211
1312from src .energyml .utils .data .hdf import (
1413 get_hdf_reference_with_path ,
15- get_hdf5_path_from_external_path ,
1614)
1715from src .energyml .utils .data .helper import (
1816 get_array_reader_function ,
19- get_supported_array ,
20- get_not_supported_array ,
2117)
2218from src .energyml .utils .data .mesh import *
2319from src .energyml .utils .data .mesh import _create_shape , _write_geojson_shape
24- from src .energyml .utils .epc import gen_energyml_object_path
20+ from src .energyml .utils .epc import gen_energyml_object_path , get_hdf5_path_from_external_path
2521from src .energyml .utils .introspection import (
2622 is_abstract ,
2723 get_obj_uuid ,
28- get_class_fields ,
2924)
3025from src .energyml .utils .manager import get_sub_classes
3126from src .energyml .utils .serialization import (
3530 read_energyml_xml_tree ,
3631)
3732from src .energyml .utils .validation import validate_epc
38- from src .energyml .utils .xml import RGX_CONTENT_TYPE , get_tree
39-
33+ from src .energyml .utils .xml import get_tree
4034
4135logger = logging .getLogger (__name__ )
4236
@@ -129,7 +123,7 @@ def read_h5_datasets():
129123 print (epc201 .epc_file_path )
130124
131125 pt_set_list = read_point_representation (
132- energyml_object = psr , workspace = EPCWorkspace ( epc = epc201 )
126+ energyml_object = psr , workspace = epc201
133127 )
134128
135129 with open ("../example/result/file_point_set.off" , "wb" ) as f :
@@ -153,7 +147,7 @@ def read_h5_polyline():
153147 poly = epc201 .get_object_by_uuid ("77bfb696-1bc0-4858-a304-f8faeb37d809" )[0 ]
154148 poly_set_list = read_polyline_representation (
155149 energyml_object = poly ,
156- workspace = EPCWorkspace ( epc201 ) ,
150+ workspace = epc201 ,
157151 )
158152 with open ("../example/result/polyline_set.obj" , "wb" ) as f :
159153 export_obj (
@@ -215,7 +209,7 @@ def read_h5_grid2d():
215209 grid = epc22 .get_object_by_uuid (uuid )[0 ]
216210 grid_list = read_mesh_object (
217211 energyml_object = grid ,
218- workspace = EPCWorkspace ( epc22 ) ,
212+ workspace = epc22 ,
219213 # keep_holes=False
220214 )
221215 print ("Exporting" )
@@ -240,7 +234,7 @@ def read_meshes():
240234 energyml_obj = epc22 .get_object_by_uuid (uuid )[0 ]
241235 mesh_list = read_mesh_object (
242236 energyml_object = energyml_obj ,
243- workspace = EPCWorkspace ( epc22 ) ,
237+ workspace = epc22 ,
244238 )
245239 print ("Exporting" )
246240 with open (
@@ -374,6 +368,31 @@ def test_export_multiple_geojson_volve():
374368 )
375369
376370
371+ def test_export_multiple_geojson_volve_struct ():
372+ uuid_list = [
373+ "c2f53ce1-1b2d-4819-b397-f174bc8c23e0" , # depthVolve_F11_2011_MBA
374+ "d9b95bb5-019d-4341-bcf6-df392338187f" , # depth_Ty_Fm_Top_MBA
375+ ]
376+ export_multiple_data (
377+ epc_path = "D:/Geosiris/OSDU/manifestTranslation/#Data/VOLVE_STRUCT.epc" ,
378+ uuid_list = uuid_list ,
379+ output_folder_path = "../example/result/export-energyml-utils/VOLVE_STRUCT" ,
380+ # output_folder_path="D:/Geosiris/Cloud/Resqml_Tools/2023-DATA/03_VOLVE/V2.0.1/EQN_ORIGIN_PLUS_TRIANG_SET/export-energyml-utils",
381+ file_format = MeshFileFormat .GEOJSON ,
382+ use_crs_displacement = False ,
383+ logger = logger ,
384+ )
385+ export_multiple_data (
386+ epc_path = "D:/Geosiris/OSDU/manifestTranslation/#Data/VOLVE_STRUCT.epc" ,
387+ uuid_list = uuid_list ,
388+ output_folder_path = "../example/result/export-energyml-utils/VOLVE_STRUCT_CRS_displaced" ,
389+ # output_folder_path="D:/Geosiris/Cloud/Resqml_Tools/2023-DATA/03_VOLVE/V2.0.1/EQN_ORIGIN_PLUS_TRIANG_SET/export-energyml-utils",
390+ file_format = MeshFileFormat .GEOJSON ,
391+ use_crs_displacement = True ,
392+ logger = logger ,
393+ )
394+
395+
377396def test_export_multiple_testing_package ():
378397 uuid_list = [
379398 "030a82f6-10a7-4ecf-af03-54749e098624" , # grid2d
@@ -407,29 +426,42 @@ def test_export_multiple_testing_package():
407426
408427
409428def test_export_closed_poly ():
410- export_multiple_data (
411- epc_path = "D:/Geosiris/OSDU/manifestTranslation/#Data/"
412- "Volve_Fault_Depth_originEQN_v201_poly_closed.epc" ,
413- uuid_list = [
414- "4e23ee3e-54a7-427a-83f9-1473de6c56a4" , # polyline
415- "38bf3283-9514-43ab-81e3-17080dc5826f" , # polyline
416- ],
417- output_folder_path = "../example/result/export-energyml-utils" ,
418- # output_folder_path="D:/Geosiris/OSDU/manifestTranslation/#Data/export-energyml-utils",
419- output_file_path_suffix = "_poly_closed" ,
420- file_format = MeshFileFormat .OBJ ,
421- )
429+ # export_multiple_data(
430+ # epc_path="D:/Geosiris/OSDU/manifestTranslation/#Data/"
431+ # "Volve_Fault_Depth_originEQN_v201_poly_closed.epc",
432+ # uuid_list=[
433+ # "4e23ee3e-54a7-427a-83f9-1473de6c56a4", # polyline
434+ # "38bf3283-9514-43ab-81e3-17080dc5826f", # polyline
435+ # ],
436+ # output_folder_path="../example/result/export-energyml-utils",
437+ # # output_folder_path="D:/Geosiris/OSDU/manifestTranslation/#Data/export-energyml-utils",
438+ # output_file_path_suffix="_poly_closed",
439+ # file_format=MeshFileFormat.OBJ,
440+ # )
441+ # export_multiple_data(
442+ # epc_path="D:/Geosiris/OSDU/manifestTranslation/#Data/"
443+ # "Volve_Fault_Depth_originEQN_v201.epc",
444+ # uuid_list=[
445+ # "4e23ee3e-54a7-427a-83f9-1473de6c56a4", # polyline
446+ # "38bf3283-9514-43ab-81e3-17080dc5826f", # polyline
447+ # ],
448+ # output_folder_path="../example/result/export-energyml-utils",
449+ # # output_folder_path="D:/Geosiris/OSDU/manifestTranslation/#Data/export-energyml-utils",
450+ # output_file_path_suffix="closed",
451+ # file_format=MeshFileFormat.OBJ,
452+ # )
422453 export_multiple_data (
423454 epc_path = "D:/Geosiris/OSDU/manifestTranslation/#Data/"
424455 "Volve_Fault_Depth_originEQN_v201.epc" ,
425456 uuid_list = [
426457 "4e23ee3e-54a7-427a-83f9-1473de6c56a4" , # polyline
427458 "38bf3283-9514-43ab-81e3-17080dc5826f" , # polyline
459+ "5db39032-4998-4b75-9156-ea104a8649d2" , # TrSet
428460 ],
429- output_folder_path = "../example/result/export-energyml-utils" ,
461+ output_folder_path = "../example/result/export-energyml-utils/geojson " ,
430462 # output_folder_path="D:/Geosiris/OSDU/manifestTranslation/#Data/export-energyml-utils",
431- output_file_path_suffix = "closed " ,
432- file_format = MeshFileFormat .OBJ ,
463+ output_file_path_suffix = "new " ,
464+ file_format = MeshFileFormat .GEOJSON ,
433465 )
434466
435467
@@ -642,6 +674,37 @@ def test_simple_geojson_io():
642674 print (f"\n +++++++++++++++++++++++++\n " )
643675
644676
677+ def test_wellbore_reading ():
678+ # WIP
679+ path = "../rc/obj_EpcExternalPartReference_61fa2fdf-46ab-4c02-ab72-7895cce58e37.xml"
680+
681+ with open (path , "rb" ) as f :
682+ xml_content = f .read ()
683+ # print(xml_content)
684+
685+ print (read_energyml_xml_bytes (xml_content ))
686+
687+
688+ def read_sub_representation ():
689+ epc_path = "D:/Geosiris/Cloud/Resqml_Tools/2023-DATA/03_VOLVE/V2.0.1/ASPEN_TECH_RDDMS_IMPORT/Volve_Demo_Horizons_Depth.epc"
690+ # epc_path = "D:/Geosiris/Cloud/Resqml_Tools/OSDU/OSDU_RESERVOIR_DDMS/F2F_Demo.epc"
691+ # epc = Epc.read_file(epc_path)
692+
693+ uuid_list = [
694+ "e2e7f8a9-c602-4c02-99cb-cff3ef79ce84" , # Grid Subrep
695+ "5bc4bfd9-44fa-433a-a362-59c5b35cd9e8" , # Grid Subrep
696+ "218283a7-44eb-44fa-9074-7cb1cff125f2" , # Grid Subrep
697+ "1450e49e-830a-4430-a482-aa06fcd013f5" , # Grid Subrep
698+ ]
699+
700+ export_multiple_data (
701+ epc_path = epc_path ,
702+ uuid_list = uuid_list ,
703+ output_folder_path = "../example/result/subrep/" ,
704+ file_format = MeshFileFormat .OBJ ,
705+ )
706+
707+
645708if __name__ == "__main__" :
646709
647710 logging .basicConfig (
@@ -678,6 +741,9 @@ def test_simple_geojson_io():
678741 # test_export_multiple_geojson()
679742 # test_export_multiple_geojson_volve()
680743 # test_simple_geojson()
681- test_simple_geojson_io ()
744+ # test_simple_geojson_io()
745+ # test_export_multiple_geojson_volve_struct()
746+ read_sub_representation ()
682747
683748 # test_etree()
749+ # test_wellbore_reading()
0 commit comments