Skip to content

Commit 15ada53

Browse files
readme (#8)
1 parent 13aa0b2 commit 15ada53

File tree

4 files changed

+90
-27
lines changed

4 files changed

+90
-27
lines changed

energyml-utils/README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,52 @@ or with poetry:
2727
```console
2828
poetry add energyml-utils
2929
```
30+
31+
32+
Features
33+
--------
34+
35+
### Supported packages versions
36+
37+
This package supports read/write in xml/json the following packages :
38+
- EML (common) : 2.0, 2.1, 2.2, 2.3
39+
- RESQML : 2.0.1, 2.2dev3, 2.2
40+
- WITSMl : 2.0, 2.1
41+
- PRODML : 2.0, 2.2
42+
43+
/!\\ By default, these package are not installed and are published independently.
44+
You can install only the versions you need by adding the following lines in the .toml file :
45+
```toml
46+
energyml-common2-0 = "^1.12.0"
47+
energyml-common2-1 = "^1.12.0"
48+
energyml-common2-2 = "^1.12.0"
49+
energyml-common2-3 = "^1.12.0"
50+
energyml-resqml2-0-1 = "^1.12.0"
51+
energyml-resqml2-2-dev3 = "^1.12.0"
52+
energyml-resqml2-2 = "^1.12.0"
53+
energyml-witsml2-0 = "^1.12.0"
54+
energyml-witsml2-1 = "^1.12.0"
55+
energyml-prodml2-0 = "^1.12.0"
56+
energyml-prodml2-2 = "^1.12.0"
57+
```
58+
59+
### Content of the package :
60+
61+
- Support EPC + h5 read and write
62+
- *.rels* files are automatically generated, but it is possible to add custom Relations.
63+
- You can add "raw files" such as PDF or anything else, in your EPC instance, and it will be package with other files in the ".epc" file when you call the "export" function.
64+
- You can work with local files, but also with IO (BytesIO). This is usefull to work with cloud application to avoid local storage.
65+
- Supports xml / json read and write (for energyml objects)
66+
- *Work in progress* : Supports the read of 3D data inside the "AbstractMesh" class (and sub-classes "PointSetMesh", "PolylineSetMesh", "SurfaceMesh"). This gives you a instance containing a list of point and a list of indices to easily re-create a 3D representation of the data.
67+
- These "mesh" classes provides *.obj*, *.off*, and *.geojson* export.
68+
- Introspection : This package includes functions to ease the access of specific values inside energyml objects.
69+
- Functions to access to UUID, object Version, and more generic functions for any other attributes with regex like ".Citation.Title" or "Cit\\.*.Title" (regular dots are used as in python object attribute access. To use dot in regex, you must escape them with a '\\')
70+
- Functions to parse, or generate from an energyml object the "ContentType" or "QualifiedType"
71+
- Generation of random data : you can generate random values for a specific energyml object. For example, you can generate a WITSML Tubular object with random values in it.
72+
- Objects correctness validation :
73+
- You can verify if your objects are valid following the energyml norm (a check is done on regex contraint attributes, maxCount, minCount, mandatory etc...)
74+
- The DOR validation is tested : check if the DOR has correct information (title, ContentType/QualifiedType, object version), and also if the referenced object exists in the context of the EPC instance (or a list of object).
75+
- Abstractions done to ease use with *ETP* (Energistics Transfer Protocol) :
76+
- The "EnergymlWorkspace" class allows to abstract the access of numerical data like "ExternalArrays". This class can thus be extended to interact with ETP "GetDataArray" request etc...
77+
- ETP URI support : the "Uri" class allows to parse/write an etp uri.
78+

energyml-utils/example/main.py

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
)
1616

1717
from src.energyml.utils.data.hdf import *
18+
from src.energyml.utils.data.helper import get_projected_uom
1819
from src.energyml.utils.epc import *
1920
from src.energyml.utils.introspection import *
2021
from src.energyml.utils.manager import *
@@ -440,6 +441,18 @@ def test_local_depth_crs():
440441
print(e)
441442

442443

444+
def test_get_projected_uom():
445+
# Fails because the xsi:type="VerticalCrsEpsgCode" doesn't
446+
# contain the namespace : xsi:type="eml:VerticalCrsEpsgCode"
447+
try:
448+
depth3d = read_energyml_xml_file(
449+
"../rc/obj_LocalDepth3dCrs_716f6472-18a3-4f19-a57c-d4f5642ccc53.xml"
450+
)
451+
print(get_projected_uom(depth3d).value)
452+
except Exception as e:
453+
print(e)
454+
455+
443456
def test_wellbore_marker_frame_representation():
444457
# Fails because the xsi:type="VerticalCrsEpsgCode" doesn't
445458
# contain the namespace : xsi:type="eml:VerticalCrsEpsgCode"
@@ -517,19 +530,20 @@ def class_field():
517530

518531

519532
if __name__ == "__main__":
520-
tests_0()
521-
tests_content_type()
522-
523-
tests_epc()
524-
tests_dor()
525-
test_verif()
526-
test_ast()
527-
test_introspection()
528-
529-
tests_hdf()
530-
test_local_depth_crs()
531-
test_wellbore_marker_frame_representation()
532-
533-
test_obj_attribs()
534-
test_copy_values()
535-
class_field()
533+
# tests_0()
534+
# tests_content_type()
535+
#
536+
# tests_epc()
537+
# tests_dor()
538+
# test_verif()
539+
# test_ast()
540+
# test_introspection()
541+
#
542+
# tests_hdf()
543+
# test_local_depth_crs()
544+
# test_wellbore_marker_frame_representation()
545+
#
546+
# test_obj_attribs()
547+
# test_copy_values()
548+
# class_field()
549+
test_get_projected_uom()

energyml-utils/src/energyml/utils/data/helper.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,14 @@ def is_z_reversed(crs: Optional[Any]) -> bool:
9696

9797

9898
def get_vertical_epsg_code(crs_object: Any):
99-
projected_epsg_code = None
99+
vertical_epsg_code = None
100100
if crs_object is not None: # LocalDepth3dCRS
101-
projected_epsg_code = get_object_attribute_rgx(crs_object, "VerticalCrs.EpsgCode")
102-
if projected_epsg_code is None: # LocalEngineering2DCrs
103-
projected_epsg_code = get_object_attribute_rgx(
101+
vertical_epsg_code = get_object_attribute_rgx(crs_object, "VerticalCrs.EpsgCode")
102+
if vertical_epsg_code is None: # LocalEngineering2DCrs
103+
vertical_epsg_code = get_object_attribute_rgx(
104104
crs_object, "OriginProjectedCrs.AbstractProjectedCrs.EpsgCode"
105105
)
106-
return projected_epsg_code
106+
return vertical_epsg_code
107107

108108

109109
def get_projected_epsg_code(crs_object: Any, workspace: Optional[EnergymlWorkspace] = None):
@@ -124,15 +124,15 @@ def get_projected_epsg_code(crs_object: Any, workspace: Optional[EnergymlWorkspa
124124

125125
def get_projected_uom(crs_object: Any, workspace: Optional[EnergymlWorkspace] = None):
126126
if crs_object is not None:
127-
projected_epsg_code = get_object_attribute_rgx(crs_object, "ProjectedUom")
128-
if projected_epsg_code is None:
129-
projected_epsg_code = get_object_attribute_rgx(crs_object, "HorizontalAxes.ProjectedUom")
127+
projected_epsg_uom = get_object_attribute_rgx(crs_object, "ProjectedUom")
128+
if projected_epsg_uom is None:
129+
projected_epsg_uom = get_object_attribute_rgx(crs_object, "HorizontalAxes.ProjectedUom")
130130

131-
if projected_epsg_code is None and workspace is not None:
131+
if projected_epsg_uom is None and workspace is not None:
132132
return get_projected_uom(
133133
workspace.get_object_by_uuid(get_object_attribute_rgx(crs_object, "LocalEngineering2[dD]Crs.Uuid"))
134134
)
135-
return projected_epsg_code
135+
return projected_epsg_uom
136136
return None
137137

138138

energyml-utils/src/energyml/utils/introspection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ def search_attribute_matching_name_with_path(
602602
) -> List[Tuple[str, Any]]:
603603
"""
604604
Returns a list of tuple (path, value) for each sub attribute with type matching param "name_rgx".
605-
The path is a dot-version like ".Citation.Title"
605+
The path is a dot-version like ".Citation.Title"
606606
:param obj:
607607
:param name_rgx:
608608
:param re_flags:

0 commit comments

Comments
 (0)