Skip to content

Commit

Permalink
Fix the reduce.sh test for grdmath (#27)
Browse files Browse the repository at this point in the history
Create input on the fly instead of storing small grids, remove psconvert and open statements, and update the PS file after running the test.
  • Loading branch information
PaulWessel authored and joa-quim committed Aug 20, 2018
1 parent 01f8b1f commit e805171
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
Binary file modified test/grdmath/reduce.ps
Binary file not shown.
30 changes: 20 additions & 10 deletions test/grdmath/reduce.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
#!/bin/bash
# $Id$
# Test grdmath stacking mode -S for available operators
ps=reduce.ps
gmt set PS_MEDIA letter MAP_TITLE_OFFSET 4p FONT_TITLE 12p
# Create 3 small grids with integers in 0-100 range
gmt grdmath -R0/2/0/2 -I1 -r 0 100 RAND RINT = 1.grd
gmt grdmath -R0/2/0/2 -I1 -r 0 100 RAND RINT = 2.grd
gmt grdmath -R0/2/0/2 -I1 -r 0 100 RAND RINT = 3.grd

cat << EOF | gmt xyz2grd -R0/2/0/2 -I1 -r -Z -G1.grd
43
31
82
82
EOF
cat << EOF | gmt xyz2grd -R0/2/0/2 -I1 -r -Z -G2.grd
96
74
78
79
EOF
cat << EOF | gmt xyz2grd -R0/2/0/2 -I1 -r -Z -G3.grd
77
71
2
48
EOF
# Plot the three grids on top
gmt grd2xyz 1.grd | gmt pstext -R0/2/0/2 -JX1.75i -P -B0g1 -B+t1 -K -Y8.5i -F+f18p+jCM > $ps
gmt grd2xyz 2.grd | gmt pstext -R -J -O -K -B0g1 -B+t2 -X2.25i -F+f18p+jCM >> $ps
Expand Down Expand Up @@ -38,8 +52,4 @@ gmt grd2xyz tmp.grd | gmt pstext -R -J -O -B0g1 -B+tADD -K -Y-2i -X-4.5i -F+f18p
gmt grdmath [123].grd -S SUB = tmp.grd
gmt grd2xyz tmp.grd | gmt pstext -R -J -O -K -B0g1 -B+tSUB -X2.25i -F+f18p+jCM+z%0.1f >> $ps
gmt grdmath [123].grd -S AND = tmp.grd
gmt grd2xyz tmp.grd | gmt pstext -R -J -O -K -B0g1 -B+tAND -X2.25i -F+f18p+jCM+z%0.1f >> $ps

gmt psxy -R -J -O -T >> $ps
gmt psconvert -Tf $ps -P
open reduce.pdf
gmt grd2xyz tmp.grd | gmt pstext -R -J -O -B0g1 -B+tAND -X2.25i -F+f18p+jCM+z%0.1f >> $ps

0 comments on commit e805171

Please sign in to comment.