The surface program assumes that the data have been preprocessed to eliminate aliasing, hence we must ensure that this step is completed prior to gridding. GMT comes with three preprocessors, called blockmean , blockmedian , and blockmode . The first averages values inside the grid-spacing boxes, the second returns median values, wile the latter returns modal values. As a rule of thumb, we use means for most smooth data (such as potential fields) and medians (or modes) for rough, non-Gaussian data (such as topography). In addition to the required -R and -I switches, these preprocessors takes the same options:
|
With respect to our ship data we preprocess it using the median method:
blockmedian -R245/255/20/30 -I5m -V ship.xyz >! ship_5m.xyz
The output data can now be used with surface:
surface ship_5m.xyz -R245/255/20/30 -I5m -Gship.grd -V
If you rerun grdcontour on the new grid file (try it!) you will notice a big difference compared to the grid made by nearneighbor : since surface is a global method it will evaluate the solution at all nodes, even if there are no data constraints. There are numerous options available to us at this point:
Here we have only time to explore the latter approach. The psmask program can read the same preprocessed data and set up a contour mask based on the data distribution. Once the clip path is activated we can contour the final grid; we finally deactivate the clipping with a second call to psmask . Here's the recipe:
psmask -R245/255/20/30 -I5m ship_5m.xyz -JM6i -B2 -P -K -V >! map.ps grdcontour ship.grd -JM -O -K -C250 -A1000 >> map.ps psmask -C -O >> map.ps