orchid-python-api 5.25.3__py3-none-any.whl → 5.25.4__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.
- orchid_python_api/examples/search_data_frames.py +1 -1
- {orchid_python_api-5.25.3.dist-info → orchid_python_api-5.25.4.dist-info}/METADATA +4 -3
- orchid_python_api-5.25.4.dist-info/RECORD +38 -0
- {orchid_python_api-5.25.3.dist-info → orchid_python_api-5.25.4.dist-info}/WHEEL +1 -1
- ReleaseNotes.md +0 -730
- copy_orchid_examples.py +0 -88
- copy_orchid_low_level_examples.py +0 -93
- copy_orchid_manual_examples.py +0 -93
- copy_orchid_tutorials.py +0 -88
- orchid/VERSION +0 -1
- orchid/__init__.py +0 -42
- orchid/__version__.py +0 -18
- orchid/base.py +0 -31
- orchid/base_time_series_adapter.py +0 -91
- orchid/configuration.py +0 -162
- orchid/convert.py +0 -44
- orchid/core.py +0 -149
- orchid/dom_project_object.py +0 -28
- orchid/dot_net.py +0 -68
- orchid/dot_net_disposable.py +0 -64
- orchid/dot_net_dom_access.py +0 -241
- orchid/measurement.py +0 -35
- orchid/native_data_frame_adapter.py +0 -247
- orchid/native_fiber_data.py +0 -73
- orchid/native_fiber_data_set_info.py +0 -28
- orchid/native_monitor_adapter.py +0 -67
- orchid/native_project_user_data_adapter.py +0 -137
- orchid/native_stage_adapter.py +0 -631
- orchid/native_stage_part_adapter.py +0 -50
- orchid/native_subsurface_point.py +0 -70
- orchid/native_time_series_adapter.py +0 -54
- orchid/native_trajectory_adapter.py +0 -246
- orchid/native_treatment_calculations.py +0 -158
- orchid/native_treatment_curve_adapter.py +0 -60
- orchid/native_well_adapter.py +0 -134
- orchid/net_date_time.py +0 -328
- orchid/net_enumerable.py +0 -72
- orchid/net_fracture_diagnostics_factory.py +0 -55
- orchid/net_quantity.py +0 -620
- orchid/net_stage_qc.py +0 -62
- orchid/physical_quantity.py +0 -37
- orchid/project.py +0 -182
- orchid/project_store.py +0 -269
- orchid/reference_origins.py +0 -34
- orchid/script_adapter_context.py +0 -81
- orchid/searchable_data_frames.py +0 -44
- orchid/searchable_project_objects.py +0 -190
- orchid/searchable_stage_parts.py +0 -73
- orchid/searchable_stages.py +0 -29
- orchid/unit_system.py +0 -173
- orchid/utils.py +0 -14
- orchid/validation.py +0 -52
- orchid/version.py +0 -37
- orchid_python_api-5.25.3.dist-info/LICENSE +0 -176
- orchid_python_api-5.25.3.dist-info/RECORD +0 -88
- {orchid_python_api-5.25.3.dist-info → orchid_python_api-5.25.4.dist-info}/entry_points.txt +0 -0
- /LICENSE → /orchid_python_api-5.25.4.dist-info/licenses/LICENSE +0 -0
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# This file is part of Orchid and related technologies.
|
|
3
|
-
#
|
|
4
|
-
# Copyright (c) 2017-2025 KAPPA. All Rights Reserved.
|
|
5
|
-
#
|
|
6
|
-
# LEGAL NOTICE:
|
|
7
|
-
# Orchid contains trade secrets and otherwise confidential information
|
|
8
|
-
# owned by KAPPA. Access to and use of this information is
|
|
9
|
-
# strictly limited and controlled by the Company. This file may not be copied,
|
|
10
|
-
# distributed, or otherwise disclosed outside of the Company's facilities
|
|
11
|
-
# except under appropriate precautions to maintain the confidentiality hereof,
|
|
12
|
-
# and may not be used in any way not expressly authorized by the Company.
|
|
13
|
-
#
|
|
14
|
-
|
|
15
|
-
from typing import Callable, Iterator, Optional
|
|
16
|
-
import uuid
|
|
17
|
-
|
|
18
|
-
import toolz.curried as toolz
|
|
19
|
-
|
|
20
|
-
from orchid import dom_project_object as dpo
|
|
21
|
-
|
|
22
|
-
# noinspection PyUnresolvedReferences
|
|
23
|
-
from Orchid.FractureDiagnostics import IProjectObject
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
class SearchableProjectError(ValueError):
|
|
27
|
-
"""
|
|
28
|
-
Raised when an error occurs searching for a `dpo.DomProjectObject`.
|
|
29
|
-
"""
|
|
30
|
-
pass
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
class SearchableProjectMultipleMatchError(SearchableProjectError):
|
|
34
|
-
"""
|
|
35
|
-
Raised when multiple matches occur when searching for a `dpo.DomProjectObject`.
|
|
36
|
-
"""
|
|
37
|
-
pass
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"""
|
|
41
|
-
Provides a searchable collection of `DomProjectObject` instances. This searchable collection provide methods to:
|
|
42
|
-
|
|
43
|
-
- Query for all object IDs identifying instances in this collection
|
|
44
|
-
- Query for all objects in this collection
|
|
45
|
-
- Query for the name of all instances in this collection
|
|
46
|
-
- Query for the display name of all instances in this collection
|
|
47
|
-
- Search for a single instance by object ID
|
|
48
|
-
- Search for all instances with a specified name
|
|
49
|
-
- Search for all instances with a specified display name
|
|
50
|
-
|
|
51
|
-
Here are the DOM objects that currently may be collections:
|
|
52
|
-
- Data frames
|
|
53
|
-
- Monitors
|
|
54
|
-
- Stages
|
|
55
|
-
- Stage Parts
|
|
56
|
-
- Well trajectory
|
|
57
|
-
- Wells
|
|
58
|
-
|
|
59
|
-
This objects are all derived from `IProjectObject`. The corresponding instances in the Python API all derive from
|
|
60
|
-
`dpo.DomProjectObject` which implements the attributes `object_id`, `name` and `display_name`.
|
|
61
|
-
"""
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
class SearchableProjectObjects:
|
|
65
|
-
def __init__(self, make_adapter: Callable, net_project_objects: Iterator[IProjectObject]):
|
|
66
|
-
"""
|
|
67
|
-
Construct a collection of project objects created my `make_adapter` using the arguments, `net_project_objects`.
|
|
68
|
-
Args:
|
|
69
|
-
make_adapter: The callable that constructs adapter instances using `net_project_objects`.
|
|
70
|
-
net_project_objects: The sequence of .NET `IProjectObject` instances adapted by the Python API.
|
|
71
|
-
"""
|
|
72
|
-
def add_project_object_to_collection(so_far, update_po):
|
|
73
|
-
return toolz.assoc(so_far, update_po.object_id, update_po)
|
|
74
|
-
|
|
75
|
-
self._collection = toolz.pipe(
|
|
76
|
-
net_project_objects,
|
|
77
|
-
toolz.map(make_adapter),
|
|
78
|
-
lambda pos: toolz.reduce(add_project_object_to_collection, pos, {}),
|
|
79
|
-
)
|
|
80
|
-
|
|
81
|
-
def __iter__(self):
|
|
82
|
-
"""
|
|
83
|
-
Return an iterator over the items in this collection.
|
|
84
|
-
|
|
85
|
-
Returns:
|
|
86
|
-
An iterator over the items in this collection.
|
|
87
|
-
"""
|
|
88
|
-
# TODO: Change this implementation to be more "fundamental" than `all_objects()`.
|
|
89
|
-
# The implementation of this method currently calls `all_objects()`. I think this implementation
|
|
90
|
-
# is not quite correct; instead, `all_objects()` should call this method (even if indirectly) which
|
|
91
|
-
# should return an iterator over `self._collection.values()`.
|
|
92
|
-
#
|
|
93
|
-
# Because we have not tested the Orchid Python API much this quarter, because we are creating a
|
|
94
|
-
# release, and because I do not want to destabilize the release at this time, I have chosen to
|
|
95
|
-
# leave the implementation of `all_objects()` as is and implement this method in terms of
|
|
96
|
-
# `all_objects()`. (FYI: I did prototype "switching" the implementations and all unit tests passed.)
|
|
97
|
-
return iter(self.all_objects())
|
|
98
|
-
|
|
99
|
-
def __len__(self):
|
|
100
|
-
"""
|
|
101
|
-
Return the number of items in this collection.
|
|
102
|
-
|
|
103
|
-
Returns:
|
|
104
|
-
The number of items in this collection.
|
|
105
|
-
"""
|
|
106
|
-
return len(self._collection)
|
|
107
|
-
|
|
108
|
-
def all_display_names(self) -> Iterator[str]:
|
|
109
|
-
"""
|
|
110
|
-
Return an iterator over all the display names of project objects in this collection.
|
|
111
|
-
|
|
112
|
-
Returns:
|
|
113
|
-
An iterator over all the display names of project objects in this collection.
|
|
114
|
-
"""
|
|
115
|
-
return toolz.map(lambda po: po.display_name, self._collection.values())
|
|
116
|
-
|
|
117
|
-
def all_names(self) -> Iterator[str]:
|
|
118
|
-
"""
|
|
119
|
-
Return an iterator over all the names of project objects in this collection.
|
|
120
|
-
|
|
121
|
-
Returns:
|
|
122
|
-
An iterator over all the names of project objects in this collection.
|
|
123
|
-
"""
|
|
124
|
-
return toolz.map(lambda po: po.name, self._collection.values())
|
|
125
|
-
|
|
126
|
-
def all_object_ids(self) -> Iterator[uuid.UUID]:
|
|
127
|
-
"""
|
|
128
|
-
Return an iterator over all the object IDs of project objects in this collection.
|
|
129
|
-
|
|
130
|
-
Returns:
|
|
131
|
-
An iterator over all the object IDs of project objects in this collection.
|
|
132
|
-
"""
|
|
133
|
-
return self._collection.keys()
|
|
134
|
-
|
|
135
|
-
def all_objects(self) -> Iterator[dpo.DomProjectObject]:
|
|
136
|
-
"""
|
|
137
|
-
Return an iterator over all the projects objects in this collection.
|
|
138
|
-
|
|
139
|
-
Returns:
|
|
140
|
-
An iterator over all the project objects in this collection.
|
|
141
|
-
"""
|
|
142
|
-
return self._collection.values()
|
|
143
|
-
|
|
144
|
-
def find(self, predicate: Callable) -> Iterator[dpo.DomProjectObject]:
|
|
145
|
-
"""
|
|
146
|
-
Return an iterator over all project objects for which `predicate` returns `True`.
|
|
147
|
-
|
|
148
|
-
Args:
|
|
149
|
-
predicate: The `boolean` `Callable` to be invoked for each `dpo.DomProjectObject` in the collection.
|
|
150
|
-
|
|
151
|
-
Returns:
|
|
152
|
-
An iterator over all project objects fulfilling `predicate`.
|
|
153
|
-
"""
|
|
154
|
-
return toolz.filter(predicate, self._collection.values())
|
|
155
|
-
|
|
156
|
-
def find_by_display_name(self, display_name_to_find: str) -> Iterator[dpo.DomProjectObject]:
|
|
157
|
-
"""
|
|
158
|
-
Return an iterator over all project objects whose `display_name` is the `display_name_to_find`.
|
|
159
|
-
|
|
160
|
-
Args:
|
|
161
|
-
display_name_to_find: The display name for all project objects of interest.
|
|
162
|
-
|
|
163
|
-
Returns:
|
|
164
|
-
An iterator over all project objects with the specified `display_name` property.
|
|
165
|
-
"""
|
|
166
|
-
return self.find(lambda po: po.display_name == display_name_to_find.strip())
|
|
167
|
-
|
|
168
|
-
def find_by_name(self, name_to_find: str) -> Iterator[dpo.DomProjectObject]:
|
|
169
|
-
"""
|
|
170
|
-
Return an iterator over all project objects whose `name` is the `name_to_find`.
|
|
171
|
-
|
|
172
|
-
Args:
|
|
173
|
-
name_to_find: The name for all project objects of interest.
|
|
174
|
-
|
|
175
|
-
Returns:
|
|
176
|
-
An iterator over all project objects with the specified `name` property.
|
|
177
|
-
"""
|
|
178
|
-
return self.find(lambda po: po.name == name_to_find.strip())
|
|
179
|
-
|
|
180
|
-
def find_by_object_id(self, object_id_to_find: uuid.UUID) -> Optional[dpo.DomProjectObject]:
|
|
181
|
-
"""
|
|
182
|
-
Return the project object whose `object_id` is the `object_id_to_find` if available; otherwise, `None`.
|
|
183
|
-
|
|
184
|
-
Args:
|
|
185
|
-
object_id_to_find: The object ID for the project objects of interest.
|
|
186
|
-
|
|
187
|
-
Returns:
|
|
188
|
-
The project objects with the specified `name` property. If no such project is found, return `None`.
|
|
189
|
-
"""
|
|
190
|
-
return toolz.get(object_id_to_find, self._collection, default=None)
|
orchid/searchable_stage_parts.py
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# This file is part of Orchid and related technologies.
|
|
3
|
-
#
|
|
4
|
-
# Copyright (c) 2017-2025 KAPPA. All Rights Reserved.
|
|
5
|
-
#
|
|
6
|
-
# LEGAL NOTICE:
|
|
7
|
-
# Orchid contains trade secrets and otherwise confidential information
|
|
8
|
-
# owned by KAPPA. Access to and use of this information is
|
|
9
|
-
# strictly limited and controlled by the Company. This file may not be copied,
|
|
10
|
-
# distributed, or otherwise disclosed outside of the Company's facilities
|
|
11
|
-
# except under appropriate precautions to maintain the confidentiality hereof,
|
|
12
|
-
# and may not be used in any way not expressly authorized by the Company.
|
|
13
|
-
#
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
from typing import Iterable, Optional
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
from orchid import (
|
|
20
|
-
native_stage_part_adapter as spa,
|
|
21
|
-
searchable_project_objects as spo,
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class SearchableStageParts(spo.SearchableProjectObjects):
|
|
26
|
-
def find_by_part_number(self, to_find: int) -> Optional[spa.NativeStagePartAdapter]:
|
|
27
|
-
"""
|
|
28
|
-
Find a stage part with the specified part number.
|
|
29
|
-
|
|
30
|
-
Args:
|
|
31
|
-
to_find: The part number sought.
|
|
32
|
-
|
|
33
|
-
Returns:
|
|
34
|
-
The stage part with the specified part number.
|
|
35
|
-
|
|
36
|
-
If no such stage part is found, returns `None`. If multiple stage parts with the specified part number are
|
|
37
|
-
found, raises `spo.SearchableProjectMultipleMatchError`.
|
|
38
|
-
"""
|
|
39
|
-
candidates = list(self.find(lambda s: s.part_no == to_find))
|
|
40
|
-
if len(candidates) == 0:
|
|
41
|
-
return None
|
|
42
|
-
elif len(candidates) == 1:
|
|
43
|
-
return candidates[0]
|
|
44
|
-
else:
|
|
45
|
-
raise spo.SearchableProjectMultipleMatchError(to_find)
|
|
46
|
-
|
|
47
|
-
def find_by_display_name_with_well(self, to_find: str) -> Iterable[spa.NativeStagePartAdapter]:
|
|
48
|
-
"""
|
|
49
|
-
Find a stage part with the specified display name with well.
|
|
50
|
-
|
|
51
|
-
Args:
|
|
52
|
-
to_find: The display name with well sought.
|
|
53
|
-
|
|
54
|
-
Returns:
|
|
55
|
-
The matching stage part(s).
|
|
56
|
-
|
|
57
|
-
If no such stage part is in this collection, returns an empty iterator.
|
|
58
|
-
"""
|
|
59
|
-
return self.find(lambda s: s.display_name_with_well == to_find)
|
|
60
|
-
|
|
61
|
-
def find_by_display_name_without_well(self, to_find: str) -> Iterable[spa.NativeStagePartAdapter]:
|
|
62
|
-
"""
|
|
63
|
-
Find a stage part without the specified display name with well.
|
|
64
|
-
|
|
65
|
-
Args:
|
|
66
|
-
to_find: The display name without well sought.
|
|
67
|
-
|
|
68
|
-
Returns:
|
|
69
|
-
The matching stage part(s).
|
|
70
|
-
|
|
71
|
-
If no such stage part is in this collection, returns an empty iterator.
|
|
72
|
-
"""
|
|
73
|
-
return self.find(lambda s: s.display_name_without_well == to_find)
|
orchid/searchable_stages.py
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# This file is part of Orchid and related technologies.
|
|
3
|
-
#
|
|
4
|
-
# Copyright (c) 2017-2025 KAPPA. All Rights Reserved.
|
|
5
|
-
#
|
|
6
|
-
# LEGAL NOTICE:
|
|
7
|
-
# Orchid contains trade secrets and otherwise confidential information
|
|
8
|
-
# owned by KAPPA. Access to and use of this information is
|
|
9
|
-
# strictly limited and controlled by the Company. This file may not be copied,
|
|
10
|
-
# distributed, or otherwise disclosed outside of the Company's facilities
|
|
11
|
-
# except under appropriate precautions to maintain the confidentiality hereof,
|
|
12
|
-
# and may not be used in any way not expressly authorized by the Company.
|
|
13
|
-
#
|
|
14
|
-
|
|
15
|
-
from orchid import searchable_project_objects as spo
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class SearchableStages(spo.SearchableProjectObjects):
|
|
19
|
-
def find_by_display_stage_number(self, to_find: int):
|
|
20
|
-
candidates = list(self.find(lambda s: s.display_stage_number == to_find))
|
|
21
|
-
if len(candidates) == 0:
|
|
22
|
-
return None
|
|
23
|
-
elif len(candidates) == 1:
|
|
24
|
-
return candidates[0]
|
|
25
|
-
else:
|
|
26
|
-
raise spo.SearchableProjectMultipleMatchError(to_find)
|
|
27
|
-
|
|
28
|
-
def find_by_display_name_with_well(self, to_find: str):
|
|
29
|
-
return self.find(lambda s: s.display_name_with_well == to_find)
|
orchid/unit_system.py
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2017-2025 KAPPA. All Rights Reserved.
|
|
2
|
-
#
|
|
3
|
-
# This file is part of Orchid and related technologies.
|
|
4
|
-
#
|
|
5
|
-
# LEGAL NOTICE:
|
|
6
|
-
# Orchid contains trade secrets and otherwise confidential information
|
|
7
|
-
# owned by KAPPA. Access to and use of this information is
|
|
8
|
-
# strictly limited and controlled by the Company. This file may not be copied,
|
|
9
|
-
# distributed, or otherwise disclosed outside of the Company's facilities
|
|
10
|
-
# except under appropriate precautions to maintain the confidentiality hereof,
|
|
11
|
-
# and may not be used in any way not expressly authorized by the Company.
|
|
12
|
-
#
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
from abc import abstractmethod
|
|
16
|
-
from collections import namedtuple
|
|
17
|
-
from enum import Enum
|
|
18
|
-
import numbers
|
|
19
|
-
|
|
20
|
-
import toolz.curried as toolz
|
|
21
|
-
|
|
22
|
-
from orchid import (
|
|
23
|
-
measurement as om,
|
|
24
|
-
physical_quantity as opq,
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
# noinspection PyUnresolvedReferences
|
|
29
|
-
from Orchid.FractureDiagnostics import UnitSystem as NetUnitSystem
|
|
30
|
-
# noinspection PyUnresolvedReferences
|
|
31
|
-
import UnitsNet
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
# I use this private class to distinguish units that measure **different** physical quantities but use the
|
|
35
|
-
# same measurement unit. Currently, this applies to DENSITY and PRESSURE.
|
|
36
|
-
_AboutUnit = namedtuple('AboutUnit', ['unit', 'physical_quantity'])
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
class UnitSystem(Enum):
|
|
40
|
-
|
|
41
|
-
def __str__(self):
|
|
42
|
-
"""
|
|
43
|
-
Return a string representation of the member.
|
|
44
|
-
|
|
45
|
-
Returns:
|
|
46
|
-
The string representing the enumeration member.
|
|
47
|
-
"""
|
|
48
|
-
return f'{self.value.unit}'
|
|
49
|
-
|
|
50
|
-
def abbreviation(self):
|
|
51
|
-
"""
|
|
52
|
-
Return the abbreviation for a unit.
|
|
53
|
-
|
|
54
|
-
Returns:
|
|
55
|
-
The abbreviation of 'unit'.
|
|
56
|
-
"""
|
|
57
|
-
return f'{self.value.unit:~P}'
|
|
58
|
-
|
|
59
|
-
@abstractmethod
|
|
60
|
-
def system_name(self):
|
|
61
|
-
raise NotImplementedError()
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
class Common(UnitSystem):
|
|
65
|
-
"""The enumeration of units common to both U. S. oilfield and metric unit systems."""
|
|
66
|
-
|
|
67
|
-
ANGLE = _AboutUnit(om.registry.deg, opq.PhysicalQuantity.ANGLE)
|
|
68
|
-
DURATION = _AboutUnit(om.registry.min, opq.PhysicalQuantity.DURATION)
|
|
69
|
-
|
|
70
|
-
def system_name(self):
|
|
71
|
-
return 'Common'
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
class UsOilfield(UnitSystem):
|
|
75
|
-
"""The enumeration of U. S. oilfield units available via the Orchid Python API."""
|
|
76
|
-
|
|
77
|
-
DENSITY = _AboutUnit(om.registry.pound / om.registry.ft ** 3, opq.PhysicalQuantity.DENSITY)
|
|
78
|
-
ENERGY = _AboutUnit(om.registry.foot_pound, opq.PhysicalQuantity.ENERGY)
|
|
79
|
-
FORCE = _AboutUnit(om.registry.pound_force, opq.PhysicalQuantity.FORCE)
|
|
80
|
-
LENGTH = _AboutUnit(om.registry.foot, opq.PhysicalQuantity.LENGTH)
|
|
81
|
-
MASS = _AboutUnit(om.registry.pound, opq.PhysicalQuantity.MASS)
|
|
82
|
-
POWER = _AboutUnit(om.registry.horsepower, opq.PhysicalQuantity.POWER)
|
|
83
|
-
PRESSURE = _AboutUnit(om.registry.pound_force_per_square_inch, opq.PhysicalQuantity.PRESSURE)
|
|
84
|
-
PROPPANT_CONCENTRATION = _AboutUnit(om.registry.pound / om.registry.gallon,
|
|
85
|
-
opq.PhysicalQuantity.PROPPANT_CONCENTRATION)
|
|
86
|
-
SLURRY_RATE = _AboutUnit(om.registry.oil_barrel / om.registry.minute, opq.PhysicalQuantity.SLURRY_RATE)
|
|
87
|
-
TEMPERATURE = _AboutUnit(om.registry.degree_Fahrenheit, opq.PhysicalQuantity.TEMPERATURE)
|
|
88
|
-
VOLUME = _AboutUnit(om.registry.oil_barrel, opq.PhysicalQuantity.VOLUME)
|
|
89
|
-
|
|
90
|
-
def system_name(self):
|
|
91
|
-
return 'USOilfield'
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
class Metric(UnitSystem):
|
|
95
|
-
"""The enumeration of metric units available via the Orchid Python API."""
|
|
96
|
-
|
|
97
|
-
DENSITY = _AboutUnit(om.registry.kilogram / om.registry.meter ** 3, opq.PhysicalQuantity.DENSITY)
|
|
98
|
-
ENERGY = _AboutUnit(om.registry.joule, opq.PhysicalQuantity.ENERGY)
|
|
99
|
-
FORCE = _AboutUnit(om.registry.newton, opq.PhysicalQuantity.FORCE)
|
|
100
|
-
LENGTH = _AboutUnit(om.registry.meter, opq.PhysicalQuantity.LENGTH)
|
|
101
|
-
MASS = _AboutUnit(om.registry.kilogram, opq.PhysicalQuantity.MASS)
|
|
102
|
-
POWER = _AboutUnit(om.registry.watt, opq.PhysicalQuantity.POWER)
|
|
103
|
-
PRESSURE = _AboutUnit(om.registry.kilopascal, opq.PhysicalQuantity.PRESSURE)
|
|
104
|
-
PROPPANT_CONCENTRATION = _AboutUnit(om.registry.kilogram / om.registry.meter ** 3,
|
|
105
|
-
opq.PhysicalQuantity.PROPPANT_CONCENTRATION)
|
|
106
|
-
SLURRY_RATE = _AboutUnit(om.registry.meter ** 3 / om.registry.minute, opq.PhysicalQuantity.SLURRY_RATE)
|
|
107
|
-
TEMPERATURE = _AboutUnit(om.registry.degree_Celsius, opq.PhysicalQuantity.TEMPERATURE)
|
|
108
|
-
VOLUME = _AboutUnit((om.registry.m ** 3), opq.PhysicalQuantity.VOLUME)
|
|
109
|
-
|
|
110
|
-
def system_name(self):
|
|
111
|
-
return 'Metric'
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
def as_unit_system(net_unit_system: UnitSystem):
|
|
115
|
-
if net_unit_system == NetUnitSystem.USOilfield():
|
|
116
|
-
return UsOilfield
|
|
117
|
-
elif net_unit_system == NetUnitSystem.Metric():
|
|
118
|
-
return Metric
|
|
119
|
-
else:
|
|
120
|
-
raise ValueError(f'Unrecognized unit system: {net_unit_system}')
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
@toolz.curry
|
|
124
|
-
def make_measurement(unit: UnitSystem, magnitude: numbers.Real) -> om.Quantity:
|
|
125
|
-
"""
|
|
126
|
-
Construct a measurement.
|
|
127
|
-
|
|
128
|
-
This function provides a "functional" mechanism to create Measurement instances. It is more common to
|
|
129
|
-
create a sequence of measurements from a sequence of numbers and a **single** unit. By putting the `unit`
|
|
130
|
-
argument first in the function arguments, it allows callers to write code similar to the following:
|
|
131
|
-
|
|
132
|
-
> make_length_measurement = make_measurement(units.UsOilfield.LENGTH)
|
|
133
|
-
> length_measurements = [make_length_measurement(l) for l in lengths]
|
|
134
|
-
> # or toolz.map(make_length_measurement, lengths)
|
|
135
|
-
|
|
136
|
-
Args:
|
|
137
|
-
unit: The unit of this measurement.
|
|
138
|
-
magnitude: The magnitude of the measurement.
|
|
139
|
-
|
|
140
|
-
Returns:
|
|
141
|
-
The created `pint` `Quantity` instance.
|
|
142
|
-
"""
|
|
143
|
-
return om.Quantity(magnitude, unit.value.unit)
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
make_us_oilfield_length_measurement = make_measurement(UsOilfield.LENGTH)
|
|
147
|
-
make_us_oilfield_pressure_measurement = make_measurement(UsOilfield.PRESSURE)
|
|
148
|
-
|
|
149
|
-
make_metric_length_measurement = make_measurement(Metric.LENGTH)
|
|
150
|
-
make_metric_pressure_measurement = make_measurement(Metric.PRESSURE)
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
def is_length_unit(candidate) -> bool:
|
|
154
|
-
return candidate.check('[length]')
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
def is_pressure_unit(candidate) -> bool:
|
|
158
|
-
return candidate.check('[pressure]')
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
def abbreviation(unit: UnitSystem):
|
|
162
|
-
"""
|
|
163
|
-
Return the abbreviation of `unit`.
|
|
164
|
-
|
|
165
|
-
This function provides a functional interface for calculating abbreviations of `UnitSystem` members.
|
|
166
|
-
|
|
167
|
-
Args:
|
|
168
|
-
unit: The `UnitSystem` member whose abbreviation is sought.
|
|
169
|
-
|
|
170
|
-
Returns:
|
|
171
|
-
The abbreviation for `unit`.
|
|
172
|
-
"""
|
|
173
|
-
return unit.abbreviation()
|
orchid/utils.py
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
from datetime import datetime
|
|
2
|
-
|
|
3
|
-
FORMATS = [
|
|
4
|
-
'%d/%m/%Y %H:%M:%S', # e.g., 16/04/2019 23:45:10
|
|
5
|
-
'%m/%d/%Y %I:%M:%S %p', # e.g., 4/16/2019 12:02:51 AM
|
|
6
|
-
]
|
|
7
|
-
|
|
8
|
-
def convert_dotnet_datetime_to_python_datetime(csharp_datetime_str: str) -> datetime:
|
|
9
|
-
for fmt in FORMATS:
|
|
10
|
-
try:
|
|
11
|
-
return datetime.strptime(csharp_datetime_str, fmt)
|
|
12
|
-
except ValueError:
|
|
13
|
-
continue
|
|
14
|
-
raise ValueError(f"Unrecognized datetime format: '{csharp_datetime_str}'")
|
orchid/validation.py
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2017-2025 KAPPA
|
|
2
|
-
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
14
|
-
#
|
|
15
|
-
# This file is part of Orchid and related technologies.
|
|
16
|
-
#
|
|
17
|
-
|
|
18
|
-
"""This module contains common functions used to validate arguments."""
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
from orchid import (unit_system as units)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def arg_not_none(_, arg) -> bool:
|
|
25
|
-
"""
|
|
26
|
-
Tests if the single argument is not None
|
|
27
|
-
|
|
28
|
-
:param _: Ignored (typically mapped to `self` for bound methods)
|
|
29
|
-
:param arg: The argument to be tested
|
|
30
|
-
:return: True if arg is not None; otherwise, false.
|
|
31
|
-
"""
|
|
32
|
-
return arg is not None
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
def arg_neither_empty_nor_all_whitespace(_, arg: str) -> bool:
|
|
36
|
-
"""
|
|
37
|
-
Tests if the single argument is not None
|
|
38
|
-
|
|
39
|
-
:param _: Ignored (typically mapped to `self` for bound methods)
|
|
40
|
-
:param arg: The argument to be tested
|
|
41
|
-
:return: True if arg is neither an empty string nor a string consisting only of whitespace.
|
|
42
|
-
"""
|
|
43
|
-
return len(arg.strip()) > 0
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
def arg_is_acceptable_pressure_unit(_, target_unit):
|
|
47
|
-
return (target_unit == units.UsOilfield.PRESSURE) or (target_unit == units.Metric.PRESSURE)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
def is_unit_system_length(unit_to_test):
|
|
51
|
-
return unit_to_test == units.UsOilfield.LENGTH or unit_to_test == units.Metric.LENGTH
|
|
52
|
-
|
orchid/version.py
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2017-2025 KAPPA
|
|
2
|
-
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
14
|
-
#
|
|
15
|
-
# This file is part of Orchid and related technologies.
|
|
16
|
-
#
|
|
17
|
-
import re
|
|
18
|
-
import pathlib
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def get_orchid_sdk_version():
|
|
22
|
-
"""
|
|
23
|
-
Calculate the Python API version.
|
|
24
|
-
|
|
25
|
-
Returns:
|
|
26
|
-
The Python API version read from the `VERSION` file.
|
|
27
|
-
"""
|
|
28
|
-
try:
|
|
29
|
-
with pathlib.Path(__file__).parent.joinpath('VERSION').open() as version_file:
|
|
30
|
-
text_version = version_file.read()
|
|
31
|
-
version_match = re.search(r'\d+\.\d+\.\d+(?:\.\d+)?', text_version)
|
|
32
|
-
if version_match:
|
|
33
|
-
return version_match.group()
|
|
34
|
-
else:
|
|
35
|
-
raise ValueError("Cannot find a correct version number in VERSION file.")
|
|
36
|
-
except FileNotFoundError:
|
|
37
|
-
raise FileNotFoundError("Missing VERSION file")
|