1GRDBLEND(1) GMT GRDBLEND(1)
2
3
4
6 grdblend - Blend several partially over-lapping grids into one large
7 grid
8
10 grdblend [ blendfile | grid1 grid2 ... ] -Goutgrid [ -Iincrement ] [
11 -Rregion ] [ -Cf|l|o|u ] [ -Nnodata ] [ -Q ] [ -Zscale ] [
12 -V[level] ] [ -W[z] ] [ -fflags ] [ -nflags ] [ -r ]
13
14 Note: No space is allowed between the option flag and the associated
15 arguments.
16
18 grdblend reads a listing of grid files and blend parameters and creates
19 a binary grid file by blending the other grids using cosine-taper
20 weights. grdblend will report if some of the nodes are not filled in
21 with data. Such unconstrained nodes are set to a value specified by the
22 user [Default is NaN]. Nodes with more than one value will be set to
23 the weighted average value. Any input grid that does not share the
24 final output grid's node registration and grid spacing will automati‐
25 cally be resampled via calls to grdsample. Note: Due to the row-by-row
26 i/o nature of operations in grdblend we only support the netCDF and
27 native binary grid formats for both input and output.
28
30 -Goutgrid
31 outgrid is the name of the binary output grid file. (See GRID
32 FILE FORMATS below). Only netCDF and native binary grid formats
33 are can be written directly. Other output format choices will be
34 handled by reformatting the output once blending is complete.
35
36 -Ixinc[unit][+e|n][/yinc[unit][+e|n]]
37 x_inc [and optionally y_inc] is the grid spacing. Optionally,
38 append a suffix modifier. Geographical (degrees) coordinates:
39 Append m to indicate arc minutes or s to indicate arc seconds.
40 If one of the units e, f, k, M, n or u is appended instead, the
41 increment is assumed to be given in meter, foot, km, Mile, nau‐
42 tical mile or US survey foot, respectively, and will be con‐
43 verted to the equivalent degrees longitude at the middle lati‐
44 tude of the region (the conversion depends on PROJ_ELLIPSOID).
45 If y_inc is given but set to 0 it will be reset equal to x_inc;
46 otherwise it will be converted to degrees latitude. All coordi‐
47 nates: If +e is appended then the corresponding max x (east) or
48 y (north) may be slightly adjusted to fit exactly the given
49 increment [by default the increment may be adjusted slightly to
50 fit the given domain]. Finally, instead of giving an increment
51 you may specify the number of nodes desired by appending +n to
52 the supplied integer argument; the increment is then recalcu‐
53 lated from the number of nodes and the domain. The resulting
54 increment value depends on whether you have selected a grid‐
55 line-registered or pixel-registered grid; see App-file-formats
56 for details. Note: if -Rgrdfile is used then the grid spacing
57 has already been initialized; use -I to override the values.
58
59 -Rxmin/xmax/ymin/ymax[+r][+uunit] (more ...)
60 Specify the region of interest.
61
63 blendfile
64 ASCII file with one record per grid file to include in the
65 blend. Each record may contain up to three items, separated by
66 spaces or tabs: the gridfile name (required), the -R-setting for
67 the interior region (optional), and the relative weight wr
68 (optional). In the combined weighting scheme, this grid will be
69 given zero weight outside its domain, weight = wr inside the
70 interior region, and a 2-D cosine-tapered weight between those
71 end-members in the boundary strip. However, if a negative wr is
72 given then the sense of tapering is inverted (i.e., zero weight
73 inside its domain). If the inner region should instead exactly
74 match the grid region then specify a - instead of the -R-set‐
75 ting, or leave it off entirely. Likewise, if a weight wr is not
76 specified we default to a weight of 1. If the ASCII blendfile
77 file is not given grdblend will read standard input. Alterna‐
78 tively, if you have more than one grid file to blend and you
79 wish (a) all input grids to have the same weight (1) and (b) all
80 grids should use their actual region as the interior region,
81 then you may simply list all the grids on the command line
82 instead of providing a blendfile. You must specify at least 2
83 input grids for this mechanism to work. Any grid that is not
84 co-registered with the desired output layout implied by -R, -I
85 (and -r) will first be resampled via grdsample. Also, grids that
86 are not in netCDF or native binary format will first be refor‐
87 matted via grdconvert.
88
89 -C Clobber mode: Instead of blending, simply pick the value of one
90 of the grids that covers a node. Select from the following
91 modes: f for the first grid to visit a node; o for the last grid
92 to visit a node; l for the grid with the lowest value, and u for
93 the grid with the uppermost value. For modes f and o the order‐
94 ing of grids in the blendfile will dictate which grid contrib‐
95 utes to the final result. Weights and cosine tapering are not
96 considered when clobber mode is active.
97
98 -Nnodata
99 No data. Set nodes with no input grid to this value [Default is
100 NaN].
101
102 -Q Create a header-less grid file suitable for use with grdraster.
103 Requires that the output grid file is a native format (i.e., not
104 netCDF).
105
106 -V[level] (more ...)
107 Select verbosity level [c].
108
109 -W[z] Do not blend, just output the weights used for each node
110 [Default makes the blend]. Append z to write the weight*z sum
111 instead.
112
113 -Zscale
114 Scale output values by scale before writing to file. [1].
115
116 -f[i|o]colinfo (more ...)
117 Specify data types of input and/or output columns.
118
119 -n[b|c|l|n][+a][+bBC][+c][+tthreshold] (more ...)
120 Select interpolation mode for grids.
121
122 -r (more ...)
123 Set pixel node registration [gridline].
124
125 -^ or just -
126 Print a short message about the syntax of the command, then
127 exits (NOTE: on Windows just use -).
128
129 -+ or just +
130 Print an extensive usage (help) message, including the explana‐
131 tion of any module-specific option (but not the GMT common
132 options), then exits.
133
134 -? or no arguments
135 Print a complete usage (help) message, including the explanation
136 of all options, then exits.
137
139 By default GMT writes out grid as single precision floats in a
140 COARDS-complaint netCDF file format. However, GMT is able to produce
141 grid files in many other commonly used grid file formats and also
142 facilitates so called "packing" of grids, writing out floating point
143 data as 1- or 2-byte integers. To specify the precision, scale and off‐
144 set, the user should add the suffix =ID[+sscale][+ooffset][+ninvalid],
145 where ID is a two-letter identifier of the grid type and precision, and
146 scale and offset are optional scale factor and offset to be applied to
147 all grid values, and invalid is the value used to indicate missing
148 data. See grdconvert and Section grid-file-format of the GMT Technical
149 Reference and Cookbook for more information.
150
151 When writing a netCDF file, the grid is stored by default with the
152 variable name "z". To specify another variable name varname, append
153 ?varname to the file name. Note that you may need to escape the special
154 meaning of ? in your shell program by putting a backslash in front of
155 it, or by placing the filename and suffix between quotes or double
156 quotes.
157
159 When the output grid type is netCDF, the coordinates will be labeled
160 "longitude", "latitude", or "time" based on the attributes of the input
161 data or grid (if any) or on the -f or -R options. For example, both
162 -f0x -f1t and -R90w/90e/0t/3t will result in a longitude/time grid.
163 When the x, y, or z coordinate is time, it will be stored in the grid
164 as relative time since epoch as specified by TIME_UNIT and TIME_EPOCH
165 in the gmt.conf file or on the command line. In addition, the unit
166 attribute of the time variable will indicate both this unit and epoch.
167
169 While the weights computed are tapered from 1 to 0, we are computing
170 weighted averages, so if there is only a single grid given then the
171 weighted output will be identical to the input. If you are looking for
172 a way to taper your data grid, see grdmath's TAPER operator.
173
175 To create a grid file from the four grid files piece_?.nc, giving them
176 each the different weights, make the blendfile like this
177
178 piece_1.nc -R<subregion_1> 1
179 piece_2.nc -R<subregion_2> 1.5
180 piece_3.nc -R<subregion_3> 0.9
181 piece_4.nc -R<subregion_4> 1
182
183 Then run
184
185 gmt grdblend blend.job -Gblend.nc -R<full_region> -I<dx/dy> -V
186
187 To blend all the grids called MB_*.nc given them all equal weight, try
188
189 gmt grdblend MB_*.nc -Gblend.nc -R<full_region> -I<dx/dy> -V
190
192 While grdblend can process any number of files, it works by keeping
193 those files open that are being blended, and close files as soon as
194 they are finished. Depending on your session, many files may remain
195 open at the same time. Some operating systems set fairly modest
196 default limits on how many concurrent files can be open, e.g., 256. If
197 you run into this problem then you can change this limit; see your
198 operating system documentation for how to change system limits.
199
201 gmt, grd2xyz, grdconvert, grdedit, grdraster, grdsample
202
204 2019, P. Wessel, W. H. F. Smith, R. Scharroo, J. Luis, and F. Wobbe
205
206
207
208
2095.4.5 Feb 24, 2019 GRDBLEND(1)