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