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

oblmerc_down.sh 3.4 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
  1. #!/usr/bin/env bash
  2. #
  3. # GMT_KNOWN_FAILURE_WINDOWS
  4. #
  5. # Tests mapproject for oblique Mercator -R-20/40/-15/65r -Joa-30/60/-75/1:30000000
  6. # This should be upside down
  7. gmt set MAP_ANNOT_OBLIQUE separate FORMAT_GEO_MAP dddF
  8. ps=oblmerc_down.ps
  9. lon=-30
  10. lat=60
  11. az_x=-75
  12. az_y=$(gmt math -Q $az_x 90 SUB =)
  13. plon=$(gmt vector -A$lon/$lat -Tp$az_x} | cut -f1)
  14. plat=$(gmt vector -A$lon/$lat -Tp$az_x} | cut -f2)
  15. scale=1:30000000
  16. scale_km=1:30000
  17. LL_lon=-56
  18. LL_lat=51
  19. UR_lon=20
  20. UR_lat=50
  21. # Find gmt projected coordinates of LL and UR points in desired gmt projection
  22. echo $LL_lon $LL_lat | gmt mapproject -C -R$LL_lon/$LL_lat/$UR_lon/${UR_lat}r -Joa${lon}/${lat}/${az_x}/$scale -Fk >tmp
  23. LL_x=$(cut -f1 tmp)
  24. LL_y=$(cut -f2 tmp)
  25. echo $UR_lon $UR_lat | gmt mapproject -C -R$LL_lon/$LL_lat/$UR_lon/${UR_lat}r -Joa${lon}/${lat}/${az_x}/$scale -Fk >tmp
  26. UR_x=$(cut -f1 tmp)
  27. UR_y=$(cut -f2 tmp)
  28. # Create rectangle in these gmt projected units
  29. xstart=$(gmt math -Q $LL_x $UR_x MIN =)
  30. xstop=$(gmt math -Q $LL_x $UR_x MAX =)
  31. ystart=$(gmt math -Q $LL_y $UR_y MIN =)
  32. ystop=$(gmt math -Q $LL_y $UR_y MAX =)
  33. gmt math -T$xstart/$xstop/101+n $LL_y = > box.xy
  34. gmt math -o1,0 -T$ystart/$ystop/101+n $UR_x = >> box.xy
  35. gmt math -I -T$xstart/$xstop/101+n $UR_y = >> box.xy
  36. gmt math -I -o1,0 -T$ystart/$ystop/101+n $LL_x = >> box.xy
  37. # Get back degrees
  38. gmt mapproject -C -R$LL_lon/$LL_lat/$UR_lon/${UR_lat}r -Joa${lon}/${lat}/${az_x}/$scale -Fk -I box.xy > box.d
  39. # Use -Joa to set origin and azimuth.
  40. gmt psxy -Rg -JG-30/30/6i -Bafg30 box.d -Glightgreen -W0.5p -P -K -Xc -Y4.25i > $ps
  41. gmt psbasemap -R -J -Bafg30 -B+o${plon}/${plat} -O -K --MAP_GRID_PEN_PRIMARY=0.25p,. >> $ps
  42. echo $lon $lat 0 200 200 | gmt psxy -R -J -O -K -SE -Gblack >> $ps
  43. gmt project -C$lon/$lat -G25 -A$az_x -L-20000/20000 -Q | gmt psxy -R -J -O -K -W0.5p,blue >> $ps
  44. gmt project -C$lon/$lat -G25 -A$az_y -L-20000/20000 -Q | gmt psxy -R -J -O -K -W0.5p,blue >> $ps
  45. echo $lon $lat $az_x 1000 | gmt psxy -R -J -O -K -S=0.1i+e+h0.5 -Gred -W0.5p,red >> $ps
  46. echo $lon $lat $az_y 1000 | gmt psxy -R -J -O -K -S=0.1i+e+h0.5 -Gred -W0.5p,red >> $ps
  47. echo $plon $plat 0 200 200 | gmt psxy -R -J -O -K -SE -Gred >> $ps
  48. gmt pstext -R -J -O -K -F+f12p+j -Dj0.1i << EOF >> $ps
  49. -42 63 CM x
  50. -29 53 CM y
  51. $plon $plat LB P
  52. $LL_lon $LL_lat RB LL
  53. $UR_lon $UR_lat TL UR
  54. EOF
  55. echo $LL_lon $LL_lat 0 150 150 | gmt psxy -R -J -O -K -SE -Gblue >> $ps
  56. echo $UR_lon $UR_lat 0 150 150 | gmt psxy -R -J -O -K -SE -Gblue >> $ps
  57. #
  58. gmt psbasemap -R$LL_lon/$LL_lat/$UR_lon/${UR_lat}r -Joa${lon}/${lat}/${az_x}/$scale -O -K -Bafg -BWS+glightgreen -Y-3.5i >> $ps
  59. gmt project -C$lon/$lat -G25 -A$az_x -L-20000/20000 -Q | gmt psxy -R -J -O -K -W0.5p,blue >> $ps
  60. gmt project -C$lon/$lat -G25 -A$az_y -L-2000/2000 -Q | gmt psxy -R -J -O -K -W0.5p,blue >> $ps
  61. echo $lon $lat 0 100 100 | gmt psxy -R -J -O -K -SE -Gblack >> $ps
  62. echo $lon $lat $az_x 1000 | gmt psxy -R -J -O -K -S=0.15i+e+h0.5 -Gred -W1p,red >> $ps
  63. echo $lon $lat $az_y 1000 | gmt psxy -R -J -O -K -S=0.15i+e+h0.5 -Gred -W1p,red >> $ps
  64. echo $LL_lon $LL_lat 0 150 150 | gmt psxy -R -J -O -K -SE -Gblue >> $ps
  65. echo $UR_lon $UR_lat 0 150 150 | gmt psxy -R -J -O -K -SE -Gblue >> $ps
  66. gmt pstext -R -J -O -K -F+f12p+j -Dj0.1i -N << EOF >> $ps
  67. -42 62 CM x
  68. -31 52 CM y
  69. $LL_lon $LL_lat RB LL
  70. $UR_lon $UR_lat TL UR
  71. EOF
  72. gmt psbasemap -R$LL_x/$LL_y/$UR_x/${UR_y}r -Jx$scale_km -O -K -Bafg -BNE --MAP_GRID_PEN_PRIMARY=0.25p,. >> $ps
  73. echo "0 9.5 az = $az_x" | gmt pstext -R0/8/0/10 -Jx1i -O -F+f24p+jTL >> $ps
Tip!

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

Comments

Loading...