<div dir="ltr"><div class="gmail_default" style="font-size:small">There are many ways you can do this.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I've attached a script that does this by using the cnFillColors resource to specify a list of color indexes into the "rainbow" color map, but then I changed the color index that represents level 0.0 to be 0 (the background color, and therefore white).</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div><div class="gmail_default" style="font-size:small"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Mar 1, 2015 at 3:01 PM, Jiang, Lifen <span dir="ltr"><<a href="mailto:lfjiang@ou.edu" target="_blank">lfjiang@ou.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div style="direction:ltr;font-family:Times New Roman;color:#000000;font-size:12pt">
<div style="font-family:Times New Roman;color:#000000;font-size:16px">
<div>
<div class="gmail_extra">Hello, </div>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra">I was trying to create a map of the attached variable. The min and and max are -14 and 18, respectively.</div>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra">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.</div>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra">Could anybody help with my issue?</div>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra">I appreciate your time and help!</div>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra">Thanks,</div>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra">Lifen</div>
<div class="gmail_extra"><br>
</div>
<p><span style="font-family:宋体">;************************************************<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" <br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" <br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" <br>
<br>
begin<br>
<br>
in = addfile("Diff.nc","r")<br>
t = in->Diff<br>
t@_FillValue = -999<br>
t@missing_value = t@_FillValue<br>
<br>
printVarSummary(t)<br>
<br>
wks = gsn_open_wks("png" ,"Plot_Diff") ; <br>
gsn_define_colormap(wks,"rainbow") ; choose colormap<br>
<br>
res = True ; plot mods desired<br>
<br>
res@cnFillOn = True ; turn on color fill<br>
res@cnLinesOn = False ; turn off contour lines<br>
res@cnLevelSpacingF = 3 ; contour spacing<br>
<br>
;---This resource not needed in NCL V6.1.0<br>
res@gsnSpreadColors = True ; use full range of color map<br>
<br>
res@lbLabelStride = 1<br>
<br>
res@pmTickMarkDisplayMode = "Always"; use NCL default lat/lon labels<br>
<br>
res@gsnAddCyclic = False ; data already has cyclic point<br>
; this must also be set for any zoom<br>
<br>
; note that the gsn_csm_*map_ce templates automatically set <br>
; res@mpLimitMode="LatLon" for you. If you are plotting a different projection,<br>
; you may have to set this resource.<br>
<br>
res@mpMinLatF = -90 ; range to zoom in on<br>
res@mpMaxLatF = 90<br>
res@mpMinLonF = -180<br>
res@mpMaxLonF = 180<br>
<br>
res@cnLevelSelectionMode = "ManualLevels"<br>
res@cnMinLevelValF = -15<br>
res@cnMaxLevelValF = 20<br>
<br>
plot = gsn_csm_contour_map_ce(wks,t({-90:90},{-180:180}), res)<br>
<br>
</span></p>
<div class="gmail_extra"><span style="font-family:宋体">end</span> </div>
</div>
</div>
</div>
</div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>