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

surface.rst 13 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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
  1. .. index:: ! surface
  2. .. include:: module_core_purpose.rst_
  3. *******
  4. surface
  5. *******
  6. |surface_purpose|
  7. Synopsis
  8. --------
  9. .. include:: common_SYN_OPTs.rst_
  10. **gmt surface** [ *table* ] |-G|\ *outputfile.nc*
  11. |SYN_OPT-I|
  12. |SYN_OPT-R|
  13. [ |-A|\ *aspect_ratio*\|\ **m** ]
  14. [ |-C|\ *convergence_limit*\ [%] ]
  15. [ |-J|\ *parameters* ]
  16. [ |-D|\ *breakline_file*\ [**+z**\ [*level*]] ]
  17. [ |-L|\ **l**\ *lower* ] [ **-Lu**\ *upper* ]
  18. [ |-M|\ *max_radius* ]
  19. [ |-N|\ *max_iterations* ]
  20. [ |-Q| ]
  21. [ |-S|\ *search_radius*\ [**m**\|\ **s**] ]
  22. [ |-T|\ [**i**\|\ **b**]\ *tension_factor* ]
  23. [ |SYN_OPT-V| ]
  24. [ |-Z|\ *over-relaxation_factor* ]
  25. [ |SYN_OPT-a| ]
  26. [ |SYN_OPT-bi| ]
  27. [ |SYN_OPT-di| ]
  28. [ |SYN_OPT-e| ]
  29. [ |SYN_OPT-f| ]
  30. [ |SYN_OPT-h| ]
  31. [ |SYN_OPT-i| ]
  32. [ |SYN_OPT-qi| ]
  33. [ |SYN_OPT-r| ]
  34. [ |SYN_OPT-:| ]
  35. [ |SYN_OPT--| ]
  36. |No-spaces|
  37. Description
  38. -----------
  39. **surface** reads randomly-spaced (x,y,z) triples from standard input
  40. [or *table*] and produces a binary grid file of gridded values z(x,y) by
  41. solving the differential equation (away from data points)
  42. .. math::
  43. (1 - t) \nabla ^2(z) + t \nabla (z) = 0,
  44. where *t* is a tension factor between 0 and 1, and :math:`\nabla` indicates the
  45. Laplacian operator. Here, *t* = 0 gives the "minimum curvature" solution which
  46. is equivalent to SuperMISP and the ISM packages. Minimum curvature can
  47. cause undesired oscillations and false local maxima or minima (See Smith
  48. and Wessel, 1990), and you may wish to use *t* > 0 to suppress these
  49. effects. Experience suggests *t* ~ 0.25 usually looks good for potential
  50. field data and *t* should be larger (*t* ~ 0.35) for steep topography data.
  51. *t* = 1 gives a harmonic surface (no maxima or minima are possible except
  52. at control data points). It is recommended that the user pre-process the
  53. data with :doc:`blockmean`, :doc:`blockmedian`, or :doc:`blockmode` to avoid
  54. spatial aliasing and eliminate redundant data. You may impose lower
  55. and/or upper bounds on the solution. These may be entered in the form of
  56. a fixed value, a grid with values, or simply be the minimum/maximum
  57. input data values. Natural boundary conditions are applied at the edges,
  58. except for geographic data with 360-degree range where we apply periodic
  59. boundary conditions in the longitude direction.
  60. Required Arguments
  61. ------------------
  62. .. _-G:
  63. **-G**\ *outputfile.nc*
  64. Output file name. Output is a binary 2-D *.nc* file. Note that the
  65. smallest grid dimension must be at least 4.
  66. .. _-I:
  67. .. include:: explain_-I.rst_
  68. .. _-R:
  69. .. |Add_-R| unicode:: 0x20 .. just an invisible code
  70. .. include:: explain_-R.rst_
  71. Optional Arguments
  72. ------------------
  73. .. |Add_intables| unicode:: 0x20 .. just an invisible code
  74. .. include:: explain_intables.rst_
  75. .. _-A:
  76. **-A**\ *aspect_ratio*\|\ **m**
  77. Aspect ratio. If desired, grid anisotropy can be added to the
  78. equations. Enter *aspect_ratio*, where dy = dx / *aspect_ratio*
  79. relates the grid dimensions. For geographic data, you may use
  80. **-Am** to set the aspect ratio to the cosine of the mean latitude
  81. [Default = 1 assumes isotropic grid.]
  82. .. _-C:
  83. **-C**\ *convergence_limit*\ [%]
  84. Convergence limit. Iteration is assumed to have converged when the
  85. maximum absolute change in any grid value is less than
  86. *convergence_limit*. (Units same as data z units). Alternatively,
  87. give limit in percentage of rms deviation by appending %. [Default is
  88. scaled to 1e-4 of the root-mean-square deviation of the data
  89. from a best-fit (least-squares) plane.].
  90. This is the final convergence limit at the desired grid spacing; for
  91. intermediate (coarser) grids the effective convergence limit is divided
  92. by the grid spacing multiplier.
  93. .. _-J:
  94. **-J**\ *parameters*
  95. .. |Add_-J| replace::
  96. Select the data map projection. This projection is only used to add a referencing info
  97. to the grid formats that support it. E.g. netCDF, GeoTIFF, and others supported by GDAL.
  98. .. include:: explain_-J.rst_
  99. .. _-D:
  100. **-D**\ *breakline*\ [**+z**\ [*level*]]
  101. Use xyz data in the *breakline* file as a 'soft breakline'. A 'soft breakline'
  102. is a line whose vertices will be used to constrain the nearest grid nodes without
  103. any further interpolation. A coastline or a lake shore are good examples of
  104. 'soft breaklines'. Multi-segments files are accepted. If your lines do not have
  105. *z*-values or you wish to override those with a constant z-value, then append
  106. **+z**\ *level* to the filename. If no value is given then we default to 0.
  107. .. _-L:
  108. **-Ll**\ *lower* and **-Lu**\ *upper*
  109. Impose limits on the output solution. **l**\ *lower* sets the lower
  110. bound. *lower* can be the name of a grid file with lower bound
  111. values, a fixed value, **d** to set to minimum input value, or **u**
  112. for unconstrained [Default]. **u**\ *upper* sets the upper bound and
  113. can be the name of a grid file with upper bound values, a fixed
  114. value, **d** to set to maximum input value, or **u** for
  115. unconstrained [Default]. Grid files used to set the limits may
  116. contain NaNs. In the presence of NaNs, the limit of a node masked
  117. with NaN is unconstrained.
  118. .. _-M:
  119. **-M**\ *max_radius*
  120. After solving for the surface, apply a mask so that nodes farther
  121. than *max_radius* away from a data constraint is set to NaN [no masking].
  122. Append a distance unit (see `Units`_) if needed.
  123. One can also select the nodes to mask by using the **-M**\ *n_cells*\ **c** form.
  124. Here *n_cells* means the number of cells around the node controlled by a data point. As an example
  125. **-M0c** means that only the cell where point lies is filled, **-M1c** keeps one cell
  126. beyond that (i.e. makes a 3x3 neighborhood), and so on.
  127. .. _-N:
  128. **-N**\ *max_iterations*
  129. Number of iterations. Iteration will cease when *convergence_limit*
  130. is reached or when number of iterations reaches *max_iterations*.
  131. This is the final iteration limit at the desired grid spacing; for
  132. intermediate (coarser) grids the effective iteration limit is scaled
  133. by the grid spacing multiplier [Default is 500].
  134. .. _-Q:
  135. **-Q**
  136. Suggest grid dimensions which have a highly composite greatest
  137. common factor. This allows surface to use several intermediate steps
  138. in the solution, yielding faster run times and better results. The
  139. sizes suggested by **-Q** can be achieved by altering **-R** and/or
  140. **-I**. You can recover the **-R** and **-I** you want later by
  141. using :doc:`grdsample` or :doc:`grdcut` on the output of **surface**.
  142. .. _-S:
  143. **-S**\ *search_radius*\ [**m**\|\ **s**]
  144. Search radius. Enter *search\_radius* in same units as x,y data;
  145. append **m** to indicate arc minutes or **s** for arc seconds. This
  146. is used to initialize the grid before the first iteration; it is not
  147. worth the time unless the grid lattice is prime and cannot have
  148. regional stages. [Default = 0.0 and no search is made.]
  149. .. _-T:
  150. **-T**\ [**i**\|\ **b**]\ *tension_factor*
  151. Tension factor[s]. These must be between 0 and 1. Tension may be
  152. used in the interior solution (above equation, where it suppresses
  153. spurious oscillations) and in the boundary conditions (where it
  154. tends to flatten the solution approaching the edges). Using zero for
  155. both values results in a minimum curvature surface with free edges,
  156. i.e., a natural bicubic spline. Use **-Ti**\ *tension_factor*
  157. to set interior tension, and **-Tb**\ *tension_factor* to set
  158. boundary tension. If you do not prepend **i** or **b**, both will be
  159. set to the same value. [Default = 0 for both gives minimum curvature
  160. solution.]
  161. .. _-V:
  162. .. |Add_-V| replace::
  163. **-V3** will report the convergence after each iteration;
  164. **-V** will report only after each regional grid is converged.
  165. .. include:: explain_-V.rst_
  166. .. _-Z:
  167. **-Z**\ *over-relaxation_factor*
  168. Over-relaxation factor. This parameter is used to accelerate the
  169. convergence; it is a number between 1 and 2. A value of 1 iterates
  170. the equations exactly, and will always assure stable convergence.
  171. Larger values overestimate the incremental changes during
  172. convergence, and will reach a solution more rapidly but may become
  173. unstable. If you use a large value for this factor, it is a good
  174. idea to monitor each iteration with the **-Vi** option. [Default =
  175. 1.4 converges quickly and is almost always stable.]
  176. .. include:: explain_-aspatial.rst_
  177. .. |Add_-bi| replace:: [Default is 3 input columns].
  178. .. include:: explain_-bi.rst_
  179. .. |Add_-di| unicode:: 0x20 .. just an invisible code
  180. .. include:: explain_-di.rst_
  181. .. |Add_-e| unicode:: 0x20 .. just an invisible code
  182. .. include:: explain_-e.rst_
  183. .. |Add_-f| unicode:: 0x20 .. just an invisible code
  184. .. include:: explain_-f.rst_
  185. .. |Add_-h| replace:: Not used with binary data.
  186. .. include:: explain_-h.rst_
  187. .. include:: explain_-icols.rst_
  188. .. include:: explain_-qi.rst_
  189. .. |Add_nodereg| unicode:: 0x20 .. just an invisible code
  190. .. include:: explain_nodereg.rst_
  191. .. include:: explain_colon.rst_
  192. .. include:: explain_help.rst_
  193. .. include:: explain_float.rst_
  194. .. include:: explain_distunits.rst_
  195. Examples
  196. --------
  197. .. include:: explain_example.rst_
  198. To grid 5 by 5 minute gravity block means from the ASCII data in
  199. hawaii_5x5.xyg, using a *tension_factor* = 0.25, a
  200. *convergence_limit* = 0.1 milligal, writing the result to a file called
  201. hawaii_grd.nc, and monitoring each iteration, try:
  202. ::
  203. gmt surface hawaii_5x5.xyg -R198/208/18/25 -I5m -Ghawaii_grd.nc -T0.25 -C0.1 -Vi
  204. Gridding Geographic Data: Boundary Conditions
  205. ---------------------------------------------
  206. The surface finite difference algorithm is Cartesian at heart, hence the *ad hoc*
  207. option to change the aspect ratio for a suitable mean latitude (**-A**). When
  208. geographic data are supplied and the output grid has a 360 degree longitude range we will
  209. impose periodic boundary conditions in longitude. However, no equivalent geographic
  210. boundary condition can be applied at the poles since the finite difference solution
  211. will not be valid there (actual spacing between the nodes at the poles is zero).
  212. If you attempt this type of gridding you will be severely warned but the calculations
  213. will continue. Because the result is a geographic grid, the GMT i/o machinery will
  214. interfere and detect inconsistencies at the pole points and replace all values along
  215. a pole with their mean value. This will introduce further distortion into the
  216. grid near the poles. We recommend you instead consider spherical gridding for global
  217. data sets; see :doc:`greenspline` (for modest data sets) or :doc:`sphinterpolate`.
  218. Gridding Geographic Data: Setting Increments
  219. --------------------------------------------
  220. Specifying grid increments in distance units (meters, km, etc.) for geographic (lon, lat)
  221. grids triggers a conversion from the given increment to the equivalent increment in degrees.
  222. This is done differently for longitude and latitude and also depends on chosen ellipsoid,
  223. but ultimately is a great-circle approximation. For latitude we divide your *y*-increment
  224. with the number of you chosen unit per degree latitude, while for longitude we divide your
  225. *x*-increment by the number of such units per degree along the mid-parallel in your region. The
  226. resulting degree increments may therefore not exactly match the increments you entered explicitly.
  227. Hence, there may be rounding off in ways you don't want and cannot easily control, resulting in prime grid
  228. dimensions. You can handle the situation via **-Q** but with the never-ending decimals in some
  229. increments that is still a challenge. Another approach is to *not* grid geographic data
  230. using length units as increments, due to the above conversion. It may be cleaner to specify
  231. grid intervals in spherical degrees, minutes or seconds. That way you can control the grid
  232. dimensions directly and avoid the round-off. Alternatively, if your region is far from Equator
  233. and your are concerned about the difference in longitude and latitude increments in degrees
  234. you could project all data to a local projection (e.g., UTM) to yield units of meters, and then
  235. grid the projected data using meters as the final grid increment. Either approach avoids
  236. "ugly" increments like 0.161697s and will let you specify intervals that are easily divisible
  237. into the range. If increment choice is dictated by a need for a desired increment in meters
  238. then the projection route will yield better results.
  239. Bugs
  240. ----
  241. **surface** will complain when more than one data point is found for any
  242. node and suggest that you run :doc:`blockmean`, :doc:`blockmedian`, or
  243. :doc:`blockmode` first. If you did run these decimators and still get this
  244. message it usually means that your grid spacing is so small that you
  245. need more decimals in the output format used. You may
  246. specify more decimal places by editing the parameter
  247. :term:`FORMAT_FLOAT_OUT` in your :doc:`gmt.conf` file prior to running
  248. the decimators or choose binary input and/or output using single or
  249. double precision storage.
  250. Note that only gridline registration is possible with **surface**. If
  251. you need a pixel-registered grid you can resample a gridline registered
  252. grid using :doc:`grdsample` **-T**.
  253. See Also
  254. --------
  255. :doc:`blockmean`,
  256. :doc:`blockmedian`,
  257. :doc:`blockmode`,
  258. :doc:`gmt`,
  259. :doc:`grdcut`,
  260. :doc:`grdsample`,
  261. :doc:`greenspline`,
  262. :doc:`nearneighbor`,
  263. :doc:`triangulate`,
  264. :doc:`sphinterpolate`
  265. References
  266. ----------
  267. Smith, W. H. F, and P. Wessel, 1990, Gridding with continuous curvature
  268. splines in tension, *Geophysics*, 55, 293-305.
Tip!

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

Comments

Loading...