Log In | Users | Register

Color Tables

This page gives an overview of the standard color tables and corresponding contour levels that are provided by the COSMO Library. For an overview of the native NCL colortables, have a look at the NCL colortables. The color tables are identified by a unique name. Details of how to create your own custom color tables and a description of the color table file format are given below.

Gallery
default precip1h_17lev precip_lom_inst_15lev precip_lom_gt6h_15lev topo_15lev prob_9lev step_25lev vort_19lev diff_19lev
default.png precip1h_17lev.png precip_lom_inst_15lev.png precip_lom_gt6h_15lev.png topo_15lev.png prob_9lev.png step_25lev.png vort_19lev.png diff_19lev.png

Official KD colortables according to the official reference document. The missing values have been defined as grey. The absolute color index 7 of the default color table (RGB = 192 192 192) can be used for this purpose.

Precipitation

kd_precip_10min kd_precip_1h kd_precip_1d kd_precip_1m kd_precip_1y kd_precip_barplot kd_precip_rel_1m kd_precip_rel_1y
kd_precip_10min.png kd_precip_1h.png kd_precip_1d.png kd_precip_1m.png kd_precip_1y.png kd_precip_barplot.png kd_precip_rel_1m.png kd_precip_rel_1y.png

Sunshine Duration

kd_sunshine_1d kd_sunshine_1m kd_sunshine_1y kd_sunshine_rel_1m kd_sunshine_rel_1y
kd_sunshine_1d.png kd_sunshine_1m.png kd_sunshine_1y.png kd_sunshine_rel_1m.png kd_sunshine_rel_1y.png

Temperature

kd_temp_1d kd_temp_1m kd_temp_1y kd_temp_barplot kd_temp_diff_1d kd_temp_diff_1m kd_temp_diff_1y
kd_temp_1d.png kd_temp_1m.png kd_temp_1y.png kd_temp_barplot.png kd_temp_diff_1d.png kd_temp_diff_1m.png kd_temp_diff_1y.png

GIN color tables (inspired by Marco Stoll and/or identical to NinJo visualisation platform)

rr_ninjo_21lev temp_ninjo_49lev hzero_17lev snow_17lev wind_ninjo_13lev
rr_ninjo_21lev.png temp_ninjo_49lev.png hzero_17lev.png snow_17lev.png wind_ninjo_13lev.png

All Color Tables available in the operational OSM cosmolib (may include the ones above...) NEW

RH_6lev T1000_26lev T10500_26lev T150_26lev T2000_26lev T200_26lev T250_26lev T3000_26lev T300_26lev T4000_26lev T400_26lev T5000_26lev
RH_6lev.png T1000_26lev.png T10500_26lev.png T150_26lev.png T2000_26lev.png T200_26lev.png T250_26lev.png T3000_26lev.png T300_26lev.png T4000_26lev.png T400_26lev.png T5000_26lev.png

T500_26lev T700_26lev T8500_26lev T850_26lev betu_4lev cape3km_14lev capeMU_13lev cape_12lev cape_13lev cape_16lev cin_13lev cin_15lev
T500_26lev.png T700_26lev.png T8500_26lev.png T850_26lev.png betu_4lev.png cape3km_14lev.png capeMU_13lev.png cape_12lev.png cape_13lev.png cape_16lev.png cin_13lev.png cin_15lev.png

clc_5lev clc_6lev dd_24lev default diff_18lev diff_19lev dursun_15lev hi_40lev hi_4lev hpbl_16lev hzero_17lev hzero_20lev
clc_5lev.png clc_6lev.png dd_24lev.png default.png diff_18lev.png diff_19lev.png dursun_15lev.png hi_40lev.png hi_4lev.png hpbl_16lev.png hzero_17lev.png hzero_20lev.png

hzero_21lev hzero_25lev index_21lev index_22lev kd_precip_10min kd_precip_1d kd_precip_1h kd_precip_1m kd_precip_1y kd_precip_barplot kd_precip_rel_1m kd_precip_rel_1y
hzero_21lev.png hzero_25lev.png index_21lev.png index_22lev.png kd_precip_10min.png kd_precip_1d.png kd_precip_1h.png kd_precip_1m.png kd_precip_1y.png kd_precip_barplot.png kd_precip_rel_1m.png kd_precip_rel_1y.png

kd_sunshine_1d kd_sunshine_1m kd_sunshine_1y kd_sunshine_rel_1m kd_sunshine_rel_1y kd_temp_1d kd_temp_1m kd_temp_1y kd_temp_barplot kd_temp_diff_1d kd_temp_diff_1m kd_temp_diff_1y
kd_sunshine_1d.png kd_sunshine_1m.png kd_sunshine_1y.png kd_sunshine_rel_1m.png kd_sunshine_rel_1y.png kd_temp_1d.png kd_temp_1m.png kd_temp_1y.png kd_temp_barplot.png kd_temp_diff_1d.png kd_temp_diff_1m.png kd_temp_diff_1y.png

lcl_ml_16lev lcl_ml_17lev lfc_ml_17lev om_10lev perc_11lev pmsl_tend_10lev poac_4lev precip12h_12lev precip1h_17lev precip24h_15lev precip6h_16lev precip_1d_11lev
lcl_ml_16lev.png lcl_ml_17lev.png lfc_ml_17lev.png om_10lev.png perc_11lev.png pmsl_tend_10lev.png poac_4lev.png precip12h_12lev.png precip1h_17lev.png precip24h_15lev.png precip6h_16lev.png precip_1d_11lev.png

precip_1d_17lev precip_1ddiff_19lev precip_1h_17lev precip_3d_16lev precip_lom_ge1h_12lev precip_lom_gt6h_15lev precip_lom_inst_15lev precip_lom_inst_9lev prob_10lev prob_9lev rh_19lev rh_6lev
precip_1d_17lev.png precip_1ddiff_19lev.png precip_1h_17lev.png precip_3d_16lev.png precip_lom_ge1h_12lev.png precip_lom_gt6h_15lev.png precip_lom_inst_15lev.png precip_lom_inst_9lev.png prob_10lev.png prob_9lev.png rh_19lev.png rh_6lev.png

rr_ninjo_21lev si_22lev snow_17lev snow_slf_5lev snow_slf_8lev spread_15lev step_25lev swiss00_16lev swiss00_17lev swiss12_21lev swiss12_22lev swiss_17lev
rr_ninjo_21lev.png si_22lev.png snow_17lev.png snow_slf_5lev.png snow_slf_8lev.png spread_15lev.png step_25lev.png swiss00_16lev.png swiss00_17lev.png swiss12_21lev.png swiss12_22lev.png swiss_17lev.png

t2m_21lev t2m_29lev td2m_19lev temp_26lev temp_37lev temp_38lev temp_ninjo_49lev thetae_38lev topo_15lev utci_30lev utci_40lev uv_17lev
t2m_21lev.png t2m_29lev.png td2m_19lev.png temp_26lev.png temp_37lev.png temp_38lev.png temp_ninjo_49lev.png thetae_38lev.png topo_15lev.png utci_30lev.png utci_40lev.png uv_17lev.png

vort_13lev vort_18lev vort_19lev vort_browser wind300_17lev wind_ninjo_13lev
vort_13lev.png vort_18lev.png vort_19lev.png vort_browser.png wind300_17lev.png wind_ninjo_13lev.png

Working with Color Tables

The COSMO library has the follwing three commands for dealing with color tables: jmb_read_ct, jmb_set_ct, and jmb_add_ct. The first will only rarely be used and is a utility routine to read contour levels and color table. For the first plot to your wks, you will use the jmb_set_ct command. It returns a logical which contains the necessary resources that you can pass on directly to jmb_contour. For the second plot to the same wks, you will use the jmb_add_ct command. The following example illustrates what you can achieve as a result.

ex_colortab.png

begin

  ; open graphic port
  wks = gsn_open_wks("pdf","test20")
  c = addfile("lm_coarse/lfff00000000c.grb","r")
  f = addfile("lm_coarse/lfff00010000.grb", "r")

  ; make a first plot with a specific colortable (jmb_set_ct)
  tp = jmb_getvar(f, "TOT_PREC")
  jmb_getgrid(f,c,tp)
  r = jmb_set_ct(wks,"precip1h_17lev",False)
  cn = jmb_contour(wks, tp, r) 
  mp = jmb_map(wks, tp, False)
  plt = jmb_overlays(wks, (/mp,cn/), False)
  delete(cn)
  delete(plt)

  ; make a second plot with a specific colortable (jmb_add_ct)
  hsurf = jmb_getvar(c,"HSURF")
  jmb_getgrid(c,c,hsurf)
  frland = jmb_getvar(c,"FR_LAND")
  hsurf = where(hsurf.lt.0.1,0.1,hsurf)
  hsurf = where(frland.lt.0.5,-1.0,hsurf)
  r = jmb_add_ct(wks,"topo_15lev",False)
  cn = jmb_contour(wks, hsurf, r) 
  plt = jmb_overlays(wks, (/mp,cn/), False)

end

A call to either jmb_set_ct or jmb_add_ct will append the following attributes to the logical returned by the function call.

Attribute Value
gsnSpreadColors True
gsnSpreadColorStart Start index of loaded color table in wks color table
gsnSpreadColorEnd End index of loaded color table in wks color table
cnLevelSelectionMode "ExplicitLevels"
cnLevels Contour levels associated to loaded color table

Any of these resources can be overridden by the user after the call to jmb_set_ct or jmb_add_ct. If, for example, you would like to use a certain color table but change the contour levels, all you have to do is reset the cnLevel attribute afterwards.

File Format

You can create your own color tables and save them in a directory of your choice (e.g. ~/ncl/ct). In order for the COSMO Library to find your color tables you need to set the environment variable NCL_COSMOLIB_COLORTABLES to point to this directory. This can be permanently done in your .cshrc file by adding the following line

setenv NCL_COSMOLIB_COLORTABLES = ~/ncl/ct

The standard color tables are located in the folder $NCL_COSMOLIB/ct. Your own color tables have precedence over the standard set of color tables.

A color table file follows a very simple syntax. An example file can be found here. The file is a simple ASCII file and the syntax is as follows

  • Any number of comment lines which start with the ";" character
  • 1 line containing number of contour levels n (e.g. 5)
  • 1 line containing the n contour levels separated by white space (e.g. 0.1 0.2 0.5 1.0 2.0)
  • n +1 lines containing RGB triplets separated by white space (e.g. 255 128 128)

Important Note that the number of colors in the color table is one greater than the number of contour levels. Also make sure that you have not trailing blank lines. If the file does not follow this format, the COSMO Library will not be able to read your color table and issue a warning.

Note An NCL script which converts all color tables inside a directory into a PNG that you can upload on this page can be found here. Simply copy it to the directory where you have your *.ct files and type ncl ct2png.ncl to convert all *.ct files into a corresponding PNG graphic.

-- OliverFuhrer - 29 Jan 2009

Attach
ct2png.ncl
ct2png.ncl (1.83K)
version 2 uploaded by OliverFuhrer on 05 Feb 2009 - 15:35 ...
version 1 uploaded by OliverFuhrer on 05 Feb 2009 - 15:33
png
ex_colortab.png (210.18K)
version 1 uploaded by OliverFuhrer on 29 Jan 2009 - 14:57
spacer
This site is managed by the Center for Climate Systems Modeling (C2SM).
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors. Ideas, requests, problems? Send feedback!