.. _example_15:

(15) Gridding, contouring, and masking of unconstrained areas
-------------------------------------------------------------

This example 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
:doc:`gmtconvert </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
(:doc:`nearneighbor </nearneighbor>`) which is a local
method: No output is given where there are no data. Next (lower right),
we use a minimum curvature technique
(:doc:`surface </surface>`) which is a global method.
Hence, the contours cover the entire map although the data are only
available for portions of the area (indicated by the gray areas plotted
using :doc:`psmask </psmask>`). The top left scenario
illustrates how we can create a clip path (using
:doc:`psmask </psmask>`) based on the data coverage to
eliminate contours outside the constrained area. Finally (top right) we
simply employ :doc:`pscoast </pscoast>` to overlay gray
land masses to cover up the unwanted contours, and end by plotting a
star at the deepest point on the map with
:doc:`psxy </psxy>`. This point was extracted from the
grid files using :doc:`grdinfo </grdinfo>`.

.. literalinclude:: /_verbatim/example_15.txt
   :language: bash

.. figure:: /_images/example_15.*
   :width: 500 px
   :align: center

   Gridding, contouring, and masking of data.

