kinverarity1 / lasio

Python library for reading and writing well data using Log ASCII Standard (LAS) files
https://lasio.readthedocs.io/en/latest/
MIT License
343 stars 151 forks source link

Catching these warning lines. #593

Closed Soumya3276 closed 7 months ago

Soumya3276 commented 7 months ago

Describe the bug While reading using lasio by setting ignore_comments = '$' I somehow managed lasio to read # lines but the issue is it only reads the structured lines(i.e. mnem.unit value description). For unstructured lines it is raising some warnings in jupyter and when writing it is removing those lines.

Suggest some way by which I can catch those lines/warnings. So that I can write back those lines in Other section( where it does not expect any structured data)

To Reproduce While reading las file use flags ignore_comments = '$' , ignore_header_error= True

Expected behavior I just want help in catching the warning lines so that I can append those lines in other section . So nothing get lost in this process.

Software versions (please complete the following information):

Additional context Adding Image of the warning for the reference to understand which lines I want to catch. IMG_20240321_192305

kinverarity1 commented 7 months ago

@Soumya3276

I just want help in catching the warning lines so that I can append those lines in other section . So nothing get lost in this process.

What you would need to do is implement a custom logging handler to catch those warnings. However, that won't help you, because you won't be able to "re-inject" that information back into the LASFile object which is then used to write the lines back into a LAS file. It's simply not possible without modifying lasio. Those desired modifications are already captured in this issue tracker appropriately as a "feature request" in #14.

kinverarity1 commented 7 months ago

Closing, duplicate of #14