;************************************************* ; NCL Graphics: color_2.ncl ;************************************************ load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" ;************************************************ begin ;************************************************ ; read in netCDF file ;************************************************ in = addfile("atmos.nc","r") u = in->U(0,0,:,:) ; read in data oro = in->ORO(0,:,:) ;************************************************ ; create plot 1 ;************************************************ wks = gsn_open_wks("ps","color") ; open a ps file gsn_define_colormap(wks,"BlWhRe") ; choose colormap res = True ; plot mods desired res@tiMainString = "BlWhRe Colormap" ; title res@cnFillOn = True ; turn on color fill res@gsnSpreadColors = True ; use full range of colors res@cnLinesOn = False ; when using a blue/red colormap, it is best to set the contour min/max ; to equal but opposite values so that the lightest colors are centered ; on zero res@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels res@cnMinLevelValF = -80. ; set min contour level res@cnMaxLevelValF = 80 ; set max contour level res@cnLevelSpacingF = 10 ; set contour spacing plot = gsn_csm_contour_map_ce(wks,u, res) ; create plot ;************************************************ ; use mask function to mask out land and then ocean data ; ocean=0,land=1,sea_ice=2 ;************************************************ ocean_only = u ocean_only = mask(u,oro,0) ;************************************************ ; create plot 2 ;************************************************ i = NhlNewColor(wks,0.8,0.8,0.8) ; add gray to colormap res@gsnSpreadColorEnd = -3 ; don't use added gray res@tiMainString = "Blue/Red Ocean Example" plot = gsn_csm_contour_map_ce(wks,ocean_only,res) end