Skip to content
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: 5 additions & 3 deletions src/gmt_grdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -2236,7 +2236,7 @@ void gmt_grd_init (struct GMT_CTRL *GMT, struct GMT_GRID_HEADER *header, struct
}
}

void gmt_grd_shift (struct GMT_CTRL *GMT, struct GMT_GRID *G, double shift) {
void gmt_grd_shift(struct GMT_CTRL *GMT, struct GMT_GRID *G, double shift) {
/* Rotate geographical, global grid in e-w direction
* This function will shift a grid by shift degrees.
* It is only called when we know the grid is geographic. */
Expand Down Expand Up @@ -2266,8 +2266,10 @@ void gmt_grd_shift (struct GMT_CTRL *GMT, struct GMT_GRID *G, double shift) {
G->header->wesn[XHI] += 360.0;
}
else if (G->header->wesn[XHI] > 360.0) {
G->header->wesn[XLO] -= 360.0;
G->header->wesn[XHI] -= 360.0;
while (G->header->wesn[XHI] > 360.0) { /* Make sure we are in the range [0,360] */
G->header->wesn[XLO] -= 180.0;
G->header->wesn[XHI] -= 180.0;
}
}

gridline = (width < (int)G->header->n_columns); /* Gridline-registrered grids will have width = n_columns-1, pixel grids have width = n_columns */
Expand Down
Loading