Skip to content

Commit

Permalink
Dateline crossing dcw polygons and tiles (#8318)
Browse files Browse the repository at this point in the history
* Fix -R for the 3 dateline-crossing countries

For odd reasons, the US, Russia and Fiji all cross the 180-meridian and yield idiotic west/east limits like 172.436/-66.9489, resulting in no plots for commands like

gmt grdimage @earth_relief_05m -B -RUS -png USA -Vi

This PR checks for this cse and now gives sensible continuous longitudes.

* Create dcw-180-crossers.sh

Add test script for the three 180-meridian DCW polygons USA, Russia, and Fiji.

* Update PS

---------

Co-authored-by: Federico Esteban <[email protected]>
  • Loading branch information
PaulWessel and Esteban82 authored Jan 22, 2024
1 parent 3fb344e commit 5c0821b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/gmt_dcw.c
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,9 @@ struct GMT_DATASET * gmt_DCW_operation (struct GMT_CTRL *GMT, struct GMT_DCW_SEL
wesn[XLO] = 0.0;
wesn[XHI] = 360.0;
}
/* US DCW can return dumb things like this: -R172.436/-66.9489 */
if (wesn[XLO] > 0.0 && wesn[XHI] < 0.0) /* Crazy US, RU, and Fiji crossing dateline and get backwards limit signs... */
wesn[XHI] += 360.0;
GMT_Report (GMT->parent, GMT_MSG_INFORMATION, "Region implied by DCW polygons is %g/%g/%g/%g\n", wesn[XLO], wesn[XHI], wesn[YLO], wesn[YHI]);
}
gmt_M_free (GMT, order);
Expand Down
4 changes: 2 additions & 2 deletions test/baseline/grdimage.dvc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
outs:
- md5: 226f00f8bb56bfda27786069c3ecfa19.dir
nfiles: 35
- md5: 852cd5e3aed9292b7f864d0a18d207fc.dir
nfiles: 36
path: grdimage
hash: md5
9 changes: 9 additions & 0 deletions test/grdimage/dcw-180-crossers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
# Ensure that the region for the US, Russia and Fiji are sensible
# when accessing tiles, i.e., 5m and higher resolutions.
# and that maps are made. Issue only affects tiles.
gmt begin dcw-180-crossers ps
gmt grdimage @earth_relief_05m -Bafg180 -RUS
gmt grdimage @earth_relief_05m -Bafg180 -RRU -Y7.5c
gmt grdimage @earth_relief_05m -Bafg180 -RFJ -Y4.5c
gmt end show

0 comments on commit 5c0821b

Please sign in to comment.