DKRZ NCL color map example - use new resourcesΒΆ

Example script:

;-----------------------------------------------------------------------------------
; DKRZ NCL Example: color_use_cnFillPalette_to_set_colormap.ncl
;
; Description:   Demonstrate the use of cnFillPalette to set the color map
;                for a plot which can be different for each plot in the
;                same frame.
;
;      cnFillPalette colormap  to be used for a filled contour plot
;      vcLevelPalette colormap to be used in a filled vector plot
;      stLevelPalette colormap to be used in a filled streamlines plot
;
; 12.03.18 kmf
;-----------------------------------------------------------------------------------
begin
 f = addfile("./rectilinear_grid_2D.nc","r")
 var = f->tsurf(0,:,:)

;-- open workstation (frame)
 wks = gsn_open_wks("png","plot_color_use_cnFillPalette_to_set_colormap")

;-- set common resources
 res = True
 res@gsnDraw = False
 res@gsnFrame = False
 res@gsnMaximize = True

 res@cnFillOn = True         ;-- turn on contour fill
 res@cnLinesOn = False       ;-- turn off contour lines
 res@cnLineLabelsOn = False  ;-- turn off line labels
 res@cnLevelSelectionMode = "ManualLevels" ;-- set contour levels manually
 res@cnMinLevelValF = 250.   ;-- minimum contour level
 res@cnMaxLevelValF = 310.   ;-- maximum contour level
 res@cnLevelSpacingF = 1     ;-- contour level spacing

 res@lbLabelStride = 4
 res@lbBoxMinorExtentF = 0.15  ;-- decrease the height of the labelbar

 res@tiMainFontHeightF = 0.02

;-- draw the first plot in memory
 res@tiMainString = "NCL_default color map used with cnFillPalette"  ;-- title string

 res@cnFillPalette = "NCL_default"  ;-- NCL's default color map

 plot1 = gsn_csm_contour_map(wks, var, res)

;-- draw the second plot in memory
 res@tiMainString = "NCV_blu_red color map used with cnFillPalette"  ;-- title string

 res@cnFillPalette = "NCV_blu_red"  ;-- blue to red color map

 plot2 = gsn_csm_contour_map(wks, var, res)

;-- generate the panel and advance the frame
 gsn_panel(wks,(/plot1,plot2/),(/2,1/),True)

end

Result:

../../../../../../_images/plot_color_use_cnFillPalette_to_set_colormap_w400.png