grdcontour loss of annotation control

Added by John 8 months ago

This is a strange one. Say we have a nine-point grid (in a data set called tds1.txt) that looks like this:

-1 -1 7.654E-02
-1  0 7.619E-02
-1  1 7.648E-02
 0 -1 7.588E-02
 0  0 7.562E-02
 0  1 7.598E-02
 1 -1 7.626E-02
 1  0 7.602E-02
 1  1 7.638E-02

And we have a script that uses these, via surface (for the sake of illustration), to make a small grid. The script looks like this:

# topo_test - plots topography for a 3x3 region

indsn="tds1.txt" 

# map parameters
r_params=$(gmtinfo $indsn -Is0.1/0.1) # map parameters

# create small topo field based on running surface on input data, no tension
surface $indsn -Gtopo.grd -I0.01/0.01 $r_params -T0.00

# check topo ranges
csp=$(gmt grdinfo -C topo.grd | awk '{ print $7-$6 } ') # compute contour span
cmn=$(gmt gmtinfo -C -o4 $indsn) # minimum contour level
cmx=$(gmt gmtinfo -C -o5 $indsn) # maximum contour level
echo "  csp:" $csp "cmn:" $cmn "cmx:" $cmx

cnti=0.00002 # user set contour interval
cnta=$(echo "scale=10; $cnti*5" | bc) # annotate every fifth contour
echo "  annot:" $cnta "contour int:" $cnti

gmt gmtset MAP_GRID_CROSS_SIZE_PRIMARY=0i MAP_GRID_PEN_PRIMARY=0.125p,grey

psbasemap -JX6.5i/6.5i ${r_params} -Bxag -Byag -BWeSn -P -Y2.5i -K > t.ps

# plot observed topography
gmt grdcontour topo.grd -J -R -C${cnti} -A${cnta}+f4p \
  -Wa0.75p,rosybrown -Wc0.25p,rosybrown -Gd2i -O -K >> t.ps
gmt psxy $indsn -J -R -Sc0.05i -Gred -W0.1p -O -K >> t.ps # plot point locations in XY
gmt pstext $indsn -J -R -F+f8,0,red+jBL -D0.1i/-0.1i -O -K >> t.ps # plot input values

# plot text
echo "4.25 10.25 Contour Map of 3x3 Grid" | \
  gmt pstext -JX8.5i/11i -R0/8.5/0/11 -F+f14,1+jBC -X-1i -Y-2.5i -O -K >> t.ps
echo "0.1 0.1 Map made by script: topo_test" | gmt pstext -J -R -F+f9,2+jBL -O >> t.ps

So here is the question: Note that in the script, I've declared the contour interval and computed every fifth contour to be annotated. But grdcontour insists on making EVERY contour an annotation contour line. Not what was specified nor expected (output attached).

Is there an issue with small z-values? Raising z-values by 10 and 100 works just fine (after re-scaling the contour interval accordingly).

t.pdf (44 KB)


Replies (3)

RE: grdcontour loss of annotation control - Added by Paul 8 months ago

Can confirm but busy writing proposal...

RE: grdcontour loss of annotation control - Added by John 8 months ago

Thanks Paul, for confirming. I thought I was going nuts! Good luck on the proposal! Please let me know when a fix has been made. Thanks!

(1-3/3)