lasio icon indicating copy to clipboard operation
lasio copied to clipboard

Files without ~ASCII line take forever to finish parsing

Open cimka opened this issue 3 years ago • 12 comments

I have a file that has this section just before the data.

~Parameter Information Block #MNEM.UNIT Value Description #----.---- ---------------------------------------- ------------------------------- 2344 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -10.2696 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 2345 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -10.2696 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500

if I modify it to

~Parameter Information Block #MNEM.UNIT Value Description #----.---- ---------------------------------------- ------------------------------- ~ASCII 2344 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -10.2696 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 2345 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -10.2696 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500 -999.2500

I have now added some data. The data is a bit modified.

It works. Otherwise it will be stuck forever. I cant share the whole file. But it should not be needed I think. Even if it is not correct file it should not be stuck forever.

cimka avatar Nov 02 '20 09:11 cimka

Thanks for the bug report. Are you able to upload an example file which exhibits the behaviour?

kinverarity1 avatar Nov 02 '20 09:11 kinverarity1

The file is not possible to upload sorry. Cant share it.

cimka avatar Nov 02 '20 09:11 cimka

Sorry I am not being clear - are you able to obfuscate it by for example removing all but one data line?

kinverarity1 avatar Nov 02 '20 09:11 kinverarity1

Ok. Does the example file have a line containing ~ASCII at all?

kinverarity1 avatar Nov 02 '20 09:11 kinverarity1

No it did not have and ~ASCII at all. It makes LASIO stuck completely.

cimka avatar Nov 02 '20 09:11 cimka

OK, I'll have a look at it. These kinds of files are pretty difficult to handle because the ~ASCII line which demarcates the beginning of the data section is a critical and important part of the file structure and definition. Out of curiosity - is the file marked as LAS file version 1.2, 2.0 or 3.0? It should be near the top on the line beginning with VERS.

lasio should probably fail with an exception for a file like you describe. It certainly shouldn't be stuck in an endless loop. There was recently a change to the parser which may have introduced this bug, and we may not have had a regression test for it. Thanks for the report!

kinverarity1 avatar Nov 03 '20 00:11 kinverarity1

The two first lines of the file. ~Version Information VERS. 1.20: CWLS log ASCII Standard -VERSION 1.20

cimka avatar Nov 03 '20 08:11 cimka

Interesting error, cimka-- thanks for reporting.

I tried to reproduce your error by modifying the ./tests/examples/1.2/sample_wrapped.las file to look similar to the text you posted, but could not reproduce.

Can you please upload/post the problem file in an obfuscated form? In other words, change all the header entries (like well name and location, etc.) and just provide a couple lines of data. We understand the need to keep data private. That said, if we can't reproduce the error we won't be able to try to fix it!

Cheers

dagrha avatar Nov 12 '20 16:11 dagrha

Sorry for later reply. We have fixed the las file internally and I don't remember where or if I still have it around. I can try and reproduce this with some other file and see if it will have same issue.

cimka avatar Nov 19 '20 09:11 cimka

I found the file now. But when I reduce the file size to 34KB it takes 12 seconds to read and to 77KB makes it take 2,5 min to read the file. The original file is 1818KB. Also tested with more sizes of the file and did approximation in excel. So the time it would take with 1818KB would be 819 hours.

So it is not a complete deadlock but something that takes a long time when ~A is missing. I hope this can help you more. I am unable to give you the full file or modify it when this much data is needed.

On my end this happens when we call lasio.las.LASFile(file_path)

cimka avatar Nov 19 '20 10:11 cimka

We did find a file with the same fault, so I took the file ./tests/examples/1.2/sample_big.las and modified it a bit and I do get into the same issue with this one. See it here attached (renamed to .txt to be able to upload it :)). sample_big_modified.las.txt

cimka avatar Jan 04 '21 13:01 cimka

Thank you for uploading that and passing the file on. I will have a look!

kinverarity1 avatar Apr 07 '21 12:04 kinverarity1