[ncl-talk] White for zero in a map

Jiang, Lifen lfjiang at ou.edu
Sun Mar 1 15:01:06 MST 2015


Hello,

I was trying to create a map of the attached variable. The min and and max are -14 and 18, respectively.

I would like to set white for zero, but could not work out how to make it. Script is at the end of this email.

Could anybody help with my issue?

I appreciate your time and help!

Thanks,

Lifen


;************************************************
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

  in = addfile("Diff.nc","r")
  t  = in->Diff
  t at _FillValue  = -999
  t at missing_value = t at _FillValue

  printVarSummary(t)

  wks = gsn_open_wks("png" ,"Plot_Diff")                ;
  gsn_define_colormap(wks,"rainbow")        ; choose colormap

  res                       = True     ; plot mods desired

  res at cnFillOn              = True     ; turn on color fill
  res at cnLinesOn             = False    ; turn off contour lines
  res at cnLevelSpacingF       = 3      ; contour spacing

;---This resource not needed in NCL V6.1.0
  res at gsnSpreadColors       = True     ; use full range of color map

  res at lbLabelStride         = 1

  res at pmTickMarkDisplayMode = "Always"; use NCL default lat/lon labels

  res at gsnAddCyclic          = False    ; data already has cyclic point
                                  ; this must also be set for any zoom

; note that the gsn_csm_*map_ce templates automatically set
; res at mpLimitMode="LatLon" for you. If you are plotting a different projection,
; you may have to set this resource.

  res at mpMinLatF            = -90      ; range to zoom in on
  res at mpMaxLatF            =  90
  res at mpMinLonF            = -180
  res at mpMaxLonF            = 180

  res at cnLevelSelectionMode = "ManualLevels"
  res at cnMinLevelValF       = -15
  res at cnMaxLevelValF       = 20

  plot = gsn_csm_contour_map_ce(wks,t({-90:90},{-180:180}), res)


end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150301/ee804182/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Diff.nc
Type: application/octet-stream
Size: 261984 bytes
Desc: Diff.nc
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150301/ee804182/attachment.obj 


More information about the ncl-talk mailing list