GRDEDIT(1gmt) | GMT | GRDEDIT(1gmt) |
grdedit - Modify header or content of a grid
grdedit grid [ -A ] [ -C ] [ -D[+xxname][+yyname][+zzname][+sscale][+ooffset][+ninvalid][+ttitle][+rremark] ] [ -E[a|h|l|r|t|v] ] [ -Goutgrid ] [ -Jparameters ] [ -Ntable ] [ -Rregion ] [ -S ] [ -T ] [ -V[level] ] [ -bibinary ] [ -dinodata ] [ -eregexp ] [ -fflags ] [ -:[i|o] ]
Note: No space is allowed between the option flag and the associated arguments.
grdedit reads the header information in a binary 2-D grid file and replaces the information with values provided on the command line [if any]. As an option, global, geographical grids (with 360 degrees longitude range) can be rotated in the east-west direction, and individual nodal values can be replaced from a table of x, y, z values. grdedit only operates on files containing a grid header. Note: If it is important to retain the original data you should use -G to save the modified grid to a new file.
By default GMT writes out grid as single precision floats in a COARDS-complaint netCDF file format. However, GMT is able to produce grid files in many other commonly used grid file formats and also facilitates so called "packing" of grids, writing out floating point data as 1- or 2-byte integers. (more ...)
When the output grid type is netCDF, the coordinates will be labeled "longitude", "latitude", or "time" based on the attributes of the input data or grid (if any) or on the -f or -R options. For example, both -f0x -f1t and -R90w/90e/0t/3t will result in a longitude/time grid. When the x, y, or z coordinate is time, it will be stored in the grid as relative time since epoch as specified by TIME_UNIT and TIME_EPOCH in the gmt.conf file or on the command line. In addition, the unit attribute of the time variable will indicate both this unit and epoch.
Let us assume the file data.nc covers the area 300/310/10/30. We want to change the boundaries from geodetic longitudes to geographic and put a new title in the header. We accomplish this by
gmt grdedit data.nc -R-60/-50/10/30 -D+t"Gravity Anomalies"
The grid world.nc has the limits 0/360/-72/72. To shift the data so that the limits would be -180/180/-72/72, use
gmt grdedit world.nc -R-180/180/-72/72 -S
The file junk.nc was created prior to GMT 3.1 with incompatible -R and -I arguments. To reset the x- and y-increments we run
gmt grdedit junk.nc -A
The file junk.nc was created prior to GMT 4.1.3 and does not contain the required information to indicate that the grid is geographic. To add this information, run
gmt grdedit junk.nc -fg
To rotate the grid oblique.nc 90 degrees counter-clockwise and write out the rotated grid to a new file, run
gmt grdedit oblique.nc -El -Goblique_rot.nc
gmt, grd2xyz, grdinfo xyz2grd
2019, P. Wessel, W. H. F. Smith, R. Scharroo, J. Luis, and F. Wobbe
May 21, 2019 | 5.4.5 |