XYZT to a 3D Surface
The next transformation is from a list of bathymetric depths and their locations, to a grid of averaged depths, spacially distributed over the surface and then on to a pretty picture. The trick is done by one of the GMT tools: nearneighbor, surface, or triangulate and then by grdview and grdcontour. But these tools require clean data that has been analyzed for its limits and preprocessed other GMT tools.
Cleaning the data
The raw data will likely have some values that have nothing to do with reality: "outliers." If you look at your data set with gnuplot, you will see them. If they are way out of range, they may make the data set look like it is misplaced or missing. In the sample data set which covers only about a half mile in reality, you can see that there are points many degrees of latitude and longitude away.
The fix is a band pass filter, one that removes the extremes. I use my own filter, the instructions follow. GMT has several filters, the most appropriate for this task is gmtselect.
My band pass filter rejects data outside of the minimum and maximum specified, or, if you wish, outside of a standard deviantion value.
Here is the program BandPass.PL
usage: BandPass -i <inputFile> -o <outputFile> [<options>] ( input and output files must be specified ) options: -e | --errorFile <errorFile> for rejected records -X | --sigmaX <value> -Y | --sigmaY <value> -Z | --sigmaZ <value> -T | --sigmaT <value> --minX | --minLong <value> --maxX | --maxLong <value> --minY | --minLat <value> --maxY | --maxLat <value> --minZ | --minDepth <value> --maxZ | --maxDepth <value> --minT | --minTime <value> --maxT | --maxTime <value> -v | --verbose -h | --help
If we use the BandPass filter with the following arguments,
$ BandPass -minX -62 -maxX -61 -minY 12 -maxY 13.5 \ -minZ 0.5 -maxZ 100 -minT 10000000000 -maxT 20000000000 \ -i raw.xyzt -o all.xyztand hand editing out a few lines that showed up using Stats, the result looks like image to the right.
Using the Stats Perl program to look at the data before and after the bandpass filter, we see:
34584 Raw Data -- Before BandPass filter
34348 Data -- After BandPass filter