-
Notifications
You must be signed in to change notification settings - Fork 343
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
Let grdimage resample 2nd grid used for intensities #5363
Conversation
If -I specifies a second data grid from which intensities shall be derived (rather than from the input grid), we ensure the secondary grid is resampled to the resolution of the primary grid if it is not matching.
I think that it should also check that GRD2 totally encloses GRD1. |
Yes, that is reasonable, too. Maybe later today. It is Father's Day in the US and that means forced meals, activities and fewer therapeutic debugging sessions. |
Happy Father's Day!! It is also in Argentina. It would be possible to use irregular grid like the following link from the forum? |
Likewise @Esteban82 . I am not sure I understand what you mean by "irregular grids" since all grids in GMT have to be equidistant and not irregular? |
With "irregular" I mean its shape (not the spacing between nodes). Like the previous link where there is no data in the edges. |
And by shape you mean there are NaNs? The shape of all grids is rectangular but many only have data in some of that rectangle. I think NaNs are fine - you just are not going to get any shading from that part. |
OK @joa-quim I added a region check, insisting that the secondary grid covers the same region (or more). |
src/grdimage.c
Outdated
if (Grid_orig && (I_data->header->n_columns != Grid_orig->header->n_columns || I_data->header->n_rows != Grid_orig->header->n_rows)) { | ||
char int_z_grd[GMT_VF_LEN] = {""}, *res = "gp"; | ||
if (I_data->header->wesn[XLO] > region[XLO] || I_data->header->wesn[XHI] < region[XHI] || I_data->header->wesn[YLO] > region[YLO] || I_data->header->wesn[YHI] < region[YHI]) { | ||
GMT_Report (API, GMT_MSG_ERROR, "Your secondary data grid given vie -A does not cover the same area as the primary grid - aborting\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo. via not vie
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also not via -A... but -I. Fixed
This follows up on issue #5347. Turns out -I already can handle a second datagrid combined with the derive-modifiers, but the two grids have to have the same size and registration. This PR changes this so that if -I specifies a second data grid from which intensities shall be derived (rather than from the input grid), we ensure the secondary grid is resampled to the resolution of the primary grid if it is not already matching. I added a new test script that shows the use of different resolution grids. Closes #5347.