corva-worker-python 2.3.2__py3-none-any.whl → 2.3.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: corva-worker-python
3
- Version: 2.3.2
3
+ Version: 2.3.3
4
4
  Summary: SDK for interacting with Corva
5
5
  Home-page: https://github.com/corva-ai/corva-worker-python
6
6
  Author: Jordan Ambra <jordan.ambra@corva.ai>, Mohammadreza Kamyab <m.kamyab@corva.ai>
@@ -43,7 +43,7 @@ worker/test/utils.py,sha256=Z7tgC_lUk2bRMlR-3tY9i5d836AdYlIY4i9WFFplheg,1479
43
43
  worker/test/local_testing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
44
  worker/test/local_testing/to_local_transfer.py,sha256=QYLGtT9fgDKsSK3x2QsaNDCMOpPZ5rpOsSnSl5s--WI,12343
45
45
  worker/wellbore/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
46
- worker/wellbore/factory.py,sha256=ph8wXwpinkSzbsRt6yTQTNntsgCPWc1hOLjXaXrxUsI,19674
46
+ worker/wellbore/factory.py,sha256=fpvwkTxRI3uASKFMxI76nR3iuYlW6_JdUAZ-3y7uTOY,20095
47
47
  worker/wellbore/measured_depth_finder.py,sha256=I5FmkELT0_k1ajlraeBx2Q-G3noqNTAw1wEPKyUAQOw,367
48
48
  worker/wellbore/sections_mixin.py,sha256=JNeEKm_fRxMBBD7SUx7LM8lRDJjKIeIcVvcSOKt4DTY,1873
49
49
  worker/wellbore/wellbore.py,sha256=syvYszkbN40BhzxCQ8m6VmSBGPp2wQR9sJ6TcSu7WO8,11907
@@ -57,7 +57,7 @@ worker/wellbore/model/enums.py,sha256=DZm-o9ZCM1hSRHw_CcOK4Oy2Q_bmpDM7Gx3GlKQ_bv
57
57
  worker/wellbore/model/hole.py,sha256=LYikxOMJfxhc2yoKZN12pDBIl6W8apJcAGtGR3ZuvhM,10046
58
58
  worker/wellbore/model/hole_section.py,sha256=4sfP19xiY--wV1Ve2MtRoNqpya-FdPhNNmTgxLb90uk,1630
59
59
  worker/wellbore/model/riser.py,sha256=ElxvQMfdFTGGpJ1Jba_DNVue3zGAsm-05zDl1HBXwDk,824
60
- corva_worker_python-2.3.2.dist-info/METADATA,sha256=hYQ67rnIsVp-GKhIXtKmQLDxnay10EAfGbqmqoZWIEU,1020
61
- corva_worker_python-2.3.2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
62
- corva_worker_python-2.3.2.dist-info/top_level.txt,sha256=KrP-SOC-I1V0U33nVzMgkHR8wO-reJYASIvWVyLyFIY,7
63
- corva_worker_python-2.3.2.dist-info/RECORD,,
60
+ corva_worker_python-2.3.3.dist-info/METADATA,sha256=1L6_hZTla6BsYxUwHLZXj98GyI2a_f9zX5OD2rH5cHg,1020
61
+ corva_worker_python-2.3.3.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
62
+ corva_worker_python-2.3.3.dist-info/top_level.txt,sha256=KrP-SOC-I1V0U33nVzMgkHR8wO-reJYASIvWVyLyFIY,7
63
+ corva_worker_python-2.3.3.dist-info/RECORD,,
@@ -191,7 +191,6 @@ def get_detailed_hole_from_elements(
191
191
  elements: List[dict],
192
192
  previous_element_top_depth: float,
193
193
  possible_top_depth: float,
194
- extend_casing_to_top: bool,
195
194
  is_riser: bool,
196
195
  ) -> Hole:
197
196
  """
@@ -200,18 +199,12 @@ def get_detailed_hole_from_elements(
200
199
  :param previous_element_top_depth: will be used as the bottom depth of current component
201
200
  :param possible_top_depth: possible top depth to which a casing/riser can extend.
202
201
  In case of a casing, it will extend to the btm of riser (if available)
203
- :param extend_casing_to_top: if the casing/riser should extend to the top
204
202
  :param is_riser: If its a riser or a cased hole
205
203
  :return: Hole with all the components as HoleSections
206
204
  """
207
205
  casing_hole: Hole = Hole()
208
206
 
209
- elements = [
210
- element
211
- for index, element in enumerate(elements)
212
- if check_casing_element_validity(element, index, extend_casing_to_top)
213
- ]
214
-
207
+ # Elements are expected to have been filtered with get_valid_casing_elements before this function is called.
215
208
  for element in reversed(elements):
216
209
  element_id = element.get("inner_diameter", 0.0)
217
210
  element_length = element.get("length", 0.0)
@@ -270,6 +263,14 @@ def check_casing_element_validity(casing_element: dict, idx: int, extend_casing_
270
263
  return True if element_family in ["casing_joints", "riser"] else False
271
264
 
272
265
 
266
+ def get_valid_casing_elements(elements: List[dict], extend_casing_to_top: bool) -> List[dict]:
267
+ return [
268
+ element
269
+ for element_index, element in enumerate(elements)
270
+ if check_casing_element_validity(element, element_index, extend_casing_to_top)
271
+ ]
272
+
273
+
273
274
  def set_casings(casings: List[dict]) -> Hole:
274
275
  """
275
276
  Set the casing by providing the list of the jsons
@@ -319,29 +320,34 @@ def set_casings(casings: List[dict]) -> Hole:
319
320
  casing_top = current_casing_top_depth
320
321
 
321
322
  casing_elements: List[dict] = casing_object.get("components", [])
322
- if not casing_elements:
323
+ extend_casing_to_top = index == 0
324
+ valid_casing_elements = get_valid_casing_elements(casing_elements, extend_casing_to_top)
325
+ if not valid_casing_elements:
323
326
  hole_section = HoleSection(**casing_object, hole_type=HoleType.CASED_HOLE)
324
327
  casing_hole.sections.append(hole_section)
325
328
  else:
326
329
  previous_casing_element_top_depth = casing_bottom
327
330
  # Individual casing elements have to be looped in reverse order to correctly account
328
331
  # for the topmost element going to surface is not liner
329
- extend_casing_to_top: bool = False
330
- if index == 0:
331
- extend_casing_to_top = True
332
332
  casing_hole = get_detailed_hole_from_elements(
333
- casing_elements, previous_casing_element_top_depth, casing_top, extend_casing_to_top, False
333
+ valid_casing_elements, previous_casing_element_top_depth, casing_top, False
334
334
  )
335
335
 
336
336
  casing_holes.append(casing_hole)
337
337
 
338
338
  # Now adding the components of the riser to casingHoles
339
339
  if riser:
340
- riser_elements: List[dict] = riser.get("data", {}).get("components", [])
340
+ riser_object = riser.get("data", {})
341
+ riser_elements: List[dict] = riser_object.get("components", [])
342
+ valid_riser_elements = get_valid_casing_elements(riser_elements, True)
341
343
  previous_riser_element_top_depth = possible_casing_top_depth
342
- riser_hole: Hole = get_detailed_hole_from_elements(
343
- riser_elements, previous_riser_element_top_depth, 0.0, True, True
344
- )
344
+ if valid_riser_elements:
345
+ riser_hole: Hole = get_detailed_hole_from_elements(
346
+ valid_riser_elements, previous_riser_element_top_depth, 0.0, True
347
+ )
348
+ else:
349
+ riser_hole = Hole()
350
+ riser_hole.sections.append(Riser(**riser_object, hole_type=HoleType.CASED_HOLE))
345
351
  casing_holes.insert(0, riser_hole)
346
352
 
347
353
  return Hole.merge_holes(casing_holes)