Handle longer strings for netCDF history, remark and title#6084
Merged
PaulWessel merged 5 commits intomasterfrom Dec 4, 2021
Merged
Handle longer strings for netCDF history, remark and title#6084PaulWessel merged 5 commits intomasterfrom
PaulWessel merged 5 commits intomasterfrom
Conversation
The length limits on these three were set back in the last century and because they are fixed array sizes in the GMT grid header they cannot be changed without breaking compatibility. The solution is to add pointers to the hidden grid header structure that is not part of the API and hence store strings that exceed the limits here. This PR does this juggling where we may need to use one of the other of the strings.
Member
|
No impact to PyGMT based on existing tests. |
Member
Author
|
Sorry, just added a commit since I had messed up the GMT command history. Now works and consistently will give warnings regardless of where things are initialized or reset. I tested the history limit 320 with a long repetitive grdmath call and it works: The netCDF grid retains the full command via the hidden struct: Use native binary grid which will be truncated: |
Member
|
No problem with Julia either. |
maxrjones
approved these changes
Dec 4, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See #6078 for motivation and context. The length limits on the three grid header attributes title, command, and remark were set back in the last century and because they are fixed array sizes in the GMT grid header they cannot be changed without breaking compatibility. The solution is to add pointers to the hidden grid header structure that is not part of the API and hence store strings that exceed the limits here. This PR does this juggling where we may need to use one of the other of the strings.
Tests pass, and longer strings work and give a warning:
Converting to native binary, for instance, will only give the truncated versions.
This PR will also need to be testing in GMT.jl (@joa-quim) and PyGMT (@meghanrjones) to make sure there are no surprises.