When the netCDF file contains more than one 2-dimensional variable, GMT programs will load the first such variable in the file and ignore all others. Alternatively, the user can select the required variable by adding the suffix ``?varname'' to the file name. For example, to get information on the variable ``slp'' in file file.nc, use:
grdinfo "file.nc?slp"Since COARDS-compliant netCDF files are the default, the additional suffix ``=nf'' can be omitted.
In case the named variable is 3-dimensional, GMT will load first (bottom) layer. If another layer is required, either add ``[index]'' or ``(level)'', where index is the index of the third (depth) variable (starting at 0 for the first layer) and level is the numerical value of the third (depth) variable associated with the requested layer. To indicate the second layer of the 3-D variable ``slp'' use as file name: file.nc?slp.
When you supply the numerical value for the third variable using ``(level)'', GMT will pick the layer closest to that value. No interpolation is performed.
Note that the question mark, brackets and parentheses have special meanings on Unix-based platforms. Therefore, you will need to either escape these characters, by placing a backslash in front of them, or place the whole file name plus modifiers between single quotes or double quotes.
A similar approach is followed for loading 4-dimensional grids. Consider a 4-dimensional grid with the following variables:
lat(lat): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 lon(lon): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 depth(depth): 0, 10, 20, 30, 40, 50, 60, 70, 80, 90 time(time): 0, 12, 24, 36, 48 pressure(time,depth,lat,lon): (5000 values)To get information on the 1010 grid of pressure at depth 10 and at time 24, one would use:
grdinfo "file.nc?pressure[2,1]"or (only in case the coordinates increase linearly):