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

Fix the reduce.sh test for grdmath #27

Merged
merged 1 commit into from
Aug 20, 2018
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
Fix the reduce.sh test for grdmath
Create input on the fly and update the PS.
  • Loading branch information
PaulWessel committed Aug 20, 2018
commit fa3f7eb86dc863640fb5180848b2fd82769b3544
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