Next: 3.1.1 Exercises Up: 3. SESSION THREE Previous: 3. SESSION THREE Contents Index

# 3.1 Contouring gridded data sets

GMT comes with several utilities that can create gridded data sets; we will discuss two such programs later this session. First, we will assume that we already have gridded data sets. In the supplemental GMT archive there is a program that serves as a data extractor from several public domain global gridded data sets. Among these data are ETOPO5, crustal ages, gravity and geoid, and DEM for the continental US. Here, we will use grdraster to extract a GMT-ready grid that we will next use for contouring:

    grdraster 1 -R-66/-60/30/35 -Gbermuda.nc -V

Here we use the file extension .nc instead of the generic .grd to indicate that this is a netCDF file. It is good form, but not essential, to use .nc for netCDF grids. Using that extension will help other programs installed on your system to recognize these files and might give it an identifiable icon in your file browser. Learn about other programs that read netCDF files at the netCDF website You can find bermuda.nc also in the tutorial directory of you GMT installation. Feel free to open it in any other program and compare results with GMT.

We first use the GMT program grdinfo to see what's in this file:

    grdinfo bermuda.nc

The file contains bathymetry for the Bermuda region and has depth values from -5475 to -89 meters. We want to make a contour map of this data; this is a job for grdcontour. As with previous plot commands we need to set up the map projection with -J. Here, however, we do not have to specify the region since that is by default assumed to be the extent of the grid file. To generate any plot we will in addition need to supply information about which contours to draw. Unfortunately, grdcontour is a complicated program with too many options. We put a positive spin on this situation by touting its flexibility. Here are the most useful options:

Table 3.1: The most useful options in grdcontour.

Option | Purpose
-Aannot_int | Annotation interval
-Ccont_int | Contour interval
-Ggap | Sets distance between contour annotations
-Llow/high | Only draw contours within the low to high range
-Nunit | Append unit to contour annotations
-Qcut | Do not draw contours with fewer than cut points
-Ssmooth | Resample contours every x_inc/smooth increment
-T[+-][gap/length][:LH] | Draw tick-marks in downhill direction for innermost closed contours
| Add tick spacing and length, and characters to plot at the center of closed contours.
-W[ac]pen | Set contour and annotation pens
-Zfactor[/offset] | [Subtract offset] and multiply data by factor prior to processing

We will first make a plain contour map using 1 km as annotation interval and 250 m as contour interval. We choose a 7-inch-wide Mercator plot and annotate the borders every 2°:

    grdcontour bermuda.nc -JM7i -C250 -A1000 -P -B2 | ghostview -

Subsections

- 3.1.1 Exercises

Next: 3.1.1 Exercises Up: 3. SESSION THREE Previous: 3. SESSION THREE Contents Index