next up previous contents index
Next: 7.16 Gridding of data, Up: 7. Cook-book Previous: 7.14 Gridding of data   Contents   Index


7.15 Gridding, contouring, and masking of unconstrained areas

This example (Figure 7.15) demonstrates some off the different ways one can use to grid data in GMT, and how to deal with unconstrained areas. We first convert a large ASCII file to binary with gmtconvert since the binary file will read and process much faster. Our lower left plot illustrates the results of gridding using a nearest neighbor technique (nearneighbor) which is a local method: No output is given where there are no data. Next (lower right), we use a minimum curvature technique (surface) which is a global method. Hence, the contours cover the entire map allthough the data are only available for portions of the area (indicated by the gray areas plotted using psmask). The top left scenario illustrates how we can create a clip path (using psmask) based on the data coverage to eliminate contours outside the constrained area. Finally (top right) we simply employ pscoast to overlay gray landmasses to cover up the unwanted contours, and end by plotting a star at the deepest point on the map with psxy. This point was extracted from the gridded files using grdinfo.





#!/bin/csh
#        GMT EXAMPLE 15
#
#        $Id: job15.csh,v 1.4 2004/04/10 17:19:14 pwessel Exp $
#
# Purpose:    Gridding and clipping when data are missing
# GMT progs:    blockmedian, gmtconvert, grdclip, grdcontour, grdinfo, minmax,
#        nearneighbor, pscoast, psmask, pstext, surface
# Unix progs:    awk, echo, rm
#
gmtconvert ship.xyz -bo >! ship.b
set region = `minmax ship.b -I1 -bi3`
nearneighbor $region -I10m -S40k -Gship.grd ship.b -bi3
set info = `grdinfo -C -M ship.grd`
grdcontour ship.grd -JM3i -P -B2WSne -C250 -A1000 -G2i -K -U"Example 15 in Cookbook" >! example_15.ps
#
blockmedian $region -I10m ship.b -bi3 -bo >! ship_10m.b
surface $region -I10m ship_10m.b -Gship.grd -bi3
psmask $region -I10m ship.b -J -O -K -T -Glightgray -bi3 -X3.6i >> example_15.ps
grdcontour ship.grd -J -B2WSne -C250 -L-8000/0 -A1000 -G2i -O -K >> example_15.ps
#
psmask $region -I10m ship_10m.b -bi3 -J -B2WSne -O -K -X-3.6i -Y3.75i >> example_15.ps
grdcontour ship.grd -J -C250 -A1000 -L-8000/0 -G2i -O -K >> example_15.ps
psmask -C -O -K >> example_15.ps
#
grdclip ship.grd -Sa-1/NaN -Gship_clipped.grd
grdcontour ship_clipped.grd -J -B2WSne -C250 -A1000 -L-8000/0 -G2i -O -K -X3.6i >> example_15.ps
pscoast $region -J -O -K -Ggray -W0.25p >> example_15.ps
echo $info[12] $info[13] | psxy -R -J -O -K -Sa0.15i -W1p >> example_15.ps
echo "-0.3 3.6 24 0 1 CB Gridding with missing data" | pstext -R0/3/0/4 -Jx1i -O -N >> example_15.ps
\rm -f ship.b ship_10m.b ship.grd ship_clipped.grd .gmt*





Figure 7.15: Gridding, contouring, and masking of data.
\includegraphics[]{eps/GMT_example_15}


next up previous contents index
Next: 7.16 Gridding of data, Up: 7. Cook-book Previous: 7.14 Gridding of data   Contents   Index
Paul Wessel 2006-01-01