Skip to content
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

Allow writing mnemonics in ~A line #465

Merged
merged 7 commits into from
Jun 16, 2021
Merged

Allow writing mnemonics in ~A line #465

merged 7 commits into from
Jun 16, 2021

Conversation

kinverarity1
Copy link
Owner

@kinverarity1 kinverarity1 commented May 15, 2021

Partial implementation of #375 - also ref SO question https://stackoverflow.com/questions/60329481/how-to-add-curve-header-to-output-of-las-write-with-lasio-py/66939467#66939467

Adds mnemonics_header and data_section_header keyword arguments to writer.py:write. The former is boolean controlling whether it occurs or not (off by default for backwards compatibility). The latter allows the prefix to be controlled e.g. "~A" vs "~ASCII".

The mnemonic headers are right-aligned based on the numeric value's column width, so that a fixed-width formatting parser can read it in. If the mnemonics are too long, then they are just placed one following the other, out of alignment.

See https://gist.github.com/kinverarity1/aaf3459c3fa3eeafe127c9011c15c835 for a demo.

Adds mnemonics_header and data_section_header to writer.py:write
The former is boolean controlling whether it occurs or not (off by
default for backwards compatibility). The latter allows the prefix
to be controlled e.g. "~A" vs "~ASCII".

The mnemonic headers are right-aligned based on the numeric value's
column width, so that a fixed-width formatting parser can read it in.
If the mnemonics are too long, then they are just placed one following
the other, out of alignment.
@kinverarity1 kinverarity1 added the las-writer-code A bug or enhancement relating to code which creates LAS files label May 15, 2021
Copy link
Collaborator

@dcslagel dcslagel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I've noted a few suggestions.

lasio/writer.py Outdated Show resolved Hide resolved
lasio/writer.py Outdated Show resolved Hide resolved
lasio/writer.py Show resolved Hide resolved
Add tests for data-section-header column names
Copy link
Collaborator

@dcslagel dcslagel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put these suggestions on the dcslagel:data-header-line-optional-changes branch which can be closed or merged to this data-header-branch. Either way, the data-header-line pull-request can merge when you are ready.

Optional changes for the data-header-line (#465) branch
@kinverarity1
Copy link
Owner Author

Thanks for the review and comments, and changes! 🎉 I will merge shortly.

@kinverarity1 kinverarity1 merged commit ac3d808 into master Jun 16, 2021
@kinverarity1 kinverarity1 deleted the data-header-line branch May 13, 2022 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
las-writer-code A bug or enhancement relating to code which creates LAS files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants