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

grdinfo: Fix pad for external wrappers and update grid header for -L option #8528

Merged
merged 1 commit into from
Jun 24, 2024

Conversation

seisman
Copy link
Member

@seisman seisman commented Jun 24, 2024

Closes #8525.

@@ -689,8 +689,6 @@ EXTERN_MSC int GMT_grdinfo (void *V_API, int mode, void *args) {

Out = gmt_new_record (GMT, (n_cols) ? out : NULL, (cmode) == GMT_COL_FIX ? record : NULL); /* the two items */

gmt_set_pad (API->GMT, 0); /* Not read pads to simplify operations */
Copy link
Member Author

Choose a reason for hiding this comment

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

@joa-quim Do you see any side effects removing this line?

@joa-quim
Copy link
Member

simplify operations does not seems a reason good enough. Specially when it has buggish side effects, so I would say we should remove it and see if there are any noticeable side effects.

The pad is big annoyance for externals transfering grids in memory because it implies making a full copy of the array and for many operations, grdinfo for example, the pad is not necessary at all. In Julia I try to distinguish uses where pad is needed (projections, gradients, etc...) from others where it doesn't and in those case I set the pad to zero.

@seisman
Copy link
Member Author

seisman commented Jun 24, 2024

No new failures and the original bug is fixed. Merging.

@seisman seisman merged commit f31c583 into master Jun 24, 2024
15 of 18 checks passed
@seisman seisman deleted the grdinfo-L branch June 24, 2024 14:34
@seisman
Copy link
Member Author

seisman commented Jun 24, 2024

The pad is big annoyance for externals transfering grids in memory because it implies making a full copy of the array and for many operations, grdinfo for example, the pad is not necessary at all. In Julia I try to distinguish uses where pad is needed (projections, gradients, etc...) from others where it doesn't and in those case I set the pad to zero.

How do I know if a module needs pad or not?

@joa-quim
Copy link
Member

Well, a little bit by reasoning + trial-error. Making a projected image needs pad but a linear one (-JX) does not. Shading needs pad because of the gradient. Also, when a module needs the pad and grid/image do not have it, an error is issued.

@seisman
Copy link
Member Author

seisman commented Jun 25, 2024

Good to know. Will see how it works in PyGMT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

grdinfo -L0 doesn't work for external wrappers
2 participants