next up previous contents index
Next: 4.4.1 Exercises Up: 4. SESSION FOUR Previous: 4.3.1 Exercises   Contents   Index


4.4 Multi-dimensional maps

Climate data, like ocean temperatures or atmospheric pressure, are often provided as multi-dimensional (3-D, 4-D or 5-D) grids in netCDF format. This section will demonstrate that GMT is able to plot ``horizonal'' slices (spanning latitude and longitude) of such grids without much effort.

As an example we will download the Seasonal Analysed Mean Temperature from the World Ocean Atlas 1998. The file in question is named otemp.anal1deg.nc.

You can look at the information pertained in this file using the program ncdump and notice that the variable that we want to plot (otemp) is a four-dimensional variable of time, level (i.e., depth), latitude and longitude.

ncdump -h otemp.anal1deg.nc

We will need to make an appropriate color scale, running from -2°C (freezing temperature of salt water) to 30°C (highest likely ocean temperature). We do this as follows:

makecpt -Cno_green -T-2/30/2 > otemp.cpt

Let us focus on the temperatures in Summer (that is the third season, July through September) at sea level (that is the first level). To plot these in a Mollweide projection we use:

grdimage -Rg -JW180/9i "otemp.anal1deg.nc?otemp[2,0]" -Cotemp.cpt -Bg30 \
   > otemp.ps

The addition ?otemp[2,0] indicates which variable to retrieve from the netCDF file (otemp) and that we need the third time step and first level. The numbering of the time steps and levels starts at zero, therefore [2,0]. Make sure to put the whole file name within quotes since the characters ?, [ and ] have special meaning in Unix.



Subsections
next up previous contents index
Next: 4.4.1 Exercises Up: 4. SESSION FOUR Previous: 4.3.1 Exercises   Contents   Index
Paul Wessel 2009-07-13