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" begin nlat = 100 nlon = 100 t = generate_2d_array(10, 10, -14, 21.0, 0, (/nlat,nlon/)) wks = gsn_open_wks("x11" ,"Plot_Diff") ; gsn_define_colormap(wks,"rainbow") ; choose colormap ;---Create the desired contour levels levels = ispan(-16,19,1) + 2.5 ;---Get color indexes for these levels colors = span_color_indexes("rainbow",dimsizes(levels)+1) ;---Set the appropriate color index to 0 (background color) ii = ind(levels.ge.0) ; Gets all index values where levels >= 0 colors(ii(0)) = 0 ; ii(0) is the first index in the list res = True ; plot mods desired res@gsnMaximize = True res@cnFillOn = True ; turn on color fill res@cnLinesOn = False ; turn off contour lines res@cnLevelSelectionMode = "ExplicitLevels" res@cnLevels = levels res@cnFillColors = colors res@lbOrientation = "Vertical" res@lbLabelFontHeightF = 0.01 plot = gsn_csm_contour(wks,t,res) end