SPH2GRD(1gmt) | GMT | SPH2GRD(1gmt) |
sph2grd - Compute grid from spherical harmonic coefficients
sph2grd [ table ] -Ggrdfile
-Iincrement
-Rregion [ -D[g|n] ] [ -E ] [
-F[k]filter ] [ -N[norm] ] [ -Q ]
[ -V[level] ] [ -bibinary ] [ -hheaders ] [
-iflags ] [ -r ] [ -x[[-]n] ]
Note: No space is allowed between the option flag and the associated arguments.
sph2grd reads a spherical harmonics coefficient table with records of L, M, C[L,M], S[L,M] and evaluates the spherical harmonic model on the specified grid.
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 precision once GMT operates on the grid or writes out new grids. To limit loss of precision when processing data you should always consider normalizing the data prior to processing.
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. To specify the precision, scale and offset, the user should add the suffix =ID[+sscale][+ooffset][+ninvalid], where ID is a two-letter identifier of the grid type and precision, and scale and offset are optional scale factor and offset to be applied to all grid values, and invalid is the value used to indicate missing data. See grdconvert and Section grid-file-format of the GMT Technical Reference and Cookbook for more information.
When writing a netCDF file, the grid is stored by default with the variable name "z". To specify another variable name varname, append ?varname to the file name. Note that you may need to escape the special meaning of ? in your shell program by putting a backslash in front of it, or by placing the filename and suffix between quotes or double quotes.
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.
To create a 1 x 1 degree global grid file from the ASCII coefficients in EGM96_to_360.txt, use
gmt sph2grd EGM96_to_360.txt -GEGM96_to_360.nc -Rg -I1 -V
Holmes, S. A., and Featherstone, W. E., 2002, A unified approach to the Clenshaw summation and the recursive computation of very high degree and order normalized associated Legendre functions: J. Geodesy, v. 76, p. 279-299.
gmt, grdfft, grdmath
2019, P. Wessel, W. H. F. Smith, R. Scharroo, J. Luis, and F. Wobbe
May 21, 2019 | 5.4.5 |