osducli 0.0.47__py3-none-any.whl → 0.0.49__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.
Files changed (142) hide show
  1. osducli/VERSION +1 -1
  2. osducli/commands/config/consts.py +1 -0
  3. osducli/commands/config/update.py +10 -0
  4. osducli/commands/storage/add.py +0 -2
  5. osducli/commands/wbdutil/__init__.py +13 -0
  6. osducli/commands/wbdutil/_const.py +16 -0
  7. osducli/commands/wbdutil/config_file.py +57 -0
  8. osducli/commands/wbdutil/download.py +40 -0
  9. osducli/commands/wbdutil/ingest/__init__.py +13 -0
  10. osducli/commands/wbdutil/ingest/data.py +39 -0
  11. osducli/commands/wbdutil/ingest/wellbore.py +39 -0
  12. osducli/commands/wbdutil/list/__init__.py +13 -0
  13. osducli/commands/wbdutil/list/curves.py +38 -0
  14. osducli/commands/wbdutil/list/wellbore.py +38 -0
  15. osducli/commands/wbdutil/list/welllog.py +38 -0
  16. osducli/commands/wbdutil/parse/__init__.py +13 -0
  17. osducli/commands/wbdutil/parse/convert.py +37 -0
  18. osducli/commands/wbdutil/parse/print.py +27 -0
  19. osducli/commands/wbdutil/search.py +36 -0
  20. osducli/commands/wbdutil/update.py +37 -0
  21. osducli/commands/wellbore_ddms/_const.py +9 -0
  22. osducli/commands/wellbore_ddms/log_recognition/__init__.py +13 -0
  23. osducli/commands/wellbore_ddms/log_recognition/family.py +37 -0
  24. osducli/commands/wellbore_ddms/log_recognition/upload_catalog.py +40 -0
  25. osducli/commands/wellbore_ddms/ppfgdataset/__init__.py +13 -0
  26. osducli/commands/wellbore_ddms/ppfgdataset/add.py +42 -0
  27. osducli/commands/wellbore_ddms/ppfgdataset/data/__init__.py +13 -0
  28. osducli/commands/wellbore_ddms/ppfgdataset/data/add.py +40 -0
  29. osducli/commands/wellbore_ddms/ppfgdataset/data/get.py +44 -0
  30. osducli/commands/wellbore_ddms/ppfgdataset/delete.py +35 -0
  31. osducli/commands/wellbore_ddms/ppfgdataset/get.py +35 -0
  32. osducli/commands/wellbore_ddms/ppfgdataset/session/__init__.py +13 -0
  33. osducli/commands/wellbore_ddms/ppfgdataset/session/create.py +35 -0
  34. osducli/commands/wellbore_ddms/ppfgdataset/session/get.py +36 -0
  35. osducli/commands/wellbore_ddms/ppfgdataset/session/list.py +35 -0
  36. osducli/commands/wellbore_ddms/ppfgdataset/session/send.py +41 -0
  37. osducli/commands/wellbore_ddms/ppfgdataset/session/update.py +37 -0
  38. osducli/commands/wellbore_ddms/ppfgdataset/version/__init__.py +13 -0
  39. osducli/commands/wellbore_ddms/ppfgdataset/version/data/__init__.py +13 -0
  40. osducli/commands/wellbore_ddms/ppfgdataset/version/data/get.py +45 -0
  41. osducli/commands/wellbore_ddms/ppfgdataset/version/get.py +36 -0
  42. osducli/commands/wellbore_ddms/ppfgdataset/version/list.py +35 -0
  43. osducli/commands/wellbore_ddms/trajectory/__init__.py +13 -0
  44. osducli/commands/wellbore_ddms/trajectory/add.py +42 -0
  45. osducli/commands/wellbore_ddms/trajectory/data/__init__.py +13 -0
  46. osducli/commands/wellbore_ddms/trajectory/data/add.py +40 -0
  47. osducli/commands/wellbore_ddms/trajectory/data/get.py +44 -0
  48. osducli/commands/wellbore_ddms/trajectory/delete.py +35 -0
  49. osducli/commands/wellbore_ddms/trajectory/get.py +35 -0
  50. osducli/commands/wellbore_ddms/trajectory/session/__init__.py +13 -0
  51. osducli/commands/wellbore_ddms/trajectory/session/create.py +35 -0
  52. osducli/commands/wellbore_ddms/trajectory/session/get.py +36 -0
  53. osducli/commands/wellbore_ddms/trajectory/session/list.py +35 -0
  54. osducli/commands/wellbore_ddms/trajectory/session/send.py +41 -0
  55. osducli/commands/wellbore_ddms/trajectory/session/update.py +37 -0
  56. osducli/commands/wellbore_ddms/trajectory/version/__init__.py +13 -0
  57. osducli/commands/wellbore_ddms/trajectory/version/data/__init__.py +13 -0
  58. osducli/commands/wellbore_ddms/trajectory/version/data/get.py +45 -0
  59. osducli/commands/wellbore_ddms/trajectory/version/get.py +36 -0
  60. osducli/commands/wellbore_ddms/trajectory/version/list.py +35 -0
  61. osducli/commands/wellbore_ddms/well/__init__.py +13 -0
  62. osducli/commands/wellbore_ddms/well/add.py +42 -0
  63. osducli/commands/wellbore_ddms/well/delete.py +35 -0
  64. osducli/commands/wellbore_ddms/well/get.py +35 -0
  65. osducli/commands/wellbore_ddms/well/version/__init__.py +13 -0
  66. osducli/commands/wellbore_ddms/well/version/get.py +36 -0
  67. osducli/commands/wellbore_ddms/well/version/list.py +35 -0
  68. osducli/commands/wellbore_ddms/well_log/add.py +4 -4
  69. osducli/commands/wellbore_ddms/well_log/data/__init__.py +1 -1
  70. osducli/commands/wellbore_ddms/well_log/data/add.py +5 -5
  71. osducli/commands/wellbore_ddms/well_log/data/get.py +5 -5
  72. osducli/commands/wellbore_ddms/well_log/data/statistics.py +36 -0
  73. osducli/commands/wellbore_ddms/well_log/delete.py +35 -0
  74. osducli/commands/wellbore_ddms/well_log/get.py +5 -5
  75. osducli/commands/wellbore_ddms/well_log/session/__init__.py +13 -0
  76. osducli/commands/wellbore_ddms/well_log/session/create.py +35 -0
  77. osducli/commands/wellbore_ddms/well_log/session/get.py +36 -0
  78. osducli/commands/wellbore_ddms/well_log/session/list.py +35 -0
  79. osducli/commands/wellbore_ddms/well_log/session/send.py +41 -0
  80. osducli/commands/wellbore_ddms/well_log/session/update.py +37 -0
  81. osducli/commands/wellbore_ddms/well_log/version/__init__.py +13 -0
  82. osducli/commands/wellbore_ddms/well_log/version/data/__init__.py +13 -0
  83. osducli/commands/wellbore_ddms/well_log/version/data/get.py +45 -0
  84. osducli/commands/wellbore_ddms/well_log/version/data/statistics.py +37 -0
  85. osducli/commands/wellbore_ddms/well_log/version/data/update_stats.py +36 -0
  86. osducli/commands/wellbore_ddms/well_log/version/get.py +36 -0
  87. osducli/commands/wellbore_ddms/well_log/version/list.py +35 -0
  88. osducli/commands/wellbore_ddms/wellbore/__init__.py +13 -0
  89. osducli/commands/wellbore_ddms/wellbore/add.py +42 -0
  90. osducli/commands/wellbore_ddms/wellbore/delete.py +35 -0
  91. osducli/commands/wellbore_ddms/wellbore/get.py +35 -0
  92. osducli/commands/wellbore_ddms/wellbore/version/__init__.py +13 -0
  93. osducli/commands/wellbore_ddms/wellbore/version/get.py +36 -0
  94. osducli/commands/wellbore_ddms/wellbore/version/list.py +35 -0
  95. osducli/commands/wellbore_ddms/wellbore_intervalset/__init__.py +13 -0
  96. osducli/commands/wellbore_ddms/wellbore_intervalset/add.py +44 -0
  97. osducli/commands/wellbore_ddms/wellbore_intervalset/delete.py +37 -0
  98. osducli/commands/wellbore_ddms/wellbore_intervalset/get.py +37 -0
  99. osducli/commands/wellbore_ddms/wellbore_intervalset/version/__init__.py +13 -0
  100. osducli/commands/wellbore_ddms/wellbore_intervalset/version/get.py +38 -0
  101. osducli/commands/wellbore_ddms/wellbore_intervalset/version/list.py +37 -0
  102. osducli/commands/wellbore_ddms/wellbore_markerset/__init__.py +13 -0
  103. osducli/commands/wellbore_ddms/wellbore_markerset/add.py +42 -0
  104. osducli/commands/wellbore_ddms/wellbore_markerset/delete.py +35 -0
  105. osducli/commands/wellbore_ddms/wellbore_markerset/get.py +35 -0
  106. osducli/commands/wellbore_ddms/wellbore_markerset/version/__init__.py +13 -0
  107. osducli/commands/wellbore_ddms/wellbore_markerset/version/get.py +36 -0
  108. osducli/commands/wellbore_ddms/wellbore_markerset/version/list.py +35 -0
  109. osducli/commands/wellbore_ddms/welllog_acquisition/__init__.py +13 -0
  110. osducli/commands/wellbore_ddms/welllog_acquisition/add.py +42 -0
  111. osducli/commands/wellbore_ddms/welllog_acquisition/delete.py +35 -0
  112. osducli/commands/wellbore_ddms/welllog_acquisition/get.py +35 -0
  113. osducli/commands/wellbore_ddms/welllog_acquisition/version/__init__.py +13 -0
  114. osducli/commands/wellbore_ddms/welllog_acquisition/version/get.py +36 -0
  115. osducli/commands/wellbore_ddms/welllog_acquisition/version/list.py +35 -0
  116. osducli/commands/wellbore_ddms/wellpressure_test_raw_measurement/__init__.py +13 -0
  117. osducli/commands/wellbore_ddms/wellpressure_test_raw_measurement/add.py +44 -0
  118. osducli/commands/wellbore_ddms/wellpressure_test_raw_measurement/data/__init__.py +13 -0
  119. osducli/commands/wellbore_ddms/wellpressure_test_raw_measurement/data/add.py +42 -0
  120. osducli/commands/wellbore_ddms/wellpressure_test_raw_measurement/data/get.py +46 -0
  121. osducli/commands/wellbore_ddms/wellpressure_test_raw_measurement/delete.py +37 -0
  122. osducli/commands/wellbore_ddms/wellpressure_test_raw_measurement/get.py +37 -0
  123. osducli/commands/wellbore_ddms/wellpressure_test_raw_measurement/session/__init__.py +13 -0
  124. osducli/commands/wellbore_ddms/wellpressure_test_raw_measurement/session/create.py +37 -0
  125. osducli/commands/wellbore_ddms/wellpressure_test_raw_measurement/session/get.py +38 -0
  126. osducli/commands/wellbore_ddms/wellpressure_test_raw_measurement/session/list.py +37 -0
  127. osducli/commands/wellbore_ddms/wellpressure_test_raw_measurement/session/send.py +43 -0
  128. osducli/commands/wellbore_ddms/wellpressure_test_raw_measurement/session/update.py +39 -0
  129. osducli/commands/wellbore_ddms/wellpressure_test_raw_measurement/version/__init__.py +13 -0
  130. osducli/commands/wellbore_ddms/wellpressure_test_raw_measurement/version/data/__init__.py +13 -0
  131. osducli/commands/wellbore_ddms/wellpressure_test_raw_measurement/version/data/get.py +47 -0
  132. osducli/commands/wellbore_ddms/wellpressure_test_raw_measurement/version/get.py +38 -0
  133. osducli/commands/wellbore_ddms/wellpressure_test_raw_measurement/version/list.py +37 -0
  134. osducli/config.py +1 -0
  135. osducli/wbddms_client.py +160 -27
  136. {osducli-0.0.47.dist-info → osducli-0.0.49.dist-info}/METADATA +15 -8
  137. osducli-0.0.49.dist-info/RECORD +242 -0
  138. osducli-0.0.47.dist-info/RECORD +0 -119
  139. {osducli-0.0.47.dist-info → osducli-0.0.49.dist-info}/WHEEL +0 -0
  140. {osducli-0.0.47.dist-info → osducli-0.0.49.dist-info}/entry_points.txt +0 -0
  141. {osducli-0.0.47.dist-info → osducli-0.0.49.dist-info}/licenses/LICENSE.md +0 -0
  142. {osducli-0.0.47.dist-info → osducli-0.0.49.dist-info}/top_level.txt +0 -0
osducli/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.47
1
+ 0.0.49
@@ -50,6 +50,7 @@ MSG_PROMPT_WORKFLOW_URL = "\nWorkflow API path []: "
50
50
 
51
51
  MSG_PROMPT_DATA_PARTITION = "\nData partition name []: "
52
52
  MSG_PROMPT_LEGAL_TAG = "\nManifest legal tag []: "
53
+ MSG_PROMPT_OTHER_RELEVANT_DATA_COUNTRIES = "\nOther relevant data countries []: "
53
54
  MSG_PROMPT_ACL_VIEWER = "\nacl viewer []: "
54
55
  MSG_PROMPT_ACL_OWNER = "\nacl owner []: "
55
56
 
@@ -37,6 +37,7 @@ from osducli.commands.config.consts import (
37
37
  MSG_PROMPT_LEGAL_TAG,
38
38
  MSG_PROMPT_LEGAL_URL,
39
39
  MSG_PROMPT_MANAGE_GLOBAL,
40
+ MSG_PROMPT_OTHER_RELEVANT_DATA_COUNTRIES,
40
41
  MSG_PROMPT_REFRESH_TOKEN,
41
42
  MSG_PROMPT_SCHEMA_URL,
42
43
  MSG_PROMPT_SCOPES,
@@ -64,6 +65,7 @@ from osducli.config import (
64
65
  CONFIG_FILE_URL,
65
66
  CONFIG_LEGAL_TAG,
66
67
  CONFIG_LEGAL_URL,
68
+ CONFIG_OTHER_RELEVANT_DATA_COUNTRIES,
67
69
  CONFIG_REFRESH_TOKEN,
68
70
  CONFIG_SCHEMA_URL,
69
71
  CONFIG_SEARCH_URL,
@@ -277,6 +279,12 @@ def _configure_connection(config): # noqa C901
277
279
  CONFIG_LEGAL_TAG,
278
280
  fallback="opendes-public-usa-dataset-7643990",
279
281
  )
282
+ other_relevant_data_countries = _prompt_default_from_config(
283
+ MSG_PROMPT_OTHER_RELEVANT_DATA_COUNTRIES,
284
+ config,
285
+ CONFIG_OTHER_RELEVANT_DATA_COUNTRIES,
286
+ fallback="US",
287
+ )
280
288
  acl_viewer = _prompt_default_from_config(
281
289
  MSG_PROMPT_ACL_VIEWER,
282
290
  config,
@@ -320,6 +328,8 @@ def _configure_connection(config): # noqa C901
320
328
  config.set_value("core", CONFIG_DATA_PARTITION_ID, data_partition_id)
321
329
  if legal_tag != "":
322
330
  config.set_value("core", CONFIG_LEGAL_TAG, legal_tag)
331
+ if other_relevant_data_countries != "":
332
+ config.set_value("core", CONFIG_OTHER_RELEVANT_DATA_COUNTRIES, other_relevant_data_countries)
323
333
  if acl_viewer != "":
324
334
  config.set_value("core", CONFIG_ACL_VIEWER, acl_viewer)
325
335
  if acl_owner != "":
@@ -38,8 +38,6 @@ logger = get_logger(__name__)
38
38
  "-b",
39
39
  "--batch",
40
40
  help="Number of records to add per API call. If not specified records are uploaded as is.",
41
- is_flag=False,
42
- flag_value=200,
43
41
  type=int,
44
42
  default=None,
45
43
  show_default=True,
@@ -0,0 +1,13 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ """Wellbore DDMS Data Loader commands"""
@@ -0,0 +1,16 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ """Wellbore DDMS Data Loader constants"""
14
+
15
+ WBDUTIL_SERVICE_NAME = "Wellbore DDMS Data Loader"
16
+ WBDUTIL_DOCUMENTATION = "https://community.opengroup.org/osdu/ui/data-loading/wellbore-ddms-data-loader" # noqa: E501
@@ -0,0 +1,57 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+ import json
13
+ import os
14
+ import tempfile
15
+
16
+ from osducli.config import CLIConfig
17
+
18
+
19
+ def get_config_path(config: CLIConfig,
20
+ wellbore_mapping_file: str = None,
21
+ welllog_mapping_file: str = None,
22
+ las_mapping_file: str = None) -> str:
23
+ """
24
+ Takes a config object and writes a mapped config to a temporary JSON file.
25
+ Returns the path to the temp file.
26
+ """
27
+ output = {
28
+ "base_url": config.get('core', 'server'),
29
+ "data_partition_id": config.get('core', 'data_partition_id'),
30
+ "legal": {
31
+ "legaltags": [config.get('core', 'legal_tag')],
32
+ "otherRelevantDataCountries": [config.get('core', 'other_relevant_data_countries')],
33
+ "status": "compliant"
34
+ },
35
+ "data": {
36
+ "default": {
37
+ "viewers": [config.get('core', 'acl_viewer')],
38
+ "owners": [config.get('core', 'acl_owner')]
39
+ }
40
+ },
41
+ "wellbore_mapping": { get_mapping(wellbore_mapping_file) },
42
+ "welllog_mapping": { get_mapping(welllog_mapping_file) },
43
+ "las_file_mapping": { get_mapping(las_mapping_file) }
44
+ }
45
+ with tempfile.NamedTemporaryFile('w', delete=False, suffix='.json') as tmp:
46
+ json.dump(output, tmp, indent=4)
47
+ return tmp.name
48
+
49
+
50
+ def get_mapping(mapping_file: str | None) -> dict:
51
+ if mapping_file:
52
+ if os.path.isfile(mapping_file):
53
+ with open(mapping_file) as f:
54
+ return json.load(f)
55
+ else:
56
+ raise FileNotFoundError(f"Mapping file {mapping_file} not found")
57
+ return {}
@@ -0,0 +1,40 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+ """Retrieve WellLog data from an OSDU instance and save to a LAS format file"""
13
+ import os
14
+
15
+ import click
16
+ from wbdutil.commands.download import download_las
17
+
18
+ from osducli.click_cli import CustomClickCommand, State, command_with_output
19
+ from osducli.cliclient import CliOsduClient, handle_cli_exceptions
20
+ from osducli.commands.wbdutil.config_file import get_config_path
21
+
22
+
23
+ # click entry point
24
+ @click.command(cls=CustomClickCommand, help="Download WellLog data to LAS file")
25
+ @click.option("-id", "--id", "_id", help="WellLog id to retrieve", required=True)
26
+ @click.option("-out", "--out", "_file", help="The output file path", required=True)
27
+ @click.option("-cu", "--curves", "_curves", help="List of curves to retrieve, or none to get all curves", required=False)
28
+ @click.option("-m", "--mapping", "_map", help="File with custom LAS mapping", required=False)
29
+ @handle_cli_exceptions
30
+ @command_with_output(None)
31
+ def _click_command(state: State, _id: str, _file: str, _curves: list[str], _map: str = None):
32
+ client = CliOsduClient(state.config)
33
+ client.token_refresher.authorize()
34
+ token = client.token_refresher.access_token
35
+ config_path = get_config_path(state.config, las_mapping_file=_map)
36
+ try:
37
+ download_las(_id, _file, token, config_path, _curves)
38
+ finally:
39
+ os.remove(config_path)
40
+
@@ -0,0 +1,13 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ """Wellbore DDMS Data Loader ingest commands"""
@@ -0,0 +1,39 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+ """Write data from a LAS file to an existing WellLog"""
13
+ import os
14
+
15
+ import click
16
+ from wbdutil.commands.ingest import welllog_data
17
+
18
+ from osducli.click_cli import CustomClickCommand, State, command_with_output
19
+ from osducli.cliclient import CliOsduClient, handle_cli_exceptions
20
+ from osducli.commands.wbdutil.config_file import get_config_path
21
+
22
+
23
+ # click entry point
24
+ @click.command(cls=CustomClickCommand, help="Write data from a LAS file to an existing WellLog")
25
+ @click.option("-id", "--id", "_id", help="WellLog id to update", required=True)
26
+ @click.option("-p", "--path", "_path", help=" Path to a file or folder containing one or more LAS file(s)", required=True)
27
+ @click.option("-bm", "--wellbore_mapping", "_bmap", help="File with custom wellbore mapping", required=False)
28
+ @click.option("-lm", "--welllog_mapping", "_lmap", help="File with custom wellLog mapping", required=False)
29
+ @handle_cli_exceptions
30
+ @command_with_output(None)
31
+ def _click_command(state: State, _id: str, _path: str, _bmap: str = None, _lmap: str = None):
32
+ client = CliOsduClient(state.config)
33
+ client.token_refresher.authorize()
34
+ token = client.token_refresher.access_token
35
+ config_path = get_config_path(state.config, wellbore_mapping_file=_bmap, welllog_mapping_file=_lmap)
36
+ try:
37
+ welllog_data(_id, _path, token, config_path)
38
+ finally:
39
+ os.remove(config_path)
@@ -0,0 +1,39 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+ """Ingest a LAS file (single) or directory of LAS files (bulk) into OSDU"""
13
+ import os
14
+
15
+ import click
16
+ from wbdutil.commands.ingest import wellbore
17
+
18
+ from osducli.click_cli import CustomClickCommand, State, command_with_output
19
+ from osducli.cliclient import CliOsduClient, handle_cli_exceptions
20
+ from osducli.commands.wbdutil.config_file import get_config_path
21
+
22
+
23
+ # click entry point
24
+ @click.command(cls=CustomClickCommand, help="Ingest LAS file(s) into OSDU")
25
+ @click.option("-p", "--path", "_path", help="Path and filename of a LAS file OR path to directory containing LAS and config files", required=True)
26
+ @click.option("--norecognize", "_no_recognize", help="If specified the application won't attempt to recognize the curve families.", is_flag=True, required=False)
27
+ @click.option("-bm", "--wellbore_mapping", "_bmap", help="File with custom wellbore mapping", required=False)
28
+ @click.option("-lm", "--welllog_mapping", "_lmap", help="File with custom wellLog mapping", required=False)
29
+ @handle_cli_exceptions
30
+ @command_with_output(None)
31
+ def _click_command(state: State, _path: str, _no_recognize: bool = False, _bmap: str = None, _lmap: str = None):
32
+ client = CliOsduClient(state.config)
33
+ client.token_refresher.authorize()
34
+ token = client.token_refresher.access_token
35
+ config_path = get_config_path(state.config, wellbore_mapping_file=_bmap, welllog_mapping_file=_lmap)
36
+ try:
37
+ wellbore(_path, token, config_path, _no_recognize)
38
+ finally:
39
+ os.remove(config_path)
@@ -0,0 +1,13 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ """Wellbore DDMS Data Loader list commands"""
@@ -0,0 +1,38 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+ """ Retrieve and print WellLog record from an OSDU instance"""
13
+
14
+ import os
15
+
16
+ import click
17
+ from wbdutil.commands.list_osdu import welllog_data
18
+
19
+ from osducli.click_cli import CustomClickCommand, State, command_with_output
20
+ from osducli.cliclient import CliOsduClient, handle_cli_exceptions
21
+ from osducli.commands.wbdutil.config_file import get_config_path
22
+
23
+
24
+ # click entry point
25
+ @click.command(cls=CustomClickCommand, help="Retrieve and print WellLog curve data")
26
+ @click.option("-id", "--id", "_id", help="WellLog id to retrieve", required=True)
27
+ @click.option("-cu", "--curves", "_curves", help="List of curves to retrieve, or none to get all curves", required=False)
28
+ @handle_cli_exceptions
29
+ @command_with_output(None)
30
+ def _click_command(state: State, _id: str, _curves: list[str]):
31
+ client = CliOsduClient(state.config)
32
+ client.token_refresher.authorize()
33
+ token = client.token_refresher.access_token
34
+ config_path = get_config_path(state.config)
35
+ try:
36
+ return welllog_data(_id, token, config_path, _curves)
37
+ finally:
38
+ os.remove(config_path)
@@ -0,0 +1,38 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+ """ Retrieve and print WellLog record from an OSDU instance"""
13
+
14
+ import os
15
+
16
+ import click
17
+ from wbdutil.commands.list_osdu import welllog
18
+
19
+ from osducli.click_cli import CustomClickCommand, State, command_with_output
20
+ from osducli.cliclient import CliOsduClient, handle_cli_exceptions
21
+ from osducli.commands.wbdutil.config_file import get_config_path
22
+
23
+
24
+ # click entry point
25
+ @click.command(cls=CustomClickCommand, help="Retrieve and print Wellbore record")
26
+ @click.option("-id", "--id", "_id", help="Wellbore id to retrieve", required=True)
27
+ @click.option("--curveids", "_curveids", help="Show only the curve ids", is_flag=True, required=False)
28
+ @handle_cli_exceptions
29
+ @command_with_output(None)
30
+ def _click_command(state: State, _id: str, _curveids: bool = False):
31
+ client = CliOsduClient(state.config)
32
+ client.token_refresher.authorize()
33
+ token = client.token_refresher.access_token
34
+ config_path = get_config_path(state.config)
35
+ try:
36
+ return welllog(_id, token, config_path, _curveids)
37
+ finally:
38
+ os.remove(config_path)
@@ -0,0 +1,38 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+ """ Retrieve and print WellLog record from an OSDU instance"""
13
+
14
+ import os
15
+
16
+ import click
17
+ from wbdutil.commands.list_osdu import welllog
18
+
19
+ from osducli.click_cli import CustomClickCommand, State, command_with_output
20
+ from osducli.cliclient import CliOsduClient, handle_cli_exceptions
21
+ from osducli.commands.wbdutil.config_file import get_config_path
22
+
23
+
24
+ # click entry point
25
+ @click.command(cls=CustomClickCommand, help="Retrieve and print WellLog record")
26
+ @click.option("-id", "--id", "_id", help="WellLog id to retrieve", required=True)
27
+ @click.option("--curveids", "_curveids", help="Show only the curve ids", is_flag=True, required=False)
28
+ @handle_cli_exceptions
29
+ @command_with_output(None)
30
+ def _click_command(state: State, _id: str, _curveids: bool = False):
31
+ client = CliOsduClient(state.config)
32
+ client.token_refresher.authorize()
33
+ token = client.token_refresher.access_token
34
+ config_path = get_config_path(state.config)
35
+ try:
36
+ return welllog(_id, token, config_path, _curveids)
37
+ finally:
38
+ os.remove(config_path)
@@ -0,0 +1,13 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ """Wellbore DDMS Data Loader parse commands"""
@@ -0,0 +1,37 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+ """Convert a LAS file to Wellbore and Well Log and write to JSON files"""
13
+
14
+ import os
15
+
16
+ import click
17
+ from wbdutil.commands.parse import convert
18
+
19
+ from osducli.click_cli import CustomClickCommand, State, command_with_output
20
+ from osducli.cliclient import handle_cli_exceptions
21
+ from osducli.commands.wbdutil.config_file import get_config_path
22
+
23
+
24
+ # click entry point
25
+ @click.command(cls=CustomClickCommand, help="Convert a LAS file to Wellbore and WellLog and write to JSON files")
26
+ @click.option("-id", "--id", "_id", help="Record id to retrieve", required=True)
27
+ @click.option("-i", "--input", "_file", help="Path to a file or folder containing one or more LAS file(s)", required=True)
28
+ @click.option("-bm", "--wellbore_mapping", "_bmap", help="File with custom wellbore mapping", required=False)
29
+ @click.option("-lm", "--welllog_mapping", "_lmap", help="File with custom wellLog mapping", required=False)
30
+ @handle_cli_exceptions
31
+ @command_with_output(None)
32
+ def _click_command(state: State, _id: str, _file: str, _bmap: str = None, _lmap: str = None):
33
+ config_path = get_config_path(state.config, wellbore_mapping_file=_bmap, welllog_mapping_file=_lmap)
34
+ try:
35
+ return convert(_file, _id, config_path)
36
+ finally:
37
+ os.remove(config_path)
@@ -0,0 +1,27 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+ """Print a LAS file header"""
13
+
14
+ import click
15
+ from wbdutil.commands.parse import printlas
16
+
17
+ from osducli.click_cli import CustomClickCommand, State, command_with_output
18
+ from osducli.cliclient import handle_cli_exceptions
19
+
20
+
21
+ # click entry point
22
+ @click.command(cls=CustomClickCommand, help="Print a LAS file header")
23
+ @click.option("-i", "--input", "_file", help="Path and filename of a LAS file, or folder containing LAS files", required=True)
24
+ @handle_cli_exceptions
25
+ @command_with_output(None)
26
+ def _click_command(state: State, _file: str):
27
+ return printlas(_file)
@@ -0,0 +1,36 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+ """Retrieve and print the ids of wellbores that match the specified name"""
13
+ import os
14
+
15
+ import click
16
+ from wbdutil.commands.search import wellbore_search
17
+
18
+ from osducli.click_cli import CustomClickCommand, State, command_with_output
19
+ from osducli.cliclient import CliOsduClient, handle_cli_exceptions
20
+ from osducli.commands.wbdutil.config_file import get_config_path
21
+
22
+
23
+ # click entry point
24
+ @click.command(cls=CustomClickCommand, help="Retrieve and print the ids of wellbores that match the specified name")
25
+ @click.option("-n", "--name", "_name", help="The wellbore name to search for", required=True)
26
+ @handle_cli_exceptions
27
+ @command_with_output(None)
28
+ def _click_command(state: State, _name: str):
29
+ client = CliOsduClient(state.config)
30
+ client.token_refresher.authorize()
31
+ token = client.token_refresher.access_token
32
+ config_path = get_config_path(state.config)
33
+ try:
34
+ return wellbore_search(_name, token, config_path)
35
+ finally:
36
+ os.remove(config_path)
@@ -0,0 +1,37 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+ """Update an existing WellLog record"""
13
+ import os
14
+
15
+ import click
16
+ from wbdutil.commands.update import welllog
17
+
18
+ from osducli.click_cli import CustomClickCommand, State, command_with_output
19
+ from osducli.cliclient import CliOsduClient, handle_cli_exceptions
20
+ from osducli.commands.wbdutil.config_file import get_config_path
21
+
22
+
23
+ # click entry point
24
+ @click.command(cls=CustomClickCommand, help="Update an existing WellLog record")
25
+ @click.option("-id", "--id", "_id", help="Record id to update", required=True)
26
+ @click.option("--curvefam", "_curvefam", help="If true, recognize and update the curve families", is_flag=True, required=False)
27
+ @handle_cli_exceptions
28
+ @command_with_output(None)
29
+ def _click_command(state: State, _id: str, _curvefam: bool = False):
30
+ client = CliOsduClient(state.config)
31
+ client.token_refresher.authorize()
32
+ token = client.token_refresher.access_token
33
+ config_path = get_config_path(state.config)
34
+ try:
35
+ return welllog(_id, token, config_path, _curvefam)
36
+ finally:
37
+ os.remove(config_path)
@@ -17,3 +17,12 @@ WELLBORE_DDMS_STATUS_PATH = "/about"
17
17
  WELLBORE_DDMS_SWAGGER_PATH = "https://community.opengroup.org/osdu/platform/domain-data-mgmt-services/wellbore/wellbore-domain-services/-/blob/master/spec/generated/openapi.json" # noqa: E501
18
18
  WELLBORE_DDMS_DOCUMENTATION = "https://community.opengroup.org/osdu/platform/domain-data-mgmt-services/wellbore/wellbore-domain-services/-/tree/master" # noqa: E501
19
19
  WELLBORE_DDMS_WELL_LOG_PATH = "/ddms/v3/welllogs"
20
+ WELLBORE_DDMS_PPFGDATASET_PATH = "/ddms/v3/ppfgdataset"
21
+ WELLBORE_DDMS_WELLBORE_INTERVAL_SET_PATH = "/ddms/v3/wellboreintervallsets"
22
+ WELLBORE_DDMS_WELLBORE_MARKER_SET_PATH = "/ddms/v3/wellboremarkersets"
23
+ WELLBORE_DDMS_WELLBORE_PATH = "/ddms/v3/wellbores"
24
+ WELLBORE_DDMS_TRAJECTORY_PATH = "/ddms/v3/wellboretrajectories"
25
+ WELLBORE_DDMS_WELLLOG_ACQUISITION_PATH = "/ddms/v3/welllogacquisition"
26
+ WELLBORE_DDMS_WELLPRESSURE_TEST_RAW_MEASUREMENT_PATH = "/ddms/v3/wellpressuretestrawmeasurement"
27
+ WELLBORE_DDMS_WELL_PATH = "/ddms/v3/wells"
28
+ WELLBORE_DDMS_LOG_RECOGNITION_PATH = "/log-recognition"
@@ -0,0 +1,13 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ """Wellbore DDMS Log recognition commands"""
@@ -0,0 +1,37 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+ """Find the most probable family and unit using family assignment rule based catalogs.
13
+ User defined catalog will have the priority."""
14
+
15
+ import click
16
+
17
+ from osducli.click_cli import CustomClickCommand, State, command_with_output
18
+ from osducli.cliclient import CliOsduClient, handle_cli_exceptions
19
+ from osducli.commands.wellbore_ddms._const import WELLBORE_DDMS_LOG_RECOGNITION_PATH
20
+
21
+
22
+ # click entry point
23
+ @click.command(cls=CustomClickCommand, help="Find the most probable family and unit using family assignment rule based catalogs.")
24
+ @click.option("-d", "--data", "_data", help="Lookup data", required=True)
25
+ @handle_cli_exceptions
26
+ @command_with_output()
27
+ def _click_command(state: State, _data: str):
28
+ return get_family(state, _data)
29
+
30
+
31
+ def get_family(state: State, data: str):
32
+ """Find the most probable family and unit using family assignment rule based catalogs."""
33
+ client = CliOsduClient(state.config)
34
+ wellbore_client = client.get_wellbore_ddms_client(url_extra_path=WELLBORE_DDMS_LOG_RECOGNITION_PATH)
35
+ response = wellbore_client.get_log_recognition_family(data)
36
+ client.check_status_code(response)
37
+ return response.json()