<div dir="ltr"><div><div><div><div><div>A 'trick': If variable 'x' is being plotted:<br><br></div><div>(a) If 'x' has an _FillValue associated with it<br><br> <strong></strong>x = where(x.eq.0, x@_FillValue, x)<br><br> <br></div><div><br></div><div>(b) if 'x' does not have a _FillValue, just assign one. EG<br></div></div><br></div> if (.not.isatt(x,"_FillValue")), then<br></div> x@_FillValue = getVarFillValue(x)<br></div> end if<br><div><pre><strong> </strong>x = where(x.eq.0, x@_FillValue, x)<br><br>====<br> res@cnMissingValFillColor = "white" ; maybe "background"
</pre><div> plot = <br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 5, 2016 at 3:30 PM, Mary Haley <span dir="ltr"><<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-size:small">Jake,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">In NCL, the colors represent the values *between* contour levels and not exactly equal to a contour level. It's not possible to tell NCL that you want all values equal to 0 to be white, because you need a range of values in order to actually have an area that you can fill in a certain color.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Your white value is representing all values >= -5 and < 5. If you want this to more closely represent values that are equal to zero, then you need to provide a smaller range of values, like -0.1 to 0.1. It will depend on how close your values are to zero.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">The other possibility is to portray the 0 contour level a different way. For example, if you look at example coneff_1.ncl at:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><a href="http://www.ncl.ucar.edu/Applications/coneff.shtml#ex1" target="_blank">http://www.ncl.ucar.edu/Applic<wbr>ations/coneff.shtml#ex1</a><br></div><div class="gmail_default"><br></div><div class="gmail_default">it uses a special resource "gsnContourZeroLineThicknessF" to make the zero contour line double thick. Of course, in order for this to work, you actually have to have a 0 contour line. For example:</div><div class="gmail_default"><br></div><div class="gmail_default"><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo">res@cnLevelSpacingF = 5</p><span class=""><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo">res@cnMinLevelValF = -75</p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo">res@cnMaxLevelValF = 75</p><div><br></div></span><div>You may also want to visit the "symmetric" contours page at:</div></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><a href="http://www.ncl.ucar.edu/Applications/contoursym.shtml" target="_blank">http://www.ncl.ucar.edu/Applic<wbr>ations/contoursym.shtml</a></div><div class="gmail_default"><br></div><div class="gmail_default">--Mary</div><div class="gmail_default"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Tue, Oct 4, 2016 at 7:57 PM, Jake Huff <span dir="ltr"><<a href="mailto:jake.huff@stonybrook.edu" target="_blank">jake.huff@stonybrook.edu</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Hello Everyone,<div><br></div><div>I am currently using gsn_csm_contour_map along with cnFillColors to specify which colors I want on the label bar. </div><div><br></div><div>For example I am specifiying the minimum, maximum and spacing of values for the contour levels.</div><div><br></div><div><font face="arial, helvetica, sans-serif">wks = gsn_open_wks("pdf","example")</font></div><div><font face="arial, helvetica, sans-serif">gsn_define_colormap(wks,"BlWhR<wbr>e")</font></div><div><br></div><div>res = True</div><div><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span>res@cnLevelSpacingF = 10</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span>res@cnMinLevelValF = -75</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span>res@cnMaxLevelValF = 75</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo">res@<span style="font-family:menlo">cnFillColors = (/2,9,13,18,22,28,34,40,0,55,6<wbr>2,70,77,84,90,95,102/)</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-family:menlo"><br></span></p><p style="margin:0px;line-height:normal"><font face="arial, helvetica, sans-serif">So this makes the contour level from -5 to 5 be white by using value 0 in the cnFillColors. The problem I have is that this is misleading because it makes a lot of values white instead of just the zero value.</font></p><p style="margin:0px;line-height:normal"><font face="arial, helvetica, sans-serif"><br></font></p><p style="margin:0px;line-height:normal"><font face="arial, helvetica, sans-serif">My question is how to make a contour plot with a color bar that has the zero value be white and all other values be non-white.</font></p><p style="margin:0px;line-height:normal"><font face="arial, helvetica, sans-serif"><br></font></p><p style="margin:0px;line-height:normal"><font face="arial, helvetica, sans-serif">Thanks,</font></p><p style="margin:0px;line-height:normal"><font face="arial, helvetica, sans-serif">Jake</font></p></div></div>
<br></div></div>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>