Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add grd2xyz option -L to limit output to a single vector (#5705)
* Add grd2xyz option -L to limit output to a single vector This need comes up all the time and over the years we have done piping via awk, grdtrack -W and probalby other acrobatics. Now, -Lc|r|x|yvalue handles it directly. * Add simple test * Add to usage and synopsis * Update grd2xyz.c * Clarify columns and rows vs y and x
- Loading branch information
1 parent
8f3d4ff
commit 13d526c
Showing
3 changed files
with
133 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env bash | ||
# Testing gmt grd2xyz with -L | ||
# The answer.txt file has been vetted by eye | ||
|
||
cat << EOF > answer.txt | ||
20 50 1000 | ||
20 40 800 | ||
20 30 600 | ||
20 20 400 | ||
20 10 200 | ||
20 0 0 | ||
20 50 1000 | ||
20 40 800 | ||
20 30 600 | ||
20 20 400 | ||
20 10 200 | ||
20 0 0 | ||
0 30 0 | ||
10 30 300 | ||
20 30 600 | ||
30 30 900 | ||
40 30 1200 | ||
50 30 1500 | ||
0 30 0 | ||
10 30 300 | ||
20 30 600 | ||
30 30 900 | ||
40 30 1200 | ||
50 30 1500 | ||
EOF | ||
gmt grdmath -R0/50/0/50 -I10 X Y MUL = tmp.grd | ||
gmt grd2xyz tmp.grd -Lc2 > result.txt | ||
gmt grd2xyz tmp.grd -Lx20 >> result.txt | ||
gmt grd2xyz tmp.grd -Lr2 >> result.txt | ||
gmt grd2xyz tmp.grd -Ly30 >> result.txt | ||
diff answer.txt result.txt --strip-trailing-cr > fail |