Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

gmean.sh 1.1 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  1. #!/usr/bin/env bash
  2. # Test that the grid option in blockmean matches the table output to ~EPS
  3. # If max fractional difference is < 1e-7 we assume it is good and write 1
  4. # else it is 0. If any of the 4 outputs fail then the test fails, and
  5. # the file fail will indicate which one(s) caused the problem.
  6. gmt blockmean @ship_15.txt -I1 -R-115/-105/20/30 -fg -E -o2:5 > dump.txt
  7. gmt blockmean @ship_15.txt -I1 -R-115/-105/20/30 -fg -E -Gfield_%s.grd -Az,s,l,h
  8. # Mean z:
  9. gmt grd2xyz field_z.grd -s -o2 > tmp
  10. z=$(gmt convert -A dump.txt tmp -o0,4 | awk '{print ($1-$2)/$1}' | gmt math STDIN -T -Sf ABS UPPER 1e-7 LT =)
  11. # s:
  12. gmt grd2xyz field_s.grd -s -o2 > tmp
  13. s=$(gmt convert -A dump.txt tmp -o1,4 | awk '{print ($1-$2)/$1}' | gmt math STDIN -T -Sf ABS UPPER 1e-7 LT =)
  14. # l:
  15. gmt grd2xyz field_l.grd -s -o2 > tmp
  16. l=$(gmt convert -A dump.txt tmp -o2,4 | awk '{print ($1-$2)/$1}' | gmt math STDIN -T -Sf ABS UPPER 1e-7 LT =)
  17. # h:
  18. gmt grd2xyz field_h.grd -s -o2 > tmp
  19. h=$(gmt convert -A dump.txt tmp -o3,4 | awk '{print ($1-$2)/$1}' | gmt math STDIN -T -Sf ABS UPPER 1e-7 LT =)
  20. echo $z $s $l $h
  21. if [ ! "$z $s $l $h" = "1 1 1 1" ] ; then
  22. echo "$z $s $l $h" > fail
  23. fi
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...