Example programs from the book

You can download all of the example programs from the book by clicking this link.  Move the zip file into your IDL search path, unzip it, and restart IDL.

Solutions to selected exercises

This file contains solutions to many of the end-of-chapter programming exercises.

General software library

My software library contains a variety of programs that may be of general use.  To keep the distribution simple, I have placed everything in a single zip file, which uncompresses to a single directory tree.  I have tried to make routine names as consistent as possible.  Most end with the suffix “_KPB”.  Some have been in use for too long for me to change them, however, particularly the date and time routines.

I have tried to make these routines as portable as possible, but I am not able to test them extensively, particularly on Windows systems, so please contact me if you encounter any problems or bugs.  This software is free and comes with no warranty whatsoever.

To download and install this software do the following:

  1. Download bowman_lib.zip (14.2 MB) to a location in your IDL search path.
  2. Unzip the file.
  3. Open the file add_to_startup.pro and edit the first DEFSYSV statement to point to the location of bowman_lib on your system.
  4. Copy the contents of add_to_startup.pro to your startup.pro file.  This is necessary so that some of the programs can find their associated data files.
  5. Restart IDL.

The library contains the following categories of software:

24-bit color images and graphics (color_24)

  • COLOR_24_KPB - create 24-bit colors directly from RGB values or by name
  • COLOR_BAR_24_KPB - draw a 24-bit color bar
  • COLOR_LOOKUP_24_KPB - scale arbitrary data into a 24-bit color scale
  • COMPONENT_24_KPB - extract one RGB component from a 24-bit image
  • IMAGE_24_KPB - convert a 24-bit (LONG) image into and RGB image
  • LOAD-BASIC_COLORS_KPB - load a set of colors into the 8-bit PS device
  • MAP_IMAGE_KPB - wrapper for MAP_IMAGE to handle missing data (NaNs)
  • PLOT_IMAGE_KPB - plot a 24-bit image with axes, titles, etc.


Color tables (color_tables)

  • TOPOGRAPHY_BATHYMETRY_KPB - quasi-realistic color table for plotting topography

iTools (itools)

  • ISURFACE_EXAMPLE_KPB - demonstrate use of iSurface to plot topographic data
  • ISURFACE_OPEN_KPB - open an iTools Save File (.isv) programmatically
  • ITOOL_ROTATE_VIEW_KPB - rotate an iTools view around a specified axis by a specified amount
  • ITOOL_SAVE_ISV_KPB - save the current iTool as an ISV file
  • ITOOL_SPIN_MOVIE_KPB - spin an iTool view around an axis and save the images to make a movie
  • ITOOL_WRITE_GRAPHIC_KPB - capture the current iTool graphic in any one of the standard file formats (BMPEPSJPEGJPEG2000GIFPICTPNG, andTIFF)
  • RUN_ISURFACE_EXAMPLE_KPB - run ISURFACE_EXAMPLE_KPB and save selected graphics files

Land-Ocean Masks (land_ocean)

  • LAND_OCEAN_EXAMPLE_KPB - demonstrate use of the land-ocean data
  • LAND_OCEAN_READ_KPB - read a land-ocean data set and return a structure
  • data - This directory contains the ISLSCP2 global land-water masks in several forms and resolutions.  The data sets include land-ocean masks (ocean only), land-water masks (including inland water masses), and inland water masks (inland water masses only).  The data are global grids with resolutions of 1°, 0.5°, and 0.25°.  Variables include binary masks (0’s and 1’s) and percentage land or water coverage for each grid cell.  There is a README file explaining how to use the data and software.  The original descriptions of the data files from the data provider are also included.

Miscellaneous (misc)

  • ARC_AZIMUTH_KPB - vectorized version of MAP_2POINTS
  • LL_ARC_AZIMUTH_KPB - vectorized version of LL_ARC_AZIMUTH
  • INDEX_OF_NEAREST - find the index of the element of an array x with the value closest to x0
  • MAKEN - copied from the JHU APL library for convenience

NetCDF (netcdf)

  • examples - the UNIDATA netCDF example programs implemented in IDL
  • IS_NETCDF_KPB - tests whether a file is a netCDF file
  • NCDF_READ_VAR_KPB - read a variable and its attributes from a netCDF file, return a data structure
  • NCDF_VAR_EXISTS_KPB - check whether a variable exists in a netCDF file

Date and time programs (time)

  • This directory contains multiple procedures and functions to do date and time calculations that are exact to the second.  See the README file for information on how to use these routines.

Topography (topo)

  • TOPO_EXAMPLE_KPB - demonstrate use of the topographic data
  • TOPO_READ_5_MINUTE_KPB - read the 5-minute global topographic data
  • TOPO_READ_10_MINUTE_KPB - read the 10-minute global topographic data
  • data - This directory contains two global topographic databases.  The first is a global database of topography (no ocean bathymetry) at 10’ resolution (2160 x 1080).  The second contains both topography and bathymetry at 5’ resolution (4320 x 2160).  There is a README file explaining how to use the data and software.  The original descriptions of the data files from the data provider are also included.

Statistics (statistics)

  • CORRELATION_SIGNIFICANCE_KPB - compute the statistical significance of a correlation coefficient for normally distributed random variables
  • REGRESSION_STATISTICS_KPB - compute confidence limits for the coefficients of a simple linear regression assuming normally distributed residuals