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

  3. I like your blog, I read this blog please update more content on python, further check it once at python online training

  4. เลเซอร์หน้าใส เป็นอีกหนึ่งสิ่งใหม่ทางความงดงามที่ช่วยฟื้นฟูผิวหนังที่แห้งกระด้าง บริเวณใบหน้าหมองคล้ำให้กลับมาแจ่มใสมองเบิกบานใจ ผ่องแผ้วภายในช่วงเวลาอันเร็วทันใจ นับว่าเป็นทางลัดความงดงามที่กำลังเป็นที่นิยมสูง ช่วยดูแลผิวให้ขาวกระจ่างขาวสวยใส จากการลดลางเลือนริ้วรอยจุดด่างดำได้อย่างมีคุณภาพ


  5. ปรับรูปหน้าเรียว
    ฉีดหน้าเรียว ลดริ้วรอย คือ อยากหน้าเรียวทำได้ไง หลายๆคนคงเกิดคำถามนี้
    และการฉีดลดหน้าเรียวด้วยโบท็อกก็เป็นวิธีการรักษาที่ทำได้ง่าย โดยไม่ต้องผ่าตัด

  6. Hi,
    Thanks for your nice script. The difference map gives wrong result.
    'For example colormaps_v2 -map b2r -l -1.5 1.5 0.3'
    The above gives a white color for a positive value, which is not same for the negative value. In this case I get white color from the value range '0 0.3'. Could you please provide me the solutions.