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

grdblend.rst 6.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
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
  1. .. index:: ! grdblend
  2. .. include:: module_core_purpose.rst_
  3. ********
  4. grdblend
  5. ********
  6. |grdblend_purpose|
  7. Synopsis
  8. --------
  9. .. include:: common_SYN_OPTs.rst_
  10. **gmt grdblend** [ *blendfile* \| *grid1* *grid2* ... ] |-G|\ *outgrid*
  11. |SYN_OPT-I|
  12. |SYN_OPT-R|
  13. [ |-C|\ **f**\|\ **l**\|\ **o**\|\ **u**\ [**+n**\|\ **p**] ]
  14. [ |-N|\ *nodata* ]
  15. [ |-Q| ] [ |-Z|\ *scale* ]
  16. [ |SYN_OPT-V| ]
  17. [ |-W|\ [**z**] ]
  18. [ |SYN_OPT-f| ]
  19. [ |SYN_OPT-n| ]
  20. [ |SYN_OPT-r| ]
  21. [ |SYN_OPT--| ]
  22. |No-spaces|
  23. Description
  24. -----------
  25. **grdblend** reads a listing of grid files and blend parameters and
  26. creates a binary grid file by blending the other grids using
  27. cosine-taper weights. **grdblend** will report if some of the nodes are
  28. not filled in with data. Such unconstrained nodes are set to a value
  29. specified by the user [Default is NaN]. Nodes with more than one value
  30. will be set to the weighted average value. Any input grid that does not
  31. share the final output grid's node registration and grid spacing will
  32. automatically be resampled via calls to :doc:`grdsample`. **Note**: Due to the
  33. row-by-row i/o nature of operations in **grdblend** we only support the
  34. netCDF and native binary grid formats for both input and output.
  35. Required Arguments
  36. ------------------
  37. .. _-G:
  38. **-G**\ *outgrid*
  39. *outgrid* is the name of the binary output grid file. (See GRID FILE
  40. FORMATS below). Only netCDF and native binary grid formats are can
  41. be written directly. Other output format choices will be handled by
  42. reformatting the output once blending is complete.
  43. .. _-I:
  44. .. include:: explain_-I.rst_
  45. .. _-R:
  46. .. |Add_-R| unicode:: 0x20 .. just an invisible code
  47. .. include:: explain_-R.rst_
  48. Optional Arguments
  49. ------------------
  50. *blendfile*
  51. ASCII file with one record per grid file to include in the blend.
  52. Each record may contain up to three items, separated by spaces or tabs:
  53. the gridfile name (required), the **-R**-setting for the interior region
  54. (optional), and the relative weight *wr* (optional). In the combined weighting scheme, this
  55. grid will be given zero weight outside its domain, weight = *wr*
  56. inside the interior region, and a 2-D cosine-tapered weight between
  57. those end-members in the boundary strip. However, if a negative *wr*
  58. is given then the sense of tapering is inverted (i.e., zero weight
  59. inside its domain). If the inner region should instead exactly match
  60. the grid region then specify a - instead of the **-R**-setting, or
  61. leave it off entirely. Likewise, if a weight *wr* is not specified
  62. we default to a weight of 1. If the ASCII *blendfile* file is not
  63. given **grdblend** will read standard input. Alternatively, if you
  64. have more than one grid file to blend and you wish (a) all input
  65. grids to have the same weight (1) and (b) all grids
  66. should use their actual region as the interior region, then you may simply
  67. list all the grids on the command line instead of providing a
  68. *blendfile*. You must specify at least 2 input grids for this
  69. mechanism to work. Any grid that is not co-registered with the
  70. desired output layout implied by **-R**, **-I** (and |SYN_OPT-r|) will
  71. first be resampled via :doc:`grdsample`. Also, grids that are not in
  72. netCDF or native binary format will first be reformatted via :doc:`grdconvert`.
  73. .. _-C:
  74. **-C**\ **f**\|\ **l**\|\ **o**\|\ **u**\ [**+n**\|\ **p**]
  75. Clobber mode: Instead of blending, simply pick the value of one of
  76. the grids that covers a node. Select from the following modes: **f**
  77. for the first grid to visit a node; **o** for the last grid to visit
  78. a node; **l** for the grid with the lowest value, and **u** for the
  79. grid with the uppermost value. For modes **f** and **o** the
  80. ordering of grids in the *blendfile* will dictate which grid
  81. contributes to the final result. Weights and cosine tapering are not
  82. considered when clobber mode is active. Optionally, append **+p** or **+n**.
  83. Then, we always initialize output to equal the first grid but then
  84. for subsequent grids we only consider them in the decision if the
  85. values are >= 0 or <= 0, respectively.
  86. .. _-N:
  87. **-N**\ *nodata*
  88. No data. Set nodes with no input grid to this value [Default is NaN].
  89. .. _-Q:
  90. **-Q**
  91. Create plain header-less grid file (for use with external tools).
  92. Requires that the output grid file is a native format (i.e., not netCDF).
  93. .. _-V:
  94. .. |Add_-V| unicode:: 0x20 .. just an invisible code
  95. .. include:: explain_-V.rst_
  96. .. _-W:
  97. **-W**\ [**z**]
  98. Do not blend, just output the weights used for each node [Default makes the blend].
  99. Append **z** to write the weight*z sum instead.
  100. .. _-Z:
  101. **-Z**\ *scale*
  102. Scale output values by *scale* before writing to file. [1].
  103. .. |Add_-f| unicode:: 0x20 .. just an invisible code
  104. .. include:: explain_-f.rst_
  105. .. include:: explain_-n.rst_
  106. .. |Add_nodereg| unicode:: 0x20 .. just an invisible code
  107. .. include:: explain_nodereg.rst_
  108. .. include:: explain_help.rst_
  109. .. include:: explain_grd_output.rst_
  110. .. include:: explain_grd_coord.rst_
  111. Tapering
  112. --------
  113. While the weights computed are tapered from 1 to 0, we are computing weighted
  114. averages, so if there is only a single grid given then the weighted output
  115. will be identical to the input. If you are looking for a way to taper your
  116. data grid, see grdmath's TAPER operator.
  117. Examples
  118. --------
  119. .. include:: explain_example.rst_
  120. To create a grid file from the four grid files piece\_?.nc, giving them each the different
  121. weights, make the blendfile like this
  122. ::
  123. piece_1.nc -R<subregion_1> 1
  124. piece_2.nc -R<subregion_2> 1.5
  125. piece_3.nc -R<subregion_3> 0.9
  126. piece_4.nc -R<subregion_4> 1
  127. Then run
  128. ::
  129. gmt grdblend blend.job -Gblend.nc -R<full_region> -I<dx/dy> -V
  130. To blend all the grids called MB\_\*.nc given them all equal weight, try
  131. ::
  132. gmt grdblend MB_*.nc -Gblend.nc -R<full_region> -I<dx/dy> -V
  133. Warning on large file sets
  134. --------------------------
  135. While **grdblend** can process any number of files, it works by keeping those
  136. files open that are being blended, and close files as soon as they are finished.
  137. Depending on your session, many files may remain open at the same time.
  138. Some operating systems set fairly modest
  139. default limits on how many concurrent files can be open, e.g., 256. If you
  140. run into this problem then you can change this limit; see your operating system
  141. documentation for how to change system limits.
  142. See Also
  143. --------
  144. :doc:`gmt`,
  145. :doc:`grd2xyz`,
  146. :doc:`grdconvert`,
  147. :doc:`grdedit`,
  148. :doc:`grdsample`
Tip!

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

Comments

Loading...