(2) Image presentations

As our second example we will demonstrate how to make color images from gridded data sets (again, we will defer the actual making of grid files to later examples). We have prepared two 2-D grid files of bathymetry and Geosat geoid heights from global grids and will put the two images on the same page. The region of interest is the Hawaiian Islands, and due to the oblique trend of the island chain we prefer to rotate our geographical data sets using an oblique Mercator projection defined by the hotspot pole at (68W, 69N). We choose the point (190, 25.5) to be the center of our projection (e.g., the local origin), and we want to image a rectangular region defined by the longitudes and latitudes of the lower left and upper right corner of region. In our case we choose (160, 20) and (220, 30) as the corners. We twice use grdimage to make the illustration:

using GMT

gmtset(FONT_TITLE=30, MAP_ANNOT_OBLIQUE=0)
g_cpt = makecpt(color=:rainbow, T=(-2,14,2))
grdimage("@HI_geoid_02.nc", region_diag=(160,220,20,30),
         proj=(name=:omercp, center=[190 25.5], parallels=[292 69]),
         dpi=50, frame=(annot=10,), xshift=3.8, yshift=3.2, figsize=12)
colorbar!(pos=(anchor=:RM, offset=(1.5,0), triangles=true, neon=true),
          xaxis=(annot=2, label=:GEOID), yaxis=(label=:m,))
		
# Now the topography map
t_cpt = grd2cpt("@HI_topo_02.nc", cmap=:relief, continuous=true)
grdimage!("@HI_topo_02.nc", frame=(title="H@#awaiian@# T@#opo and @#G@#eoid@#", annot=10),
          shade="+a0", dpi=50, yshift=11, par=(:MAP_TITLE_OFFSET, 1.25))
colorbar!(pos=(anchor=:RM, offset=(1.5,0), neon=true), shade=0.3,
          xaxis=(annot=2, label=:TOPO), yaxis=(label=:km,))
T = mat2ds([-0.4 7.5; -0.4 3.0], ["a)", "b)"])
pstext!(T, region=(0,21.6,0,29.94), font=(30,"Helvetica-Bold"), justify=:CB,
        yshift=11, proj=:linear, scale=1, show=true)

We again set up a 2 by 1 subplot layout and specify the actual region and map projection we wish to use for the two map panels. We use makecpt to generate a linear color palette file for the geoid and use grd2cpt to get a histogram-equalized CPT for the topography data. We run grdimage to create a color-coded image of the topography, and to emphasize the structures in the data we use the slopes in the north-south direction to modulate the color image via the shade option. Then, we place a color legend to the right of the image with colorbar. We repeat these steps for the Geosat geoid grid. Again, the labeling of the two plots with a) and b) is automatically done by subplot.