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

sphinout.sh 1.2 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
  1. #!/bin/bash
  2. # $Id$
  3. #
  4. # Test gmt grdmask for proper handling of inside/outside for spherical polygons
  5. ps=sphinout.ps
  6. # 2k.dat contains many repeat points but no point are integer lon,lat
  7. # hence, no node in the grid below lies exactly on the perimeter. We
  8. # therefore should only see read and green colors in the image.
  9. cat << EOF > mask.cpt
  10. -0.25 red 0.25 red ; OUTSIDE
  11. 0.25 yellow 0.75 yellow ; ON LINE
  12. 0.75 green 1.25 green ; INSIDE
  13. EOF
  14. gmt grdmask 2k.dat -Gmask.nc -N0/0.5/1 -I1 -Rg -fg -A
  15. gmt grdimage mask.nc -Jx0.015id -Cmask.cpt -Bx60 -By30 -BWSne -K -P -Xc -Y1.5i > $ps
  16. gmt psxy -Rmask.nc -J -O -K 2k.dat -W0.25p,blue >> $ps
  17. gmt psscale -Cmask.cpt -L0.1i -D2.7i/-0.5i+w3i/0.1i+h+jTC -O -K >> $ps
  18. gmt grdimage mask.nc -R295/345/59/82 -Jx0.108i -Cmask.cpt -B10g1 -BWSne -O -K -Y3.1i >> $ps
  19. gmt psxy -R -J -O -K 2k.dat -W0.5p,blue >> $ps
  20. # Now we truncate the coordinates to be all integers, meaning the mask grid
  21. # should have a yellow halo from all those nodes that lie on the perimeter.
  22. gmt gmtmath -T 2k.dat FLOOR = tmp.txt
  23. gmt grdmask -Gmask.nc -N0/0.5/1 -I1 -Rg -fg tmp.txt -A
  24. gmt grdimage mask.nc -R295/345/59/82 -Jx0.108i -Cmask.cpt -B10g1 -BWSne -O -K -Y2.9i >> $ps
  25. gmt psxy -R -J -O tmp.txt -W0.5p,blue >> $ps
Tip!

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

Comments

Loading...