lasio icon indicating copy to clipboard operation
lasio copied to clipboard

Reading only single section from LAS

Open MandarJKulkarni opened this issue 3 years ago • 3 comments

Sometimes it is required to only read ~version section or ~well section from a given las. With ignore_data flag, lasio reads all sections other than '~A' section.

Has it been considered before to read only the specified section using lasio?

example: To read complete file las = lasio.read('tests/examples/sample.las')

To read only version section las = lasio.read('tests/examples/sample.las', section='~v') or las = lasio.read('tests/examples/sample.las', section='version')

MandarJKulkarni avatar Jul 26 '20 11:07 MandarJKulkarni

I haven't really thought about it... logically in my mind specifying section='~version' would imply the function returns a section - not a complete LAS file. So it should be a new function.

PR #327 (soon to be merged) contains a function lasio.reader.parse_header_items_section which is a bit lower level, but essentially serves that purpose: it reads a chunk out of a file-like object and returns a SectionItems (i.e. LAS file section). You however first also need to know the version of the LAS file, which is why this is all hidden in lasio.read, which also handles the LAS-version-parsing.

You could write a function which is halfway in-between the two above...

kinverarity1 avatar Jul 28 '20 23:07 kinverarity1

Yes, new function would make sense. I'll take a stab at trying out this.

MandarJKulkarni avatar Aug 01 '20 19:08 MandarJKulkarni

FYI #327 has now been merged to master, and could provide a basis for this functionality.

kinverarity1 avatar Sep 04 '20 04:09 kinverarity1