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

gmedian.sh 1.7 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
25
26
27
28
29
30
31
32
33
  1. #!/usr/bin/env bash
  2. # Test that the grid option in blockmedian 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 6 outputs fail then the test fails, and
  5. # the file fail will indicate which one(s) caused the problem.
  6. gmt blockmedian @ship_15.txt -I1 -R-115/-105/20/30 -fg -E -o2:5 > dump.txt
  7. gmt blockmedian @ship_15.txt -I1 -R-115/-105/20/30 -fg -E -Gfield_%s.grd -Az,s,l,h
  8. gmt blockmedian @ship_15.txt -I1 -R-115/-105/20/30 -fg -Eb -o4,5 > qdump.txt
  9. gmt blockmedian @ship_15.txt -I1 -R-115/-105/20/30 -fg -Eb -Gfield_%s.grd -Aq25,q75
  10. # Median z:
  11. gmt grd2xyz field_z.grd -s -o2 > tmp
  12. z=$(gmt convert -A dump.txt tmp -o0,4 | awk '{print ($1-$2)/$1}' | gmt math STDIN -T -Sf ABS UPPER 1e-7 LT =)
  13. # L1 s:
  14. gmt grd2xyz field_s.grd -s -o2 > tmp
  15. s=$(gmt convert -A dump.txt tmp -o1,4 | awk '{print ($1-$2)/$1}' | gmt math STDIN -T -Sf ABS UPPER 1e-7 LT =)
  16. # l:
  17. gmt grd2xyz field_l.grd -s -o2 > tmp
  18. l=$(gmt convert -A dump.txt tmp -o2,4 | awk '{print ($1-$2)/$1}' | gmt math STDIN -T -Sf ABS UPPER 1e-7 LT =)
  19. # h:
  20. gmt grd2xyz field_h.grd -s -o2 > tmp
  21. h=$(gmt convert -A dump.txt tmp -o3,4 | awk '{print ($1-$2)/$1}' | gmt math STDIN -T -Sf ABS UPPER 1e-7 LT =)
  22. # 25% quartile:
  23. gmt grd2xyz field_q25.grd -s -o2 > tmp
  24. q25=$(gmt convert -A qdump.txt tmp -o0,2 | awk '{print ($1-$2)/$1}' | gmt math STDIN -T -Sf ABS UPPER 1e-7 LT =)
  25. # 75% quartile:
  26. gmt grd2xyz field_q75.grd -s -o2 > tmp
  27. q75=$(gmt convert -A qdump.txt tmp -o1,2 | awk '{print ($1-$2)/$1}' | gmt math STDIN -T -Sf ABS UPPER 1e-7 LT =)
  28. echo $z $s $l $q25 $q75 $h
  29. if [ ! "$z $s $l $q25 $q75 $h" = "1 1 1 1 1 1" ] ; then
  30. echo "$z $s $l $q25 $q75 $h" > fail
  31. fi
Tip!

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

Comments

Loading...