Skip to content

Commit

Permalink
Make sure projected region handles periodic boundaries (#5181)
Browse files Browse the repository at this point in the history
* Make sure projected region handles periodic boundaries

See #5180.  Problem was that when we search along the grid perimeter we will fail when there are periodic boundaries and the w/e of the grid do not coincide with them.

* Update grdimage.c
  • Loading branch information
PaulWessel authored Apr 29, 2021
1 parent a6980cb commit db23c0d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/grdimage.c
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,12 @@ GMT_LOCAL void grdimage_set_proj_limits (struct GMT_CTRL *GMT, struct GMT_GRID_H
if (all_lats) { /* Full -90/+90, use min/max for y */
r->wesn[YLO] = GMT->current.proj.rect[YLO]; r->wesn[YHI] = GMT->current.proj.rect[YHI];
}
if (GMT->current.map.is_world && gmt_M_is_periodic (GMT)) { /* Worry about grids crossing a periodic boundary as the search above may fail */
if (g->wesn[XLO] < (GMT->current.proj.central_meridian+180) && g->wesn[XHI] > (GMT->current.proj.central_meridian+180))
r->wesn[XLO] = GMT->current.proj.rect[XLO], r->wesn[XHI] = GMT->current.proj.rect[XHI];
else if (g->wesn[XLO] < (GMT->current.proj.central_meridian-180) && g->wesn[XHI] > (GMT->current.proj.central_meridian-180))
r->wesn[XLO] = GMT->current.proj.rect[XLO], r->wesn[XHI] = GMT->current.proj.rect[XHI];
}
}
else if (gmt_M_x_is_lon (GMT, GMT_IN)) { /* Extra check for non-projected longitudes that wrap */
double x1;
Expand Down

0 comments on commit db23c0d

Please sign in to comment.