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

sphdistance.rst 5.0 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
  1. .. index:: ! sphdistance
  2. .. include:: module_core_purpose.rst_
  3. ***********
  4. sphdistance
  5. ***********
  6. |sphdistance_purpose|
  7. Synopsis
  8. --------
  9. .. include:: common_SYN_OPTs.rst_
  10. **gmt sphdistance** [ *table* ] |-G|\ *grdfile*
  11. [ |-C| ]
  12. [ |-E|\ **d**\|\ **n**\|\ **z**\ [*dist*] ]
  13. [ |SYN_OPT-I| ]
  14. [ |-L|\ *unit* ]
  15. [ |-N|\ *nodetable* ]
  16. [ |-Q|\ *voronoi.txt* ]
  17. [ |SYN_OPT-R| ]
  18. [ |SYN_OPT-V| ]
  19. [ |SYN_OPT-b| ]
  20. [ |SYN_OPT-d| ]
  21. [ |SYN_OPT-e| ]
  22. [ |SYN_OPT-h| ]
  23. [ |SYN_OPT-i| ]
  24. [ |SYN_OPT-j| ]
  25. [ |SYN_OPT-qi| ]
  26. [ |SYN_OPT-r| ]
  27. [ |SYN_OPT-:| ]
  28. [ |SYN_OPT--| ]
  29. |No-spaces|
  30. Description
  31. -----------
  32. **sphdistance** reads one or more ASCII [or binary] files (or standard
  33. input) containing lon, lat and performs the construction of Voronoi
  34. polygons. These polygons are then processed to calculate the nearest
  35. distance to each node of the lattice and written to the specified grid.
  36. The Voronoi algorithm used is STRIPACK. As an option, you may provide
  37. pre-calculated Voronoi polygon file in the format written by
  38. :doc:`sphtriangulate`, thus bypassing the memory- and time-consuming
  39. triangularization.
  40. Required Arguments
  41. ------------------
  42. .. _-G:
  43. **-G**\ *grdfile*
  44. Name of the output grid to hold the computed distances (but see **-E**
  45. for other node value options).
  46. Optional Arguments
  47. ------------------
  48. .. |Add_intables| unicode:: 0x20 .. just an invisible code
  49. .. include:: explain_intables.rst_
  50. .. _-C:
  51. **-C**
  52. For large data sets you can save some memory (at the expense of more
  53. processing) by only storing one form of location coordinates
  54. (geographic or Cartesian 3-D vectors) at any given time, translating
  55. from one form to the other when necessary [Default keeps both arrays
  56. in memory]. Not applicable with **-Q**.
  57. .. _-E:
  58. **-Ed**\|\ **n**\|\ **z**\ [*dist*]
  59. Specify the quantity that should be assigned to the grid nodes. By
  60. default we compute distances to the nearest data point [**-Ed**].
  61. Use **-En** to assign the ID numbers of the Voronoi polygons that each
  62. grid node is inside, or use **-Ez** for a natural nearest-neighbor grid where
  63. we assign all nodes inside the polygon the z-value of the center node.
  64. Optionally, append the resampling interval along Voronoi arcs in spherical
  65. degrees [1].
  66. .. _-I:
  67. .. include:: explain_-I.rst_
  68. .. _-L:
  69. **-L**\ *unit*
  70. Specify the unit used for distance calculations. Choose among **d**
  71. (spherical degree), **e** (m), **f** (feet), **k** (km), **M**
  72. (mile), **n** (nautical mile) or **u** survey foot.
  73. .. _-N:
  74. **-N**\ *nodetable*
  75. Read the information pertaining to each Voronoi
  76. polygon (the unique node lon, lat and polygon area) from a separate
  77. file [Default acquires this information from the ASCII segment
  78. headers of the output file]. Required if binary input via **-Q** is used.
  79. .. _-Q:
  80. **-Q**\ *voronoi.txt*
  81. Append the name of a file with pre-calculated Voronoi polygons
  82. [Default performs the Voronoi construction on input data]. For
  83. binary data **-bi** you must specify the node
  84. information separately (via **-N**).
  85. .. _-R:
  86. .. |Add_-Rgeo| unicode:: 0x20 .. just an invisible code
  87. .. include:: explain_-Rgeo.rst_
  88. .. _-V:
  89. .. |Add_-V| unicode:: 0x20 .. just an invisible code
  90. .. include:: explain_-V.rst_
  91. .. |Add_-bi| replace:: [Default is 2 input columns].
  92. .. include:: explain_-bi.rst_
  93. .. |Add_-bo| replace:: [Default is same as input].
  94. .. include:: explain_-bo.rst_
  95. .. |Add_-d| unicode:: 0x20 .. just an invisible code
  96. .. include:: explain_-d.rst_
  97. .. |Add_-e| unicode:: 0x20 .. just an invisible code
  98. .. include:: explain_-e.rst_
  99. .. |Add_-h| unicode:: 0x20 .. just an invisible code
  100. .. include:: explain_-h.rst_
  101. .. include:: explain_-icols.rst_
  102. .. include:: explain_-qi.rst_
  103. .. include:: explain_distcalc.rst_
  104. .. |Add_nodereg| unicode:: 0x20 .. just an invisible code
  105. .. include:: explain_nodereg.rst_
  106. .. include:: explain_colon.rst_
  107. .. include:: explain_help.rst_
  108. .. include:: explain_precision.rst_
  109. .. include:: explain_float.rst_
  110. Examples
  111. --------
  112. .. include:: explain_example.rst_
  113. To compute a distance grid of the distances between a set of points in the
  114. remote file hotspots.txt and then contour them on a sphere with a 200 km interval
  115. and annotations every 1000 km, try::
  116. gmt begin map
  117. gmt sphtriangulate @hotspots.txt -Qv -D > t.txt
  118. gmt sphdistance -Rg -I1 -Qt.txt -Gt.nc -Lk
  119. gmt grdcontour t.nc -JG-140/30/7i -C200 -A1000 -Bafg
  120. gmt end show
  121. To construct Voronoi polygons from the points in the file testdata.txt
  122. and then calculate distances from the data to a global 1x1 degree grid, use
  123. ::
  124. gmt sphdistance testdata.txt -Rg -I1 -Gglobedist.nc
  125. To generate the same grid in two steps using :doc:`sphtriangulate` separately, try
  126. ::
  127. gmt sphtriangulate testdata.txt -Qv > voronoi.txt
  128. gmt sphdistance -Qvoronoi.txt -Rg -I1 -Gglobedist.nc
  129. See Also
  130. --------
  131. :doc:`gmt`,
  132. :doc:`sphtriangulate`,
  133. :doc:`triangulate`
  134. References
  135. ----------
  136. Renka, R, J., 1997, Algorithm 772: STRIPACK: Delaunay Triangulation and
  137. Voronoi Diagram on the Surface of a Sphere, *AMC Trans. Math. Software*,
  138. **23**\ (3), 416-434.
Tip!

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

Comments

Loading...