1GRDEDIT(1)                   Generic Mapping Tools                  GRDEDIT(1)
2
3
4

NAME

6       grdedit - Modifying the header or content of a 2-D grid file
7

SYNOPSIS

9       grdedit  grdfile [ -A ] [ -Dxname/yname/zname/scale/offset/title/remark
10       ] [ -E ] [ -Nxyzfile ] [ -Rwest/east/south/north[r] ] [ -S ] [ -T  ]  [
11       -V ] [ -:[i|o] ] [ -bi[s|S|d|D[ncol]|c[var1/...]] ] [ -f[i|o]colinfo ]
12

DESCRIPTION

14       grdedit  reads  the  header  information  in a binary 2-D grid file and
15       replaces the information with values provided on the command  line  [if
16       any].   As an option, global, geographical grids (with 360 degrees lon‐
17       gitude range) can be rotated in the east-west direction, and individual
18       nodal  values  can be replaced from a table of x, y, z values.  grdedit
19       only operates on files containing a grdheader.
20
21       grdfile
22              Name of the 2-D grid file to modify.   (See  GRID  FILE  FORMATS
23              below).
24

OPTIONS

26       No space between the option flag and the associated arguments.
27
28       -A     If  necessary,  adjust  the file's x_inc, y_inc to be compatible
29              with its domain (or a new domain set with -R).  Older grid files
30              (i.e.,  created  prior  to  GMT 3.1) often had excessive slop in
31              x_inc, y_inc and an adjustment is necessary.   Newer  files  are
32              created correctly.
33
34       -D     Give  new  values for xname, yname, zname, scale, offset, title,
35              and remark.  To leave some of the values untouched, specify = as
36              the new value.  Alternatively, to allow "/" to be part of one of
37              the values, use any  non-alphanumeric  character  (and  not  the
38              equal  sign)  as  separator by both starting and ending with it.
39              For example: -D:xname:yname:zname:scale:offset:title:remark:
40
41       -E     Transpose the grid and exchange the x and y information.  Incom‐
42              patible with the other options.
43
44       -H     Input file(s) has header record(s).  If used, the default number
45              of header records is N_HEADER_RECS.  Use -Hi if only input  data
46              should  have  header  records  [Default  will  write  out header
47              records if the input data have  them].  Blank  lines  and  lines
48              starting with # are always skipped.
49
50       -N     Read the ASCII (or binary; see -bi) file xyzfile and replace the
51              corresponding nodal values in the grid with these z values.
52
53       -R     xmin, xmax, ymin, and ymax specify the Region of interest.   For
54              geographic  regions,  these  limits  correspond  to  west, east,
55              south, and north and you may specify them in decimal degrees  or
56              in  [+-]dd:mm[:ss.xxx][W|E|S|N]  format.  Append r if lower left
57              and upper right map coordinates are given  instead  of  w/e/s/n.
58              The  two  shorthands  -Rg and -Rd stand for global domain (0/360
59              and -180/+180 in longitude respectively, with -90/+90  in  lati‐
60              tude).  Alternatively, specify the name of an existing grid file
61              and the -R settings (and grid spacing, if applicable) are copied
62              from  the  grid.   For  calendar time coordinates you may either
63              give (a) relative time (relative to the selected TIME_EPOCH  and
64              in  the  selected TIME_UNIT; append t to -JX|x), or (b) absolute
65              time of the form [date]T[clock] (append T to -JX|x).   At  least
66              one of date and clock must be present; the T is always required.
67              The date string must be of the form [-]yyyy[-mm[-dd]] (Gregorian
68              calendar) or yyyy[-Www[-d]] (ISO week calendar), while the clock
69              string must be of the form hh:mm:ss[.xxx].  The  use  of  delim‐
70              iters  and their type and positions must be exactly as indicated
71              (however, input, output and plot formats are  customizable;  see
72              gmtdefaults).   The new w/e/s/n values will replace those in the
73              grid, and the x_inc, y_inc values are adjusted, if necessary.
74
75       -S     For global,  geographical  grids  only.   Grid  values  will  be
76              shifted longitudinally according to the new borders given in -R.
77
78       -T     Make  necessary changes in the header to convert a gridline-reg‐
79              istered grid to a pixel-registered grid, or  vice-versa.   Basi‐
80              cally, gridline-registered grids will have their domain extended
81              by half the x- and y-increments whereas  pixel-registered  grids
82              will have their domain shrunk by the same amount.
83
84       -V     Selects verbose mode, which will send progress reports to stderr
85              [Default runs "silently"].
86
87       -bi    Selects binary input.  Append s for single precision [Default is
88              d  (double)].   Uppercase  S  or  D  will  force  byte-swapping.
89              Optionally, append ncol, the number of columns  in  your  binary
90              input  file if it exceeds the columns needed by the program.  Or
91              append c  if  the  input  file  is  netCDF.  Optionally,  append
92              var1/var2/...  to specify the variables to be read.  [Default is
93              3 input columns].
94
95       -f     Special formatting of input and/or output columns (time or  geo‐
96              graphical  data).   Specify  i  or  o to make this apply only to
97              input or output [Default applies to both].   Give  one  or  more
98              columns (or column ranges) separated by commas.  Append T (abso‐
99              lute calendar time), t (relative time in chosen TIME_UNIT  since
100              TIME_EPOCH),  x (longitude), y (latitude), or f (floating point)
101              to each column or column range item.  Shorthand  -f[i|o]g  means
102              -f[i|o]0x,1y (geographic coordinates).
103

GRID FILE FORMATS

105       By  default GMT writes out grid as single precision floats in a COARDS-
106       complaint netCDF file format.  However, GMT is  able  to  produce  grid
107       files  in  many  other commonly used grid file formats and also facili‐
108       tates so called "packing" of grids, writing out floating point data  as
109       2-  or 4-byte integers. To specify the precision, scale and offset, the
110       user should add the suffix =id[/scale/offset[/nan]], where id is a two-
111       letter  identifier of the grid type and precision, and scale and offset
112       are optional scale factor and offset to be applied to all grid  values,
113       and  nan  is  the  value  used  to indicate missing data.  When reading
114       grids, the format is generally automatically recognized.  If  not,  the
115       same  suffix can be added to input grid file names.  See grdreformat(1)
116       and Section 4.17 of the GMT Technical Reference and Cookbook  for  more
117       information.
118
119       When reading a netCDF file that contains multiple grids, GMT will read,
120       by default, the first 2-dimensional grid that can find in that file. To
121       coax  GMT  into  reading another multi-dimensional variable in the grid
122       file, append ?varname to the file name, where varname is  the  name  of
123       the variable. Note that you may need to escape the special meaning of ?
124       in your shell program by putting a backslash in  front  of  it,  or  by
125       placing  the  filename and suffix between quotes or double quotes.  The
126       ?varname suffix can also be used for output grids to specify a variable
127       name  different  from the default: "z".  See grdreformat(1) and Section
128       4.18 of the GMT Technical Reference and Cookbook for more  information,
129       particularly on how to read splices of 3-, 4-, or 5-dimensional grids.
130

GEOGRAPHICAL AND TIME COORDINATES

132       When  the  output  grid type is netCDF, the coordinates will be labeled
133       "longitude", "latitude", or "time" based on the attributes of the input
134       data  or  grid  (if  any) or on the -f or -R options. For example, both
135       -f0x -f1t and -R90w/90e/0t/3t will result  in  a  longitude/time  grid.
136       When  the  x, y, or z coordinate is time, it will be stored in the grid
137       as relative time since epoch as specified by TIME_UNIT  and  TIME_EPOCH
138       in the .gmtdefaults file or on the command line.  In addition, the unit
139       attribute of the time variable will indicate both this unit and epoch.
140

EXAMPLES

142       Let us assume the file data.grd covers the area 300/310/10/30.  We want
143       to change the boundaries from geodetic longitudes to geographic and put
144       a new title in the header.  We accomplish this by
145
146       grdedit data.grd -R-60/-50/10/30 -D=/=/=/=/=/"Gravity Anomalies"/=
147
148       The grid world.grd has the limits 0/360/-72/72.  To shift the  data  so
149       that the limits would be -180/180/-72/72, use
150
151       grdedit world.grd -R-180/180/-72/72 -S
152
153       The file junk.grd was created prior to GMT 3.1 with incompatible -R and
154       -I arguments.  To reset the x- and y-increments we run
155
156       grdedit junk.grd -A
157
158       The file junk.grd was created prior to GMT 4.1.3 and does  not  contain
159       the  required  information to indicate that the grid is geographic.  To
160       add this information, run
161
162       grdedit junk.grd -fg
163

SEE ALSO

165       GMT(1), grd2xyz(1), xyz2grd(1)
166
167
168
169GMT 4.5.6                         10 Mar 2011                       GRDEDIT(1)
Impressum