Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions src/gmt_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -2683,6 +2683,7 @@ GMT_LOCAL uint64_t gmtsupport_trace_contour (struct GMT_CTRL *GMT, struct GMT_GR
if (n_exits == 0) { /* We have hit a field of NaNs, finish contour */
more = false;
*nan_flag = n_nan;
if (n_nan == 0 && GMT->current.map.z_periodic) *nan_flag = 1; /* Dead end at a phase singularity, so also trace the other way */
continue;
}
else if (n_exits == 3) { /* Saddle point: Turn to the correct side */
Expand Down Expand Up @@ -2713,6 +2714,10 @@ GMT_LOCAL uint64_t gmtsupport_trace_contour (struct GMT_CTRL *GMT, struct GMT_GR
ij0 = gmt_M_ij0 (G->header, row + d_row[side], col + d_col[side]); /* Non-padded index used for edge array */
edge_word = (unsigned int)(ij0 / 32 + d_side[side] * offset);
edge_bit = (unsigned int)(ij0 % 32);
if (!test && (edge[edge_word] & bit[edge_bit])) { /* Ran into an already traced contour */
more = false;
continue;
}
edge[edge_word] |= bit[edge_bit];

if ((side == 0 && row == G->header->n_rows - 1) || (side == 2 && row == 1)) { /* Going out of grid at N or S */
Expand Down
3 changes: 2 additions & 1 deletion test/baseline/grdcontour.dvc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
outs:
- md5: aceec929e8ab2a939a5cfacf0dbf3b4c.dir
- md5: 086ead5b15b5bca2ca31537f94ccf4bf.dir
nfiles: 23
path: grdcontour
hash: md5
size: 3965721
10 changes: 2 additions & 8 deletions test/grdcontour/periodic.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
#!/usr/bin/env bash
# GMT_KNOWN_FAILURE
# Update 2020/08/11 PW: Currently, the problem with this script is this:
# When plotting with -Zp, the top plot is mostly OK but the labels for 140 and 160
# degrees have contours cutting right through them. The bottom plot without -Zp
# plots as expected. I added the debug drawing of the helper lines in red, which
# required the C-code changes to allow a debug pen.
# Test contouring of phase data with and without -Z+p
ps=periodic.ps
gmt grdmath -Rg -I1 32 22 SBAZ = t.nc
# Plot as non-periodic. This plots labels. The pile of blue contours around
# 180 occurs because the grid goes rapidly from -180 to +180 here and -Z+p is not used
# This is expected and correct.
gmt grdcontour t.nc -JG0/0/5.0i -A20+u@.+d0.75p,red -Bgaf -K -Wa1,blue -Gl-90/0/0/0,0/0/90/0 -P -Xc -Y0.3i > $ps
# Plot as periodic with -Zp. Transition from -180 to +180 goes well for contouring
# but lon 140, 160 has labels overdrawn by contour. This is the main issue here.
# Plot as periodic with -Z+p. Transition from -180 to +180 goes well for contouring
gmt grdcontour t.nc -J -A20+u@.+d0.75p,red -Wa1,blue -Bgaf -Gl-90/0/0/0,0/0/90/0 -Z+p -O -Y5.2i >> $ps
Loading