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

clipping8.sh 2.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
  1. #!/usr/bin/env bash
  2. # Shows the essence of issue # 949. The problem is related
  3. # to the test in gmt_map.c in map_wesn_clip near #L1738.
  4. # That section finds that one end of the badpol.txt polygon
  5. # is > 180 degrees away and subtracts 360, thus creating
  6. # another polygon that does cross the border, leading to
  7. # the long-way polygon entering into the mix.
  8. ps=clipping8.ps
  9. generate=0 # When 1 this fake-generates the correct solution to give PS to check against
  10. cat << EOF > badpol.txt
  11. 90 -10
  12. 130 -10
  13. 130 +10
  14. 90 +10
  15. EOF
  16. scl=`gmt math -Q 6 360 DIV =`
  17. xa=`gmt math -Q 96 -110 SUB $scl MUL =`
  18. xb=`gmt math -Q 130 -110 SUB $scl MUL =`
  19. gmt psxy -R-120/160/0/9 -Jx${scl}i/1i -P -K -W0.25p,- -X1.5i << EOF > $ps
  20. >
  21. 90 0
  22. 90 9
  23. >
  24. 130 0
  25. 130 9
  26. EOF
  27. x=`gmt math -Q $scl 10 MUL =`
  28. gmt psxy -R-120/80/-15/+15 -Jm${scl}i -Gred badpol.txt -Baf -BWSne -A -O -K >> $ps
  29. gmt psxy -R-110/90/-15/+15 -Jm${scl}i -Gred badpol.txt -Baf -BWSne -A -O -K -X${x}i -Y0.95i >> $ps
  30. if [ $generate -eq 1 ]; then
  31. gmt psxy -R-100/100/-15/+15 -Jm${scl}i -Gred -Baf -BWSne -A -O -K -X${x}i -Y0.95i <<- EOF >> $ps
  32. 90 -10
  33. 100 -10
  34. 100 10
  35. 90 10
  36. EOF
  37. gmt psxy -R-90/110/-15/+15 -Jm${scl}i -Gred -Baf -BWSne -A -O -K -X${x}i -Y0.95i <<- EOF >> $ps
  38. 90 -10
  39. 110 -10
  40. 110 10
  41. 90 10
  42. EOF
  43. gmt psxy -R-80/120/-15/+15 -Jm${scl}i -Gred -Baf -BWSne -A -O -K -X${x}i -Y0.95i <<- EOF >> $ps
  44. 90 -10
  45. 120 -10
  46. 120 10
  47. 90 10
  48. EOF
  49. else
  50. gmt psxy -R-100/100/-15/+15 -Jm${scl}i -Gred badpol.txt -Baf -BWSne -A -O -K -X${x}i -Y0.95i >> $ps
  51. gmt psxy -R-90/110/-15/+15 -Jm${scl}i -Gred badpol.txt -Baf -BWSne -A -O -K -X${x}i -Y0.95i >> $ps
  52. gmt psxy -R-80/120/-15/+15 -Jm${scl}i -Gred badpol.txt -Baf -BWSne -A -O -K -X${x}i -Y0.95i >> $ps
  53. fi
  54. gmt psxy -R-70/130/-15/+15 -Jm${scl}i -Gred badpol.txt -Baf -BWSne -A -O -K -X${x}i -Y0.95i >> $ps
  55. gmt psxy -R-60/140/-15/+15 -Jm${scl}i -Gred badpol.txt -Baf -BWSne -A -O -K -X${x}i -Y0.95i >> $ps
  56. gmt psxy -R-50/150/-15/+15 -Jm${scl}i -Gred badpol.txt -Baf -BWSne -A -O -K -X${x}i -Y0.95i >> $ps
  57. gmt psxy -R-40/160/-15/+15 -Jm${scl}i -Gred badpol.txt -Baf -BWSne -A -O -K -X${x}i -Y0.95i >> $ps
  58. gmt psxy -R-30/170/-15/+15 -Jm${scl}i -Gred badpol.txt -Baf -BWSne -A -O -X${x}i -Y0.95i >> $ps
Tip!

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

Comments

Loading...