1GRDSAMPLE(1)                          GMT                         GRDSAMPLE(1)
2
3
4

NAME

6       grdsample - Resample a grid onto a new lattice
7

SYNOPSIS

9       grdsample  in_grdfile   -Gout_grdfile  [  -Iincrement ] [  -Rregion ] [
10       -T ] [  -V[level] ] [ -fflags ] [ -nflags ] [ -rreg ] [ -x[[-]n] ]
11
12       Note: No space is allowed between the option flag  and  the  associated
13       arguments.
14

DESCRIPTION

16       grdsample  reads  a  grid file and interpolates it to create a new grid
17       file with either: a different  registration  (-r  or  -T);  or,  a  new
18       grid-spacing or number of nodes (-I), and perhaps also a new sub-region
19       (-R). A  bicubic  [Default],  bilinear,  B-spline  or  nearest-neighbor
20       interpolation  is used; see -n for settings. Note that using -R only is
21       equivalent to grdcut or grdedit -S.  grdsample safely  creates  a  fine
22       mesh  from  a  coarse  one; the converse may suffer aliasing unless the
23       data are filtered using grdfft or grdfilter.
24
25       When -R is omitted, the output grid will cover the same region  as  the
26       input  grid.  When  -I  is omitted, the grid spacing of the output grid
27       will be the same as the input grid. Either -r or  -T  can  be  used  to
28       change  the  grid registration. When omitted, the output grid will have
29       the same registration as the input grid.
30

REQUIRED ARGUMENTS

32       in_grdfile
33              The name of the input 2-D binary grid file. (See GRID FILE  FOR‐
34              MAT below.)
35
36       -Gout_grdfile
37              The name of the output grid file. (See GRID FILE FORMAT below.)
38

OPTIONAL ARGUMENTS

40       -Ixinc[unit][+e|n][/yinc[unit][+e|n]]
41              x_inc  [and  optionally  y_inc] is the grid spacing. Optionally,
42              append a suffix modifier.  Geographical  (degrees)  coordinates:
43              Append  m  to indicate arc minutes or s to indicate arc seconds.
44              If one of the units e, f, k, M, n or u is appended instead,  the
45              increment  is assumed to be given in meter, foot, km, Mile, nau‐
46              tical mile or US survey foot, respectively,  and  will  be  con‐
47              verted  to  the equivalent degrees longitude at the middle lati‐
48              tude of the region (the conversion depends  on  PROJ_ELLIPSOID).
49              If  y_inc is given but set to 0 it will be reset equal to x_inc;
50              otherwise it will be converted to degrees latitude. All  coordi‐
51              nates:  If +e is appended then the corresponding max x (east) or
52              y (north) may be slightly adjusted  to  fit  exactly  the  given
53              increment  [by default the increment may be adjusted slightly to
54              fit the given domain]. Finally, instead of giving  an  increment
55              you  may  specify the number of nodes desired by appending +n to
56              the supplied integer argument; the increment  is  then  recalcu‐
57              lated  from  the  number  of nodes and the domain. The resulting
58              increment value depends on whether you  have  selected  a  grid‐
59              line-registered  or  pixel-registered grid; see App-file-formats
60              for details. Note: if -Rgrdfile is used then  the  grid  spacing
61              has already been initialized; use -I to override the values.
62
63       -Rxmin/xmax/ymin/ymax[+r][+uunit] (more ...)
64              Specify the region of interest.
65
66       -T     Translate  between  grid and pixel registration; if the input is
67              grid-registered,  the  output  will  be   pixel-registered   and
68              vice-versa.
69
70       -V[level] (more ...)
71              Select verbosity level [c].
72
73       -f[i|o]colinfo (more ...)
74              Specify data types of input and/or output columns.
75
76       -n[b|c|l|n][+a][+bBC][+c][+tthreshold] (more ...)
77              Select interpolation mode for grids.
78
79       -r (more ...)
80              Set pixel node registration [gridline].
81
82       -x[[-]n] (more ...)
83              Limit  number of cores used in multi-threaded algorithms (OpenMP
84              required).
85
86       -^ or just -
87              Print a short message about the  syntax  of  the  command,  then
88              exits (NOTE: on Windows just use -).
89
90       -+ or just +
91              Print  an extensive usage (help) message, including the explana‐
92              tion of any module-specific  option  (but  not  the  GMT  common
93              options), then exits.
94
95       -? or no arguments
96              Print a complete usage (help) message, including the explanation
97              of all options, then exits.
98

GRID VALUES PRECISION

100       Regardless of the precision of the input data, GMT programs that create
101       grid  files  will  internally  hold  the grids in 4-byte floating point
102       arrays. This is done to conserve memory and furthermore most if not all
103       real  data  can be stored using 4-byte floating point values. Data with
104       higher precision (i.e., double precision values) will lose that  preci‐
105       sion  once  GMT  operates on the grid or writes out new grids. To limit
106       loss of precision when processing data you should always consider  nor‐
107       malizing the data prior to processing.
108

GRID FILE FORMATS

110       By  default  GMT  writes  out  grid  as  single  precision  floats in a
111       COARDS-complaint netCDF file format. However, GMT is  able  to  produce
112       grid  files  in  many  other  commonly  used grid file formats and also
113       facilitates so called "packing" of grids, writing  out  floating  point
114       data as 1- or 2-byte integers. (more ...)
115

CONSEQUENCES OF GRID RESAMPLING

117       Resample or sampling of grids will use various algorithms (see -n) that
118       may lead to possible distortions or unexpected results in the resampled
119       values.  One expected effect of resampling with splines is the tendency
120       for the new resampled values to slightly exceed the global min/max lim‐
121       its  of  the  original  grid.   If this is unacceptable, you can impose
122       clipping of the resampled values values so they do not exceed the input
123       min/max values by adding +c to your -n option.
124

HINTS

126       If  an  interpolation  point is not on a node of the input grid, then a
127       NaN at any node in the neighborhood surrounding the point will yield an
128       interpolated  NaN.  Bicubic  interpolation  [default] yields continuous
129       first derivatives but requires a neighborhood of 4 nodes  by  4  nodes.
130       Bilinear interpolation [-n] uses only a 2 by 2 neighborhood, but yields
131       only zero-order continuity. Use bicubic when smoothness  is  important.
132       Use bilinear to minimize the propagation of NaNs.
133

NOTES

135       As  an alternative to bicubic spline, linear spline or nearest neighbor
136       interpolation one can instead send the entire dataset  through  surface
137       for  re-gridding.  This approach allows more control on aspects such as
138       tension but it also leads to a solution that  is  not  likely  to  have
139       fully converged.  The general approach would be something like
140
141              gmt grd2xyz old.grd | gmt surface -Rold.grd -Inewinc -Gnew.grd [other options]
142
143       For  moderate  data  set  one could also achieve an exact solution with
144       greenspline, such as
145
146          gmt grd2xyz old.grd | gmt greenspline -Rold.grd -Inewinc -Gnew.grd [other options]
147

EXAMPLES

149       To resample the 5 x 5 minute  grid  in  hawaii_5by5_topo.nc  onto  a  1
150       minute grid:
151
152              gmt grdsample hawaii_5by5_topo.nc -I1m -Ghawaii_1by1_topo.nc
153
154       To translate the gridline-registered file surface.nc to pixel registra‐
155       tion while keeping the same region and grid interval:
156
157              gmt grdsample surface.nc -T -Gpixel.nc
158

SEE ALSO

160       gmt, grdedit, grdfft, grdfilter, greenspline, surface
161
163       2019, P. Wessel, W. H. F. Smith, R. Scharroo, J. Luis, and F. Wobbe
164
165
166
167
1685.4.5                            Feb 24, 2019                     GRDSAMPLE(1)
Impressum