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

inoutgrid.sh 738 B

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
  1. #!/usr/bin/env bash
  2. # Test gmtselect with points inside or outside a grid
  3. ps=inoutgrid.ps
  4. gmt xyz2grd -R0/5/0/5 -I1 -r -Gmask.nc << EOF
  5. 0.5 0.5 1
  6. 1.5 0.5 1
  7. 2.5 0.5 1
  8. 3.5 0.5 1
  9. 0.5 1.5 1
  10. 1.5 1.5 1
  11. 3.5 1.5 1
  12. 0.5 2.5 1
  13. 1.5 2.5 1
  14. 2.5 2.5 1
  15. 3.5 2.5 1
  16. 3.5 3.5 1
  17. EOF
  18. # Created the test data via RAND then saved
  19. #gmt math -T0/25/1 -C0 0 5 RAND -C1 0 5 RAND ADD = locations.txt
  20. echo 0 pink 1 pink > t.cpt
  21. # Get what gmtselect lets through
  22. gmt select @locations.txt -Gmask.nc > in.txt
  23. gmt select @locations.txt -Gmask.nc -Ig > out.txt
  24. gmt grdimage mask.nc -JX6i -P -Bafg1 -Ct.cpt -Q -K > $ps
  25. # Lay down inside points
  26. gmt psxy -Rmask.nc -J -O -K in.txt -Sc0.1i -Gwhite -W0.25p >> $ps
  27. gmt psxy -Rmask.nc -J -O out.txt -Sc0.1i -Gblack -W0.25p >> $ps
Tip!

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

Comments

Loading...