quick-pp 0.2.67__tar.gz → 0.2.68__tar.gz

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 (79) hide show
  1. {quick_pp-0.2.67 → quick_pp-0.2.68}/PKG-INFO +1 -1
  2. {quick_pp-0.2.67 → quick_pp-0.2.68}/pyproject.toml +1 -1
  3. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/__init__.py +1 -1
  4. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/database/db_connector.py +2 -2
  5. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/database/objects.py +8 -7
  6. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/las_handler.py +134 -42
  7. {quick_pp-0.2.67 → quick_pp-0.2.68}/.gitignore +0 -0
  8. {quick_pp-0.2.67 → quick_pp-0.2.68}/LICENSE +0 -0
  9. {quick_pp-0.2.67 → quick_pp-0.2.68}/README.md +0 -0
  10. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/__init__.py +0 -0
  11. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/exceptions.py +0 -0
  12. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/fastapi_mlflow/__init__.py +0 -0
  13. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/fastapi_mlflow/_mlflow_types.py +0 -0
  14. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/fastapi_mlflow/applications.py +0 -0
  15. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/fastapi_mlflow/exceptions.py +0 -0
  16. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/fastapi_mlflow/predictors.py +0 -0
  17. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/main.py +0 -0
  18. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/mlflow_model_deployment.py +0 -0
  19. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/router.py +0 -0
  20. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/schemas/lithology_hc_correction.py +0 -0
  21. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/schemas/lithology_ssc.py +0 -0
  22. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/schemas/lithology_vsh_gr.py +0 -0
  23. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/schemas/permeability_choo.py +0 -0
  24. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/schemas/permeability_others.py +0 -0
  25. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/schemas/porosity.py +0 -0
  26. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/schemas/ressum.py +0 -0
  27. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/schemas/saturation_archie.py +0 -0
  28. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/schemas/saturation_b.py +0 -0
  29. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/schemas/saturation_qv.py +0 -0
  30. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/schemas/saturation_rw.py +0 -0
  31. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/schemas/saturation_temp_grad.py +0 -0
  32. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/schemas/saturation_waxman_smits.py +0 -0
  33. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/services/chat.py +0 -0
  34. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/services/las_handler.py +0 -0
  35. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/services/lithology.py +0 -0
  36. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/services/permeability.py +0 -0
  37. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/services/porosity.py +0 -0
  38. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/services/reservoir_summary.py +0 -0
  39. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/services/saturation.py +0 -0
  40. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/static/favicon.ico +0 -0
  41. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/static/logo.png +0 -0
  42. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/template/chat.html +0 -0
  43. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/api/template/home.html +0 -0
  44. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/cli.py +0 -0
  45. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/config.py +0 -0
  46. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/core_calibration.py +0 -0
  47. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/database/__init__.py +0 -0
  48. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/database/models.py +0 -0
  49. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/database/setup_postgresql_db.sql +0 -0
  50. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/database/setup_sqlite_db.sql +0 -0
  51. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/fluid_type.py +0 -0
  52. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/lithology/__init__.py +0 -0
  53. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/lithology/carbonate.py +0 -0
  54. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/lithology/multi_mineral.py +0 -0
  55. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/lithology/sand_shale.py +0 -0
  56. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/lithology/sand_silt_clay.py +0 -0
  57. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/lithology/thin_beds.py +0 -0
  58. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/machine_learning/__init__.py +0 -0
  59. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/machine_learning/config.py +0 -0
  60. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/machine_learning/feature_engineering.py +0 -0
  61. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/machine_learning/mock_data/mock_data.parquet +0 -0
  62. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/machine_learning/predict_pipeline.py +0 -0
  63. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/machine_learning/train_pipeline.py +0 -0
  64. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/machine_learning/utils.py +0 -0
  65. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/permeability.py +0 -0
  66. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/plotter/__init__.py +0 -0
  67. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/plotter/plotter.py +0 -0
  68. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/plotter/well_log.py +0 -0
  69. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/plotter/well_log_config.py +0 -0
  70. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/porosity.py +0 -0
  71. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/qaqc.py +0 -0
  72. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/ressum.py +0 -0
  73. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/rock_physics/__init__.py +0 -0
  74. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/rock_physics/geomechanics.py +0 -0
  75. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/rock_physics/geophysics.py +0 -0
  76. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/rock_physics/rpm.py +0 -0
  77. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/rock_type.py +0 -0
  78. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/saturation.py +0 -0
  79. {quick_pp-0.2.67 → quick_pp-0.2.68}/quick_pp/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quick-pp
3
- Version: 0.2.67
3
+ Version: 0.2.68
4
4
  Summary: Python package to assist in providing quick-look/ preliminary petrophysical estimation.
5
5
  Project-URL: Homepage, https://github.com/imranfadhil/quick_pp
6
6
  Author-email: Imran Fadhil <imranfadhil@gmail.com>
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "quick-pp"
7
- version = "0.2.67"
7
+ version = "0.2.68"
8
8
  description = "Python package to assist in providing quick-look/ preliminary petrophysical estimation."
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -20,4 +20,4 @@ logging.getLogger("mlflow").setLevel(logging.WARNING)
20
20
 
21
21
  __author__ = """Imran Fadhil"""
22
22
  __email__ = 'imranfadhil@gmail.com'
23
- __version__ = '0.2.67' # Need to be updated manually when releasing a new version/ change in pyproject.toml
23
+ __version__ = '0.2.68' # Need to be updated manually when releasing a new version/ change in pyproject.toml
@@ -86,9 +86,9 @@ class DBConnector:
86
86
  script_dir = os.path.dirname(__file__)
87
87
  db_type = "sqlite" if "sqlite" in DBConnector._engine.url.drivername else "postgresql"
88
88
  if db_type == "sqlite":
89
- sql_script = "sqlite_setup.sql"
89
+ sql_script = "setup_sqlite_db.sql"
90
90
  elif db_type == "postgresql":
91
- sql_script = "postgresql_setup.sql"
91
+ sql_script = "setup_postgresql_db.sql"
92
92
  else:
93
93
  raise ValueError(f"Unsupported database type: {db_type}")
94
94
 
@@ -94,7 +94,7 @@ class Project(object):
94
94
  logger.warning(f"Well '{well_name}' already exists in project '{self.name}'. Skipping or updating.")
95
95
  # Optionally, load and update the existing well
96
96
  well_obj = Well(self.db_session, well_id=existing_well.well_id)
97
- well_obj.update_data_from_las_parse(well_data, header_data_dict)
97
+ well_obj.update_data_from_las_parse(well_data, header_data)
98
98
  else:
99
99
  well_obj = Well(
100
100
  self.db_session,
@@ -104,7 +104,7 @@ class Project(object):
104
104
  header_data=header_data_dict,
105
105
  depth_uom=depth_uom
106
106
  )
107
- well_obj.update_data_from_las_parse(well_data, header_data_dict)
107
+ well_obj.update_data_from_las_parse(well_data, header_data)
108
108
  self.db_session.add(well_obj._orm_well)
109
109
  self.db_session.flush()
110
110
 
@@ -120,7 +120,8 @@ class Project(object):
120
120
  if orm_well:
121
121
  well_obj = Well(self.db_session, well_id=orm_well.well_id)
122
122
  well_obj.update_data(well_data)
123
- well_obj.update_config(well_configs.get(well_name, {}))
123
+ if well_configs is not None:
124
+ well_obj.update_config(well_configs.get(well_name, {}))
124
125
  well_obj.save() # Persist the updated data and config to the DB
125
126
  else:
126
127
  logger.warning(f"Well '{well_name}' not found in project '{self.name}'. Skipping update.")
@@ -306,14 +307,14 @@ class Well(object):
306
307
  """Loads a well from the database by ID."""
307
308
  return cls(db_session=db_session, well_id=well_id)
308
309
 
309
- def update_data_from_las_parse(self, parsed_data: pd.DataFrame, parsed_header: Dict[str, Any]):
310
+ def update_data_from_las_parse(self, parsed_data: pd.DataFrame, parsed_header: pd.DataFrame):
310
311
  """
311
312
  Updates well's header and curve data from LAS parsing results.
312
313
  `parsed_data` is expected to be a DataFrame where index is depth and columns are curve mnemonics.
313
314
  `parsed_header` is a dictionary of header information.
314
315
  """
315
316
  logger.info(f"Updating well '{self.name}' from LAS parse.")
316
- self.header_data = parsed_header
317
+ self.header_data = parsed_header.to_dict()
317
318
 
318
319
  # Get existing curve mnemonics for this well
319
320
  existing_mnemonics = {c.mnemonic for c in self._orm_well.curves}
@@ -338,8 +339,8 @@ class Well(object):
338
339
  orm_curve = ORMCurve(
339
340
  well_id=self.well_id,
340
341
  mnemonic=mnemonic,
341
- unit=parsed_header.get(mnemonic, {}).get('unit'),
342
- description=parsed_header.get(mnemonic, {}).get('description'),
342
+ unit=las.get_unit_from_header(parsed_header, mnemonic),
343
+ description=las.get_descr_from_header(parsed_header, mnemonic),
343
344
  data_type=data_type
344
345
  )
345
346
  self._orm_well.curves.append(orm_curve)
@@ -10,17 +10,22 @@ from quick_pp import logger
10
10
 
11
11
 
12
12
  def read_las_files(las_files, depth_uom=None):
13
- """
14
- 1. Return df and well_header as df from .las files
15
- 2. For every las files, curves_df, header_df, welly_object are returned through function "read_las_file"
16
- 3. curves_df from all files are appended into merged_data
17
- 4. header_df from all files are appended into header_data
13
+ """Reads multiple LAS files and merges their data and headers.
14
+
15
+ This function iterates through a list of LAS file objects, reads each one,
16
+ and concatenates the curve data and header information into two separate
17
+ pandas DataFrames. It attempts to read with `welly` first and falls back
18
+ to a memory-mapped approach if `welly` fails.
18
19
 
19
20
  Args:
20
- las_files (list): list of las files opened as binary.
21
+ las_files (list): A list of file-like objects opened in binary mode.
22
+ depth_uom (str, optional): The unit of measurement for the depth index.
23
+ Used by `welly` during reading. Defaults to None.
21
24
 
22
25
  Returns:
23
- pd.DataFrame: Merged data, header data.
26
+ tuple[pd.DataFrame, pd.DataFrame]:
27
+ - A DataFrame containing the merged curve data from all LAS files.
28
+ - A DataFrame containing the merged header information from all LAS files.
24
29
  """
25
30
  merged_data = pd.DataFrame()
26
31
  header_data = pd.DataFrame()
@@ -40,14 +45,25 @@ def read_las_files(las_files, depth_uom=None):
40
45
 
41
46
 
42
47
  def read_las_file_mmap(file_object, required_sets=['PEP']): # noqa
43
- """Check LAS file and concat datasets if more than one.
48
+ """Reads a single LAS file using a memory-mapped approach, handling multiple data sets.
49
+
50
+ This function is designed to parse LAS files, especially those with multiple
51
+ data sets (e.g., different logging runs), which might not be handled correctly
52
+ by standard parsers. It uses memory-mapping for efficient file access and can
53
+ selectively extract required data sets.
44
54
 
45
55
  Args:
46
- file_object (str): las file object.
47
- required_sets (list, optional): Required param set to be extracted. Defaults to ['PEP'].
56
+ file_object (file): A file-like object opened in binary mode.
57
+ required_sets (list, optional): A list of data set identifiers to extract.
58
+ If the LAS file contains multiple sets, only
59
+ those matching the identifiers in this list
60
+ will be processed. Defaults to ['PEP'].
48
61
 
49
62
  Returns:
50
- pd.Dataframe: well_df, header_df and welly_object
63
+ tuple[pd.DataFrame, pd.DataFrame, welly.well.Well]:
64
+ - A DataFrame containing the curve data.
65
+ - A DataFrame containing the header information.
66
+ - A `welly.well.Well` object representing the well.
51
67
  """
52
68
  fileno = file_object.fileno() # identifier for files
53
69
  parameter_line_numbers = []
@@ -139,6 +155,23 @@ def read_las_file_mmap(file_object, required_sets=['PEP']): # noqa
139
155
 
140
156
 
141
157
  def read_las_file_welly(file_object, depth_uom=None):
158
+ """Reads a LAS file using the welly library.
159
+
160
+ This function provides a straightforward way to read a LAS file into a
161
+ `welly` object, which is then processed to extract curve data and header
162
+ information into pandas DataFrames.
163
+
164
+ Args:
165
+ file_object (file): A file-like object, from which the `.name` attribute
166
+ (file path) is used by `welly`.
167
+ depth_uom (str, optional): The unit of measurement for the depth index.
168
+ Passed to `welly` for index creation. Defaults to None.
169
+
170
+ Returns:
171
+ tuple[pd.DataFrame, pd.DataFrame]:
172
+ - A DataFrame containing the processed curve data.
173
+ - A DataFrame containing the header information.
174
+ """
142
175
  welly_dataset = welly.las.from_las(file_object.name)
143
176
  welly_object = welly.well.Well.from_datasets(welly_dataset, index_units=depth_uom)
144
177
  df, well_header = pre_process(welly_object)
@@ -146,18 +179,21 @@ def read_las_file_welly(file_object, depth_uom=None):
146
179
 
147
180
 
148
181
  def pre_process(welly_object):
149
- """Pre-process welly_object
182
+ """Pre-processes a `welly` object to extract and clean data.
150
183
 
151
- 1. Resample depth for welly_object
152
- 2. Replace NULL value with nan
153
- 3. Insert well name at first column
154
- 4. Insert field name at first column
184
+ This function takes a `welly.well.Well` object and performs several
185
+ pre-processing steps:
186
+ 1. Converts the depth index to a 'DEPTH' column.
187
+ 2. Replaces LAS-defined NULL values with `np.nan`.
188
+ 3. Inserts 'WELL_NAME' and 'UWI' columns at the beginning of the DataFrame.
155
189
 
156
190
  Args:
157
- welly_object (well object): Welly object for PEP dataset
191
+ welly_object (welly.well.Well): The welly object to process.
158
192
 
159
193
  Returns:
160
- pd.Dataframe: Processed data.
194
+ tuple[pd.DataFrame, pd.DataFrame]:
195
+ - A DataFrame containing the processed curve data.
196
+ - A DataFrame containing the header information.
161
197
  """
162
198
  # Convert index 'DEPTH' as column
163
199
  data_df = welly_object.las[0]
@@ -172,7 +208,7 @@ def pre_process(welly_object):
172
208
  # Insert well name
173
209
  well_name = get_wellname_from_header(header_df)
174
210
  if 'WELL_NAME' not in data_df.columns:
175
- data_df.insert(0, 'WELL_NAME', well_name.replace("/", "-").replace(" ", "-"))
211
+ data_df.insert(0, 'WELL_NAME', well_name)
176
212
  # Insert UWI if available
177
213
  if 'UWI' in header_df['mnemonic'].values:
178
214
  uwi = get_uwi_from_header(header_df)
@@ -182,26 +218,70 @@ def pre_process(welly_object):
182
218
 
183
219
 
184
220
  def get_wellname_from_header(header_df):
221
+ """Extracts the well name from the LAS header DataFrame.
222
+
223
+ Args:
224
+ header_df (pd.DataFrame): The LAS header data.
225
+
226
+ Returns:
227
+ str: The well name, with slashes and spaces replaced by hyphens.
228
+ """
185
229
  return header_df[
186
230
  (header_df['mnemonic'] == 'WELL') | (header_df['descr'].str.upper() == 'WELL')
187
- ]['value'].values[0]
231
+ ]['value'].values[0].replace("/", "-").replace(" ", "-")
188
232
 
189
233
 
190
234
  def get_uwi_from_header(header_df):
235
+ """Extracts the Unique Well Identifier (UWI) from the LAS header DataFrame.
236
+
237
+ If the UWI is not found, it falls back to using the well name.
238
+
239
+ Args:
240
+ header_df (pd.DataFrame): The LAS header data.
241
+
242
+ Returns:
243
+ str: The UWI or well name, with slashes and spaces replaced by hyphens.
244
+ """
191
245
  uwi = header_df[
192
246
  (header_df['mnemonic'] == 'UWI') | (header_df['descr'].str.upper() == 'UNIQUE WELL ID')
193
- ]['value'].values[0]
247
+ ]['value'].values[0].replace("/", "-").replace(" ", "-")
194
248
  return uwi if uwi else get_wellname_from_header(header_df)
195
249
 
196
250
 
251
+ def get_unit_from_header(header_df, mnemonic):
252
+ """Extracts the unit for a specific curve mnemonic from the LAS header.
253
+
254
+ Args:
255
+ header_df (pd.DataFrame): The LAS header data.
256
+ mnemonic (str): The curve mnemonic to look for.
257
+
258
+ Returns:
259
+ str or None: The unit of the curve, or None if not found.
260
+ """
261
+ return header_df[header_df['mnemonic'] == mnemonic]['unit'].values[0] if any(
262
+ header_df['mnemonic'].str.contains(mnemonic)) else None
263
+
264
+
265
+ def get_descr_from_header(header_df, mnemonic):
266
+ """Extracts the description for a specific curve mnemonic from the LAS header.
267
+
268
+ Args:
269
+ header_df (pd.DataFrame): The LAS header data.
270
+ mnemonic (str): The curve mnemonic to look for.
271
+
272
+ Returns:
273
+ str or None: The description of the curve, or None if not found.
274
+ """
275
+ return header_df[header_df['mnemonic'] == mnemonic]['descr'].values[0] if any(
276
+ header_df['mnemonic'].str.contains(mnemonic)) else None
277
+
278
+
197
279
  def extract_dataset(section_dict):
198
- """Extract dataset from section_dict. For only Las file with ONE (1) dataset
280
+ """Extracts a single dataset from a dictionary of LAS file sections.
199
281
 
200
- 1. Assign well information section as header_bytes
201
- 2. Loop through parameter, curve, and ASCII sections, assign their section values into data_bytes
202
- 3. create file_object by decoding and concat header_bytes and data_bytes
203
- 4. Using lasio.read and welly.well.from_lasio, create welly_object & well_df from file_object
204
- 5. Through function "pre_process", return df with null replaced by nan, addition of column with well and field name
282
+ This function is intended for LAS files that contain only one data set.
283
+ It reconstructs the LAS file content from the separated sections, reads it
284
+ using `lasio` and `welly`, and then pre-processes the result.
205
285
 
206
286
  Args:
207
287
  section_dict (dict): Dictionary containing the LAS file section values.
@@ -231,18 +311,21 @@ def extract_dataset(section_dict):
231
311
 
232
312
 
233
313
  def concat_datasets(file_object, header_line_numbers, parameter_line_numbers, required_sets=['PEP']):
234
- """Concat required datasets in the LAS file.
314
+ """Extracts and concatenates specified datasets from a multi-set LAS file.
235
315
 
236
- 1. Iterate through list of parameter_line_numbers, by extracting only param_set of 'PEP'
237
- 2. Through pointer position, subset and then concat well_info and file_object
238
- 3. Through function "pre_process", return df with null replaced by nan, addition of column with well and field name
316
+ This function iterates through the parameter sections identified in a LAS file.
317
+ For each section that matches the `required_sets`, it reconstructs a temporary
318
+ single-set LAS file in memory, reads it, and concatenates the resulting data.
239
319
 
240
320
  Args:
241
- file_object (object): File .read() object.
242
- header_line_numbers (list of tuples): Pointer location and line number of the header information.
243
- parameter_line_numbers (list of tuples): (parameter_count, parameter_set, pointer location, line number) of the
244
- ~Parameters in the LAS file.
245
- required_sets (list): Required sets to be concatenated.
321
+ file_object (bytes): The full content of the LAS file as a bytes object.
322
+ header_line_numbers (list): A list of tuples defining the start and end
323
+ pointers for the main well header section.
324
+ parameter_line_numbers (list): A list of tuples, each containing metadata
325
+ about a `~Parameter` section, including its
326
+ set identifier and pointer location.
327
+ required_sets (list, optional): A list of data set identifiers to extract
328
+ and concatenate. Defaults to ['PEP'].
246
329
 
247
330
  Returns:
248
331
  pd.Dataframe, pd.Dataframe, welly_object: well_df, header_df and welly_object
@@ -275,13 +358,15 @@ def concat_datasets(file_object, header_line_numbers, parameter_line_numbers, re
275
358
 
276
359
 
277
360
  def check_index_consistent(welly_object):
278
- """Check if index is consistent in welly_object
361
+ """Checks if the depth index of a welly object is consistent.
362
+
363
+ A consistent index means it is monotonically increasing with a constant step.
279
364
 
280
365
  Args:
281
- welly_object (object): Welly object
366
+ welly_object (welly.well.Well): The welly object to check.
282
367
 
283
368
  Returns:
284
- bool: True if index is consistent
369
+ bool: True if the index is consistent, False otherwise.
285
370
  """
286
371
  try:
287
372
  index_diff = np.diff(welly_object.las[0].index)
@@ -295,11 +380,18 @@ def check_index_consistent(welly_object):
295
380
 
296
381
 
297
382
  def export_to_las(well_data, well_name, folder='', vars_units=None):
298
- """Export dataframe to las file. Expecting a DEPTH column in meters unit.
383
+ """Exports a DataFrame of well data to a LAS file.
384
+
385
+ The input DataFrame is expected to have a 'DEPTH' column, which will be
386
+ used as the index for the LAS file.
299
387
 
300
388
  Args:
301
- data_df (pd.DataFrame): data input
302
- well_name (str): well name
389
+ well_data (pd.DataFrame): The DataFrame containing the well log data.
390
+ well_name (str): The name of the well, used for the output filename.
391
+ folder (str, optional): The directory to save the LAS file in. Defaults to ''.
392
+ vars_units (dict, optional): A dictionary mapping curve mnemonics to their
393
+ units. If not provided, it will be inferred
394
+ from the configuration.
303
395
  """
304
396
  from .config import Config
305
397
  units = vars_units if vars_units else Config.vars_units(well_data)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes