Skip to content

Commit 53f3677

Browse files
committed
Fix error in indexing for matrix-to-grid input
1 parent 1c8a78b commit 53f3677

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/gmt_api.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5522,6 +5522,10 @@ GMT_LOCAL struct GMT_GRID *gmtapi_import_grid (struct GMTAPI_CTRL *API, int obje
55225522
else if (S_obj->wesn[XHI] < G_obj->header->wesn[XLO]) { /* Must first wrap G_obj->header->wesn east to fit the data */
55235523
G_obj->header->wesn[XLO] -= 360.0; G_obj->header->wesn[XHI] -= 360.0;
55245524
}
5525+
5526+
if (S_obj->wesn[XLO] < G_obj->header->wesn[XLO]) { /* Must wrap G_obj->header.wesn so that west to fit the data */
5527+
G_obj->header->wesn[XLO] -= 360.0; G_obj->header->wesn[XHI] -= 360.0;
5528+
}
55255529
}
55265530
j1 = (unsigned int)gmt_M_grd_y_to_row (GMT, S_obj->wesn[YLO]+dy, G_obj->header);
55275531
j0 = (unsigned int)gmt_M_grd_y_to_row (GMT, S_obj->wesn[YHI]-dy, G_obj->header);

0 commit comments

Comments
 (0)