Skip to content

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

Merged
seisman merged 1 commit into
masterfrom
grdinfo-L
Jun 24, 2024
Merged

seisman merged 1 commit into
masterfrom
grdinfo-L

Conversation

@seisman

@seisman seisman commented Jun 24, 2024

Copy link
Copy Markdown
Member

Closes #8525.

Comment thread src/grdinfo.c

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
Copy Markdown
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
Copy Markdown
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

seisman commented Jun 24, 2024

Copy link
Copy Markdown
Member Author

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

@seisman
seisman merged commit f31c583 into master Jun 24, 2024
@seisman
seisman deleted the grdinfo-L branch June 24, 2024 14:34
@seisman

seisman commented Jun 24, 2024

Copy link
Copy Markdown
Member Author

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
Copy Markdown
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

seisman commented Jun 25, 2024

Copy link
Copy Markdown
Member Author

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 -L doesn't work for external wrappers

2 participants