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

Add Support For File-Like Object #289

Open SwordSam opened 4 years ago

SwordSam commented 4 years ago

When I read from S3 bucket which is actually a .dlis file:

s3_client = boto3.client('s3') s3_response_object = s3_client.get_object(Bucket=x['bucket'], Key=x['s3_key']) object_content = s3_response_object['Body'].read()

I am not able to pass it to dlisio.load() as it only accepts a path to a file while my object_content is a BytesIO object. Is there any workaround or fix for it? Thanks,

achaikou commented 4 years ago

Hi,

Thank you for reporting this issue.

Unfortunately as of now dlisio does not have cloud support [ #163 ] We consider supporting it in the future and will take it into consideration that we have users who would appreciate the feature.

I am not familiar with File-Like Objects, so the only workaround I can think of is to convert BytesIO into a temporary file first (which seems to be possible) and then read it as normal.

SwordSam commented 4 years ago

Hi,

Thanks for the prompt reply. Correct temporary files are what I am using as workaround for now.

jokva commented 4 years ago

I am not familiar with File-Like Objects, so the only workaround I can think of is to convert BytesIO into a temporary file first (which seems to be possible) and then read it as normal.

This is pretty much the use case we design lfp for, so "all" we need is a Python file-like backend for it. It's a reasonably easy thing to do, but of course takes a while with testing and whatnot.