equinor / dlisio

Python library for working with the well log formats Digital Log Interchange Standard (DLIS V1) and Log Information Standard (LIS79)
https://dlisio.readthedocs.io/en/latest/
Other
121 stars 39 forks source link

Issues with Reading LIS Files... #384

Closed nwshaw closed 3 years ago

nwshaw commented 3 years ago

Hi DLISIO Team,

I'm trying to read LIS files using the latest version of the DLISIO library, however every file I try its failing. Below is a fragment of code I'm using. Failing every time on _for format_spec in formatspecs:, with the exception 'method' object is not iterable

Any thoughts?

Thanks in advance

N.

with lis.load(strFileName) as files:

        try:
            for f in files:
                format_specs = f.data_format_specs
                **for format_spec in format_specs:**
                    for sample_rate in format_spec.sample_rates():
                        data = lis.curves(f, format_spec, sample_rate)
                        meta = lis.curves_metadata(format_spec, sample_rate)

        except Exception as e:
            print(e)
ErlendHaa commented 3 years ago

Hi

The error is due to a syntax error in your code. f.data_format_spec is method, like the error suggest. Your code should be:

for f in files:
    for format_spec in f.data_format_specs():
        for sample_rate in format_spec.sample_rates():
            data = lis.curves(f, format_spec, sample_rate)
            meta = lis.curves_metadata(format_spec, sample_rate)

I see that this miss-understanding might originate from dlisio's own documentation, which also gets this wrong. I will update the relevant sections

nwshaw commented 3 years ago

Thank You !!