Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lasio incorrectly determines the number of columns in a multiline LAS file when the number of curves is a multiple of the number of columns. #583

Open
Aycon3296 opened this issue Jan 25, 2024 · 3 comments
Labels

Comments

@Aycon3296
Copy link

Aycon3296 commented Jan 25, 2024

Describe the bug
lasio incorrectly determines the number of columns in a multiline LAS file when the count of curves is a multiple of the number of columns. reader.inspect_data_section returns of "8" (number of columns in first line of pure data) istead of "-1" on my LAS File with 56 curves. I was only able to fix this by using the monkey patch by adding a check that:

# file lasio.las.LASFile
# in function read()

# How many curves should the reader attempt to find?
reader_n_columns = n_columns
len_curves = len(self.curves)
if reader_n_columns == -1 or (len_curves > reader_n_columns and len_curves % reader_n_columns == 0):
    reader_n_columns = len(self.curves)

To Reproduce
Try open (or read) multiline LAS file where a count of columns data is a multiple of headers (mnemonics in '~C' sector).

Current behavior
Console write many warnings as is:

WARNING:lasio.reader:Curve #8 'DC' is defined in the ~C section but there is no data in ~A
WARNING:lasio.reader:Curve #9 'DGK' is defined in the ~C section but there is no data in ~A
WARNING:lasio.reader:Curve #10 'DN' is defined in the ~C section but there is no data in ~A
...

The number of data lines read is 7 times less than actual lines (56 // 8 = 7).

Expected behavior
LAS file readed correctly.

@Aycon3296 Aycon3296 added the bug label Jan 25, 2024
@Aycon3296 Aycon3296 changed the title lasio incorrectly determines the number of columns in a multiline LAS file when the length of curves is a multiple of the number of columns. lasio incorrectly determines the number of columns in a multiline LAS file when the number of curves is a multiple of the number of columns. Jan 25, 2024
@kinverarity1
Copy link
Owner

Thanks for reporting - can you provide an example file? Also is the data section wrapped onto multiple lines and if so what is the value of the line with WRAP in the ~V section?

@Aycon3296
Copy link
Author

Certainly! Here's my example. It is truncated and the extension is changed to "txt".
321-02.txt

@kinverarity1
Copy link
Owner

Thank you, the sample is very helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants