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

selectlines.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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
  1. #!/usr/bin/env bash
  2. # Deal with gmtselect action on lines
  3. ps=selectlines.ps
  4. cat << EOF > lines.txt
  5. > This line is inside
  6. 1 1
  7. 2 2
  8. 1 3
  9. > This line is entirely outside
  10. -5 -2
  11. -4 -1
  12. -3 0
  13. > This line crosses boundary
  14. -2 -2
  15. 1 0.5
  16. 2 1
  17. > This also crosses boundary
  18. 5 3
  19. 3 2
  20. 2 3
  21. EOF
  22. cat << EOF > pol.txt
  23. 0 0
  24. 4 0
  25. 4 4
  26. 0 4
  27. EOF
  28. # Get what gmtselect lets through
  29. gmt select -R0/4/0/4 lines.txt > tmp.txt
  30. # Lay down lines and nodes
  31. gmt psxy -R-5/5/-3/5 -Jx0.5i -P -Xc -Baf -W2p -K lines.txt > $ps
  32. gmt psxy -R -J -O -K -Sc0.2i lines.txt -N >> $ps
  33. gmt psxy -R -J -O -K -W2p,green tmp.txt >> $ps
  34. gmt psxy -R -J -O -K -Sc0.1i -Ggreen tmp.txt >> $ps
  35. gmt psxy -R -J -O -K -L -W0.25p,- pol.txt >> $ps
  36. echo -5 5 "gmtselect -R" | gmt pstext -R -J -O -K -F+f12p+jLT -Dj0.1i >> $ps
  37. # Same with gmtspatial
  38. gmt psxy -R -J -O -Y4.75i -Baf -W2p -K lines.txt >> $ps
  39. gmt psxy -R -J -O -K -Sc0.2i lines.txt -N >> $ps
  40. gmt spatial -R -Fl -Tpol.txt lines.txt > tmp.txt
  41. gmt psxy -R -J -O -K -W2p,green tmp.txt >> $ps
  42. gmt psxy -R -J -O -K -Sc0.1i -Ggreen tmp.txt >> $ps
  43. gmt psxy -R -J -O -K -L -W0.25p,- pol.txt >> $ps
  44. echo -5 5 "gmtspatial -Fl -T" | gmt pstext -R -J -O -F+f12p+jLT -Dj0.1i >> $ps
Tip!

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

Comments

Loading...