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

Fix error in indexing for matrix-to-grid input #8554

Merged
merged 1 commit into from
Jul 25, 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
10 changes: 9 additions & 1 deletion src/gmt_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -5522,6 +5522,10 @@ GMT_LOCAL struct GMT_GRID *gmtapi_import_grid (struct GMTAPI_CTRL *API, int obje
else if (S_obj->wesn[XHI] < G_obj->header->wesn[XLO]) { /* Must first wrap G_obj->header->wesn east to fit the data */
G_obj->header->wesn[XLO] -= 360.0; G_obj->header->wesn[XHI] -= 360.0;
}
if (S_obj->wesn[XLO] < G_obj->header->wesn[XLO]) {
/* Must wrap G_obj->header.wesn so the left bound in S_obj is smaller larger than that in G_obj, otherwise i0 is negative (but it's defined as unsigned int */
G_obj->header->wesn[XLO] -= 360.0; G_obj->header->wesn[XHI] -= 360.0;
}
}
j1 = (unsigned int)gmt_M_grd_y_to_row (GMT, S_obj->wesn[YLO]+dy, G_obj->header);
j0 = (unsigned int)gmt_M_grd_y_to_row (GMT, S_obj->wesn[YHI]-dy, G_obj->header);
Expand Down Expand Up @@ -6341,7 +6345,11 @@ GMT_LOCAL struct GMT_CUBE * gmtapi_import_cube (struct GMTAPI_CTRL *API, int obj
if (S_obj->wesn[XLO] > U_obj->header->wesn[XHI]) { /* Must first wrap U_obj->header->wesn west to fit the data */
U_obj->header->wesn[XLO] += 360.0; U_obj->header->wesn[XHI] += 360.0;
}
else if (S_obj->wesn[XHI] < U_obj->header->wesn[XLO]) { /* Must first wrap G_obj->header->wesn east to fit the data */
else if (S_obj->wesn[XHI] < U_obj->header->wesn[XLO]) { /* Must first wrap U_obj->header->wesn east to fit the data */
U_obj->header->wesn[XLO] -= 360.0; U_obj->header->wesn[XHI] -= 360.0;
}
if (S_obj->wesn[XLO] < U_obj->header->wesn[XLO]) {
/* Must wrap U_obj->header.wesn so the left bound in S_obj is smaller larger than that in U_obj, otherwise i0 is negative (but it's defined as unsigned int */
U_obj->header->wesn[XLO] -= 360.0; U_obj->header->wesn[XHI] -= 360.0;
}
}
Expand Down
Loading