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 the .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
-A annot_int | Annotation interval
-C cont_int | Contour interval
-G gap | Sets distance between contour annotations
-L low/high | Only draw contours within the low to high range
-N unit | Append unit to contour annotations
-Q cut | Do not draw contours with fewer than cut points
-S smooth | 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[a c]pen | Set contour and annotation pens
-Z factor[/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