manpagez: man pages & more
man nearneighbor(1)
Home | html | info | man
nearneighbor(1)                       GMT                      nearneighbor(1)




NAME

       nearneighbor - "Grid table data using a ""Nearest neighbor"" algorithm"


SYNOPSIS

       nearneighbor [ table ]  -Gout_grdfile
        -Iincrement
        -Nsectors[/min_sectors]
        -Rregion
        -Ssearch_radius[unit] [  -Eempty ] [  -V[level] ] [  -W ] [  -bibinary
       ]  [  -dinodata  ] [ -eregexp ] [ -fflags ] [ -hheaders ] [ -iflags ] [
       -nflags ] [ -r ] [ -:[i|o] ]

       Note: No space is allowed between the option flag  and  the  associated
       arguments.


DESCRIPTION

       nearneighbor  reads  arbitrarily  located  (x,y,z[,w]) triples [quadru-
       plets] from standard input [or table] and uses a nearest neighbor algo-
       rithm  to  assign  an  average value to each node that have one or more
       points within a radius centered on the node. The average value is  com-
       puted  as  a weighted mean of the nearest point from each sector inside
       the search radius. The weighting function used is w(r) = 1 / (1 +  d  ^
       2),  where  d  = 3 * r / search_radius and r is distance from the node.
       This weight is modulated by the weights of the observation  points  [if
       supplied].


REQUIRED ARGUMENTS

       -Gout_grdfile
              Give the name of the output grid file.

       -Ixinc[unit][+e|n][/yinc[unit][+e|n]]
              x_inc  [and  optionally  y_inc] is the grid spacing. Optionally,
              append a suffix modifier.  Geographical  (degrees)  coordinates:
              Append  m  to indicate arc minutes or s to indicate arc seconds.
              If one of the units e, f, k, M, n or u is appended instead,  the
              increment  is assumed to be given in meter, foot, km, Mile, nau-
              tical mile or US survey foot, respectively,  and  will  be  con-
              verted  to  the equivalent degrees longitude at the middle lati-
              tude of the region (the conversion depends  on  PROJ_ELLIPSOID).
              If  y_inc is given but set to 0 it will be reset equal to x_inc;
              otherwise it will be converted to degrees latitude. All  coordi-
              nates:  If +e is appended then the corresponding max x (east) or
              y (north) may be slightly adjusted  to  fit  exactly  the  given
              increment  [by default the increment may be adjusted slightly to
              fit the given domain]. Finally, instead of giving  an  increment
              you  may  specify the number of nodes desired by appending +n to
              the supplied integer argument; the increment  is  then  recalcu-
              lated  from  the  number  of nodes and the domain. The resulting
              increment value depends on whether you  have  selected  a  grid-
              line-registered  or  pixel-registered grid; see App-file-formats
              for details. Note: if -Rgrdfile is used then  the  grid  spacing
              has already been initialized; use -I to override the values.

       -Nsectors[/min_sectors]
              The  circular area centered on each node is divided into sectors
              sectors. Average values will only be computed  if  there  is  at
              least  one value inside each of at least min_sectors of the sec-
              tors for a given node. Nodes that fail this  test  are  assigned
              the  value NaN (but see -E). If min_sectors is omitted it is set
              to be at least 50% of sectors (i.e., rounded up  to  next  inte-
              ger).   [Default  is a quadrant search with 100% coverage, i.e.,
              sectors = min_sectors = 4]. Note that only the nearest value per
              sector  enters  into  the averaging; the more distant points are
              ignored.

       -Rxmin/xmax/ymin/ymax[+r][+uunit] (more a|)
              Specify the region of interest.

       -Ssearch_radius[unit]
              Sets the search_radius that determines  which  data  points  are
              considered  close  to  a  node.  Append  the  distance unit (see
              UNITS).


OPTIONAL ARGUMENTS

       table  3 [or 4, see -W] column ASCII file(s) [or binary, see -bi] hold-
              ing (x,y,z[,w]) data values. If no file is specified, nearneigh-
              bor will read from standard input.

       -Eempty
              Set the value assigned to empty nodes [NaN].

       -V[level] (more a|)
              Select verbosity level [c].

       -W     Input data  have  a  4th  column  containing  observation  point
              weights.   These are multiplied with the geometrical weight fac-
              tor to determine the actual weights used in the calculations.

       -bi[ncols][t] (more a|)
              Select native binary input. [Default is 3 (or 4 if  -W  is  set)
              columns].

       -dinodata (more a|)
              Replace input columns that equal nodata with NaN.

       -e[~]^<i>apattern^<i>a | -e[~]/regexp/[i] (more a|)
              Only accept data records that match the given pattern.

       -f[i|o]colinfo (more a|)
              Specify data types of input and/or output columns.

       -h[i|o][n][+c][+d][+rremark][+rtitle] (more a|)
              Skip or produce header record(s).

       -icols[+l][+sscale][+ooffset][,^<i>a|] (more a|)
              Select input columns and transformations (0 is first column).

       -n[b|c|l|n][+a][+bBC][+tthreshold]
              Append  +bBC to set any boundary conditions to be used, adding g
              for geographic, p for periodic, or n for natural boundary condi-
              tions.  For the latter two you may append x or y to specify just
              one direction, otherwise both are  assumed.   [Default  is  geo-
              graphic if grid is geographic].

       -r (more a|)
              Set pixel node registration [gridline].

       -:[i|o] (more a|)
              Swap 1st and 2nd column on input and/or output.

       -^ or just -
              Print  a  short  message  about  the syntax of the command, then
              exits (NOTE: on Windows just use -).

       -+ or just +
              Print an extensive usage (help) message, including the  explana-
              tion  of  any  module-specific  option  (but  not the GMT common
              options), then exits.

       -? or no arguments
              Print a complete usage (help) message, including the explanation
              of all options, then exits.


UNITS

       For  map distance unit, append unit d for arc degree, m for arc minute,
       and s for arc second, or e for meter [Default], f for foot, k for km, M
       for  statute  mile,  n  for nautical mile, and u for US survey foot. By
       default we compute such distances using a spherical approximation  with
       great  circles.  Prepend - to a distance (or the unit is no distance is
       given) to perform aFlat Eartha calculations (quicker but less accurate)
       or  prepend  +  to perform exact geodesic calculations (slower but more
       accurate).


GRID VALUES PRECISION

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


EXAMPLES

       To  create  a  gridded data set from the file seaMARCII_bathy.lon_lat_z
       using a 0.5 min grid, a 5 km search radius, using an octant search with
       100% sector coverage, and set empty nodes to -9999:

              gmt nearneighbor seaMARCII_bathy.lon_lat_z -R242/244/-22/-20 -I0.5m \
                               -E-9999 -Gbathymetry.nc -S5k -N8/8

       To  make a global grid file from the data in geoid.xyz using a 1 degree
       grid, a 200 km search radius, spherical distances,  using  an  quadrant
       search, and set nodes to NaN only when fewer than two quadrants contain
       at least one value:

              gmt nearneighbor geoid.xyz -R0/360/-90/90 -I1 -Lg -Ggeoid.nc -S200k -N4


SEE ALSO

       blockmean(1), blockmedian(1), blockmode(1), gmt(1), greenspline(1),
       sphtriangulate(1), surface(1), triangulate(1)


COPYRIGHT

       2017, P. Wessel, W. H. F. Smith, R. Scharroo, J. Luis, and F. Wobbe



5.4.2                            Jun 24, 2017                  nearneighbor(1)

gmt5 5.4.2 - Generated Thu Jun 29 14:52:15 CDT 2017
© manpagez.com 2000-2025
Individual documents may contain additional copyright information.