Data files for some examples
Example pages containing:
This page describes various ways to create topographic maps,
either by reading them from a binary or NetCDF file, or by
importing an existing JPEG image and recreating it.
You can find many free topographic maps (as datasets or images) on the
web, including a good site from NOAA:
There are some high-resolution images available via
Nasa's Blue Marble imagery and the 3rd party True Marble:
Importing JPEG images
Importing JPEG images into NCL requires converting the JPEG image to a
NetCDF file. We use a free tool called "gdal_translate", which is part
of the GDAL - Geospatial Data
Abstraction software package.
You can download
binaries for Linux and Mac, or you can download
code and build it yourself.
Building from source requires that you build GDAL with NetCDF support:
./configure --prefix=/path/for/install --with-netcdf=/path/to/netcdf
make all install
placeholders. You need to replace them with the appropriate paths.
This script draws a (now deprecated) 5' topographic map using binary data
This binary file doesn't contain any latitude/longitude values, so
these arrays have to be generated in the script. The data comes with
description of how to read it and create the lat/lon arrays.
The default NCL color map is used just to quickly show what the data looks like.
This script uses the same data as the previous example, except
it uses a custom color map. The labelbar is labeled using min/max
labels, and a middle level to indicate where the color map was
split between ocean and land values.
This script draws a (now deprecated) 2' topographic map using NetCDF data
The cnFillMode resource is set to "MeshFill" for
faster plotting. The default "AreaFill" is too slow.
The data are of type "short" with scale_factor and add_offset
attributes; the short2flt
function is used to unpack the values into a float type.
All elevation values less than -100 are set to missing so there are
effectively no contours over the ocean. The ocean is filled in with a
This script draws a topographic map from the same 2' data as the previous
example, except it zooms in on Australia and New Zealand.
"RasterFill" is used in place of "MeshFill" for comparison.
This example is similar to the WRF "newcolor_10.ncl" example on
the new color capabilities
which shows how to plot "dbz" from a WRF output file on a terrain
map. Instead of using the "HGT" variable on the WRF output file to
plot terrain, it uses the 2' topo map from examples 3 and 4 above.
This gives you a better resolution for terrain, if you need it.
A different colormap is used for dbz, just to show how you can do
this. If you set ANIMATE to True, then the script will loop across
This script is based on the "newcolor_11.ncl" script
on the New color capabilities
page. It shows how to use NCL to recreate an existing JPEG that contains a topographic map. By doing this, you can then change the map projection,
zoom in on it, and/or overlay primitives, as we did here with a red box.
The open source tool gdal_translate was
used to convert the jpeg file to a NetCDF file:
gdal_translate -ot Int16 -of netCDF EarthMap_2500x1250.jpg EarthMap_2500x1250.nc
This example only works for "x11" or "png" output, and not with
"ps" and "pdf" output.
: This example shows
how to panel vector plots overlaid on topographic maps, and then
draw only one vector reference annotation box.
The vector reference annotation box is turned off for all plots except
the lower rightmost one, by setting
res@vcRefAnnoOn = False for all but
that one plot. The box is moved to the outside right of that plot by
The topographic map is created by reading in a JPEG image. See example
newcolor_11.ncl on the RGBA page.
This image can be slow to create, so set TOPO_MAP to False in the
script if you just want to generate a generic NCL map object (see