[ncl-install] automatic scale of colors

Dennis Shea shea at ucar.edu
Thu Sep 11 07:55:26 MDT 2008


Ola Edson,

I apologize for not understanding.

When you write, "inverting the order of that scale of colors",
do you mean reversing the colormap order? If so, the following
procedure may be used

                 gsn_reverse_colormap(wks)

There are many color examples at:
         http://www.ncl.ucar.edu/Applications/color.shtml

Attached is a slightly revised script.

Good Luck
Edson L. Nunes - UFV wrote:
> To the users of the list, 
>  
> Does it follow a script and a data file NetCDF enclosed  to generate a 
> regional map with the automatic scale of colors, would I like to know 
> if has as inverting the order of that scale of colors?  
> If somebody can help myself, I will be very grateful. 
>  
> Respectfully, 
>  
> Edson.
> ------------------------------------------------------------------------
>
> _______________________________________________
> ncl-install mailing list
> ncl-install at ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-install
>   


-- 
======================================================
Dennis J. Shea                  tel: 303-497-1361    |
P.O. Box 3000                   fax: 303-497-1333    |
Climate Analysis Section                             |
Climate & Global Dynamics Div.                       |
National Center for Atmospheric Research             |
Boulder, CO  80307                                   |
USA                        email: shea 'at' ucar.edu |
======================================================

-------------- next part --------------
;*************************************************
; mapa_temp.ncl
;************************************************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
;************************************************
begin
;************************************************
; open file and read in data
;************************************************

 ;dir = "/home/elnunes/rate1.0-2d/NCEP/TEMP/"
  dir = "./"
  in = addfile(dir + "TEMP_0.40g.200400112.SA.nc","r")
  temp = in->temp(0,:,:)     ; type integer
  printVarSummary( temp )

  tempera = temp*0.01+512.81
  copy_VarCoords(temp, tempera)
  tempera at long_name = "Air Temperature at surface"
  printVarSummary(tempera)

;************************************************
; create plot
;************************************************

  wks = gsn_open_wks("x11", "Temperature")    ;"X11" para visualizar / "ps"/"pdf" para aquivo
  gsn_define_colormap(wks,"gui_default")        	
  gsn_reverse_colormap(wks)                   ; reverse the color order
  		     
;********************visual effect****************************

  res			     = True
  res at cnFillOn               = True               ; color fill
  res at cnLinesOn              = False              ; no contour lines
  res at cnLineLabelsOn         = False              ; no contour labels
  res at gsnSpreadColors        = True               ; use total colormap
 ;res at gsnSpreadColorStart    = -1
 ;res at gsnSpreadColorEnd      = 4
  res at cnInfoLabelOn          = False              ; no contour info label

  res at tmXBLabelFontHeightF   = 0.015
  res at tmYLLabelFontHeightF   = 0.015
  res at lbLabelFontHeightF     = 0.012

  res at tmYLLabelFont = 25
  res at tmXBLabelFont = 25
  res at lbLabelFont   = 25

  ;res at tmXBLabelStride       = 2
  ;res at tmYLLabelStride       = 2
  ;res at lbLabelStride         = 2
   res at lbLabelAutoStride     = True
 
  res at mpOutlineBoundarySets = "allBoundaries"    ;-------------- divisao dos paises

  res at mpGridLineDashPattern  = 2                  ; lat/lon lines as dashed
  res at pmTickMarkDisplayMode  = "Always"           ; turn on tickmarks
  
  res at gsnAddCyclic           = False              ; regional data
  res at mpDataBaseVersion     = "MediumRes" 
  

;*****************defines scale of the legend************************
    
  res at cnLevelSelectionMode = "ExplicitLevels"   ; "ManualLevels"

  res at cnLevels = (/270.,273.,276.,279.,282.,285.,288.,291.,294.,297.,300.,\
                   303./)

;*****************defines scale lat/lon******************************

  res at mpMaxLatF                   =  20
  res at mpMinLatF                   = -60
  res at mpMaxLonF                   = -30
  res at mpMinLonF                   = -100
  res at cnFillMode          = "RasterFill"   	 ; nao interpolar..

  	
; res at tiMainString = " "
  tempera at units     = " "
  res at lbTitleString = "Air Temperature (K)"
  res at lbTitleFontHeightF = 0.015
  res at lbTitlePosition = "Bottom"
 
;******************print the graph*********************************
 
plot = gsn_csm_contour_map(wks,tempera,res)

end


More information about the ncl-install mailing list