Saturday, May 3, 2014

Script:; very easily create elegant color scales for your plots using GrADS

Version 2

If you are a frequent visitor to this site you probably know that I focus a lot of my effort into color scales.  I often reference the script as a must have script in ones script library.  I have additionally added the script to the script library for use with common remote sensing color scales.  This script here is similar to, but different in the sense that it gives the user control as to what number scale the color map will be set to. currently includes 21 color scales (with the option of reversing them).  These scales are shown below.

Colorscales included in

Optional Arguments for
  • -demo             - Pulls up Demo page
  •  -flipped          - Reverses direction of color scale
  •  -name/map     - chooses colormap
  •  -levels/l          - sets scale: max min int
  • -help                - Pulls up help page (includes full list of color maps)

Example: Open WRF data and plot the 2 meter dew point using the  reversed "ocean" color map

  'set gxout shaded'
  'set mpdset hires'
  ' colormaps -flipped -l 265 310 1 -map ocean'
  'd dpt2m'


This series of commands will produce the following image.

2m Dew Point using "Ocean" colormap

This is the first version, so check for bugs and please report any you find!


  1. gorgeous! it make grads more matplotlib-style

  2. It'd be nice if I can specify individual color levels, in addition to min/max/int.

  3. I need your hepl when I run I get a trouble in GrADS, the problem is:
    "Unable to locate ENDIF statement for the IF statement at line 11
    In file"

    1. How are your calling the script? I am interested to find out if this is a bug. I am currently working on a newer version that includes more color scales and options to specify levels. Also there appears to be an issue with setting the color levels that I am working out. It would be nice to know if there is another bug I need to check out.