Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finalize reduce.sh grdmath test #26

Closed
wants to merge 1 commit into from
Closed
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
Binary file added test/grdmath/1.grd
Binary file not shown.
Binary file added test/grdmath/2.grd
Binary file not shown.
Binary file added test/grdmath/3.grd
Binary file not shown.
4 changes: 4 additions & 0 deletions test/grdmath/gmt.history
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# GMT 6 Session common arguments shelf
BEGIN GMT 6.0.0
R 0/2/0/2
END
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's stacking mode -S for the allowable 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