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
delete_curve issue #315
Comments
Thanks @hflesche, I will have a look at this tomorrow. |
I have a feeling this is always likely to fail, e.g. https://stackoverflow.com/a/2897058/596328 Out of curiosity, does adding a slice to obtain a copy (see below) work for you? keep_curves = ['DEPTH', 'DT', 'DTS']
for curve in las_file.curves[:]:
if curve.mnemonic not in keep_curves:
las_file.delete_curve(curve.mnemonic) |
Yes, that works. Another option that also works is this:
According to the link that you sent, this may not be an issue for delete_curve, it is more of a Python issue. A warning could perhaps be added to the docs, but it is not really a bug. |
Great idea, I'll add something to the docs!
…________________________________
From: Harald Flesche <notifications@github.com>
Sent: Friday, April 17, 2020 1:03:02 AM
To: kinverarity1/lasio <lasio@noreply.github.com>
Cc: Kent Inverarity <kinverarity@hotmail.com>; Comment <comment@noreply.github.com>
Subject: Re: [kinverarity1/lasio] delete_curve issue (#315)
Yes, that works. Another option that also works is this:
for curve_name in las_file.keys():
if curve_name not in keep_curves:
las_file.delete_curve(curve_name)
According to the link that you sent, this may not be an issue for delete_curve, it is more of a Python issue. A warning could perhaps be added to the docs, but it is not really a bug.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<https://eur05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fkinverarity1%2Flasio%2Fissues%2F315%23issuecomment-614726293&data=02%7C01%7C%7C8b14ad9672d34677530508d7e21b7414%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637226479846110417&sdata=0oLHnnql8ONFeuJWqqPbGBz9I3uBc7AfKB1eVdv8nRw%3D&reserved=0>, or unsubscribe<https://eur05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABCQ626OV6TN6EAUPDRCUSLRM4QK5ANCNFSM4MJF22SA&data=02%7C01%7C%7C8b14ad9672d34677530508d7e21b7414%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637226479846120412&sdata=jQJ3XP%2BFMdxnSrEerWaP1lZshXO5p6u5KK9jmMfDgoA%3D&reserved=0>.
|
If you loop through curves in a las-file to delete some of them, the result is not correct unless you start from the last curve and move forwards. Let's say we have a las object with curves DEPTH, BS, CALI, RHOB, DT and DTS. The following code will skip CALI when BS curve is deleted:
whereas if the list of curves is reversed, the correct ones are deleted:
The text was updated successfully, but these errors were encountered: