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

nearneighbor.rst 5.2 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
  1. .. index:: ! nearneighbor
  2. .. include:: module_core_purpose.rst_
  3. ************
  4. nearneighbor
  5. ************
  6. |nearneighbor_purpose|
  7. Synopsis
  8. --------
  9. .. include:: common_SYN_OPTs.rst_
  10. **gmt nearneighbor** [ *table* ] |-G|\ *out_grdfile*
  11. |SYN_OPT-I|
  12. |-N|\ *sectors*\ [**+m**\ *min_sectors*] | \ **n**
  13. |SYN_OPT-R|
  14. |-S|\ *search_radius*
  15. [ |-E|\ *empty* ]
  16. [ |SYN_OPT-V| ]
  17. [ |-W| ]
  18. [ |SYN_OPT-bi| ]
  19. [ |SYN_OPT-di| ]
  20. [ |SYN_OPT-e| ]
  21. [ |SYN_OPT-f| ]
  22. [ |SYN_OPT-g| ]
  23. [ |SYN_OPT-h| ]
  24. [ |SYN_OPT-i| ]
  25. [ |SYN_OPT-n| ]
  26. [ |SYN_OPT-qi| ]
  27. [ |SYN_OPT-r| ]
  28. [ |SYN_OPT-:| ]
  29. [ |SYN_OPT--| ]
  30. |No-spaces|
  31. Description
  32. -----------
  33. **nearneighbor** reads arbitrarily located (x,y,z[,w]) triples
  34. [quadruplets] from standard input [or *table*] and uses a nearest
  35. neighbor algorithm to assign an average value to each node that have one
  36. or more points within a radius centered on the node. The average value
  37. is computed as a weighted mean of the nearest point from each sector
  38. inside the search radius. The weighting function used is w(r) = 1 / (1 +
  39. d ^ 2), where d = 3 \* r / search_radius and r is distance from the
  40. node. This weight is modulated by the weights of the observation points [if
  41. supplied].
  42. Required Arguments
  43. ------------------
  44. .. _-G:
  45. **-G**\ *out_grdfile*
  46. Give the name of the output grid file.
  47. .. _-I:
  48. .. include:: explain_-I.rst_
  49. .. _-N:
  50. **-N**\ *sectors*\ [**+m**\ *min_sectors*]\|\ **n**
  51. The circular area centered on each node is divided into *sectors*
  52. sectors. Average values will only be computed if there is at least
  53. one value inside each of at least *min_sectors* of the sectors for a given
  54. node. Nodes that fail this test are assigned the value NaN (but see
  55. **-E**). If **+m** is omitted then *min_sectors* is set to be at least 50%
  56. of *sectors* (i.e., rounded up to next integer) [Default is a quadrant
  57. search with 100% coverage, i.e., *sectors* = *min_sectors* = 4]. Note
  58. that only the nearest value per sector enters into the averaging; the
  59. more distant points are ignored. Alternatively, use **-Nn** to call
  60. GDALʻs nearest neighbor algorithm instead.
  61. .. _-R:
  62. .. |Add_-R| unicode:: 0x20 .. just an invisible code
  63. .. include:: explain_-R.rst_
  64. .. _-S:
  65. **-S**\ *search_radius*
  66. Sets the *search_radius* that determines which data points are
  67. considered close to a node. Append the distance unit (see `Units`_).
  68. Optional Arguments
  69. ------------------
  70. *table*
  71. 3 [or 4, see **-W**] column ASCII file(s) [or binary, see
  72. **-bi**] holding (x,y,z[,w]) data values. If
  73. no file is specified, **nearneighbor** will read from standard input.
  74. .. _-E:
  75. **-E**\ *empty*
  76. Set the value assigned to empty nodes [NaN].
  77. .. _-V:
  78. .. |Add_-V| unicode:: 0x20 .. just an invisible code
  79. .. include:: explain_-V.rst_
  80. .. _-W:
  81. **-W**
  82. Input data have a 4th column containing observation point weights.
  83. These are multiplied with the geometrical weight factor to determine
  84. the actual weights used in the calculations.
  85. .. |Add_-bi| replace:: [Default is 3 (or 4 if **-W** is set) columns].
  86. .. include:: explain_-bi.rst_
  87. .. |Add_-di| unicode:: 0x20 .. just an invisible code
  88. .. include:: explain_-di.rst_
  89. .. |Add_-e| unicode:: 0x20 .. just an invisible code
  90. .. include:: explain_-e.rst_
  91. .. |Add_-f| unicode:: 0x20 .. just an invisible code
  92. .. include:: explain_-f.rst_
  93. .. |Add_-g| replace:: 0x20 .. just an invisible code
  94. .. include:: explain_-g.rst_
  95. .. |Add_-h| unicode:: 0x20 .. just an invisible code
  96. .. include:: explain_-h.rst_
  97. .. include:: explain_-icols.rst_
  98. **-n**\ [**b**\|\ **c**\|\ **l**\|\ **n**][**+a**][**+b**\ *BC*][**+t**\ *threshold*]
  99. Append **+b**\ *BC* to set any boundary conditions to be used,
  100. adding **g** for geographic, **p** for periodic, or **n** for
  101. natural boundary conditions. For the latter two you may append **x**
  102. or **y** to specify just one direction, otherwise both are assumed.
  103. [Default is geographic if grid is geographic].
  104. .. include:: explain_-qi.rst_
  105. .. |Add_nodereg| unicode:: 0x20 .. just an invisible code
  106. .. include:: explain_nodereg.rst_
  107. .. include:: explain_colon.rst_
  108. .. include:: explain_help.rst_
  109. .. include:: explain_distunits.rst_
  110. .. include:: explain_float.rst_
  111. Examples
  112. --------
  113. .. include:: explain_example.rst_
  114. To grid the data in the remote file @ship_15.txt at 5x5 arc minutes using
  115. a search radius of 15 arch minutes, and plot the resulting grid using
  116. default projection and colors, try::
  117. gmt begin map
  118. gmt nearneighbor @ship_15.txt -R245/255/20/30 -I5m -Ggrid.nc -S15m
  119. gmt grdimage grid.nc -B
  120. gmt end show
  121. To create a gridded data set from the file seaMARCII_bathy.lon_lat_z
  122. using a 0.5 min grid, a 5 km search radius, using an octant search with
  123. 100% sector coverage, and set empty nodes to -9999::
  124. gmt nearneighbor seaMARCII_bathy.lon_lat_z -R242/244/-22/-20 -I0.5m -E-9999 -Gbathymetry.nc -S5k -N8+m8
  125. To make a global grid file from the data in geoid.xyz using a 1 degree
  126. grid, a 200 km search radius, spherical distances, using an quadrant
  127. search, and set nodes to NaN only when fewer than two quadrants contain
  128. at least one value::
  129. gmt nearneighbor geoid.xyz -R0/360/-90/90 -I1 -Lg -Ggeoid.nc -S200k -N4
  130. See Also
  131. --------
  132. :doc:`blockmean`,
  133. :doc:`blockmedian`,
  134. :doc:`blockmode`, :doc:`gmt`,
  135. :doc:`greenspline`,
  136. :doc:`sphtriangulate`,
  137. :doc:`surface`,
  138. :doc:`triangulate`
Tip!

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

Comments

Loading...