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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/grdinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ static int usage (struct GMTAPI_CTRL *API, int level) {
GMT_Usage (API, 3, "a: All of the above.");
GMT_Usage (API, -2, "Note: If grid is geographic then we report area-weighted statistics.");
GMT_Usage (API, 1, "\n-M[c|f]");
GMT_Usage (API, -2, "\nSearch for the global data min and max locations (x0,y0{,z0}) and (x1,y1{,z1}) [Default]."
GMT_Usage (API, -2, "\nSearch for the global data min and max locations (x0,y0{,z0}) and (x1,y1{,z1}) [Default]."
" Append c to only determine data min/max range if missing from the header, or f to force that search to override the header range.");
GMT_Option (API, "R");
GMT_Usage (API, 1, "\n-T[<dv>][+a[<alpha>]][+s]");
Expand Down Expand Up @@ -576,7 +576,7 @@ GMT_LOCAL void grdinfo_smart_increments (struct GMT_CTRL *GMT, double inc[], uns
EXTERN_MSC int gmtlib_is_nc_grid (struct GMT_CTRL *GMT, struct GMT_GRID_HEADER *header);

#define bailout(code) {gmt_M_free_options (mode); return (code);}
#define Return(code) {Free_Ctrl (GMT, Ctrl); gmt_set_pad (GMT, GMT_PAD_DEFAULT); gmt_end_module (GMT, GMT_cpy); bailout (code);}
#define Return(code) {Free_Ctrl (GMT, Ctrl); gmt_end_module (GMT, GMT_cpy); bailout (code);}

EXTERN_MSC int GMT_grdinfo (void *V_API, int mode, void *args) {
int error = 0, k_data, k_tile_id;
Expand Down Expand Up @@ -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?


for (opt = options; opt; opt = opt->next) { /* Loop over arguments, skip options */

if (opt->option != '<') continue; /* We are only processing filenames here */
Expand Down Expand Up @@ -852,7 +850,7 @@ EXTERN_MSC int GMT_grdinfo (void *V_API, int mode, void *args) {
}
else /* Not a single valid node */
x_min = x_max = y_min = y_max = z_min = z_max = GMT->session.d_NaN;
if (Ctrl->M.mode == GRDINFO_FORCE) { /* Update header */
if (Ctrl->M.mode == GRDINFO_FORCE || Ctrl->L.active) { /* Update header */
header->z_min = v_min;
header->z_max = v_max;
}
Expand Down
Loading