Wednesday, December 30, 2015

Script: version 2.0; create elegant color scales for your plots using GrADS

Whats New?

  • New Maps Added!
  • Bug involving rounding issues has been fixed
  • option for custom user levels

This script was created to make it easy to generate very pretty color scales for plotting.  These maps are generally based off of preexisting color scales for matplotlib from python, or ncl, or other common color scales.  This script attempts to reproduce these for GrADS.  For more information on this script see the original blog post here.

The following two commands may prove useful to you:

  'colormaps -help'
  'colormaps -demo'

I include a couple of images showing the updates in action.

1. The following image is made using the new '-custom' option and the new c3pcpn color scale.

  'set display color white'
  ' set gxout shaded'
  'colormaps -map s3pcpn -custom 0 1 2 3 4 5 7.5 10 12.5 15 20 25 30 35 40 45 50 60 70 80 90 100' 
  'd sum(apcpsfc,t=1,t=48,2)'
  'xcbar -fs 2'
GFS precipitation using custom user levels in

2. The following map is the GFS Topography using the ncl_topo option.  

Since this scale was added specifically for topographical maps, there is a special feature that sets the lowest level to blue, and all subsequent levels to follow the linear topography scale.

  'set display color white'
  ' set gxout shaded'  'colormaps -map ncl_topo -levels 0.01 3.75 0.25'
  'd hgtsfc/1000'  
  'xcbar -fs 8'
GFS Topography with special color map


Aside from that, the rest should be self explanatory if you read the help page, and check out the original blog post.  As always, if you find bugs or have new suggestions, let me know!


  1. I am trying to use Colormaps_v2 to show wind speed. I use this line before my 'D' command: 'colormaps_v2 -l 40 100 1 -map oj2p'

    Instead of only shading areas > 40 it shades everything, though 0-40 is all within one color.

    I am misunderstanding how this is used?

    1. I think that's intrinsic to GrADS. For example, everything below the minimum value is set to the lowest color level. I usually get around this by setting the lowest level to the background color, or using a basemap and saving the image with the lowest color number set to transparent. Some of the sequential colormaps have a white or black start that can match a background color.

  2. I don't know that how to use these apps. Can you give me some suggestion through by your post. Thanks
    gclub casino