<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Laura,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">NCL doesn&#39;t base the color bar levels on the type of the data. What it does is look at the min/max of your data, and then tries to pick a set of levels such that you get an equally-spaced span of 10-16 levels. This can very likely result in a set of levels that require floating point values.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">So, for example, if the min of your difference is 0, and the max is 1, NCL is going to pick levels (/0,0.1,0.2,...,0.9,1/). If the min/max is 0 and 2, then NCL will choose (/0.0, 0.2, 0.4, ..., 1.8, 2.0/)</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Here&#39;s a little program that illustrates the various values that NCL will pick for levels, using the nice_mnmxintvl function:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace">procedure print_levels(ymin,ymax)</font></div><div class="gmail_default"><font face="monospace, monospace">local x</font></div><div class="gmail_default"><font face="monospace, monospace">begin</font></div><div class="gmail_default"><font face="monospace, monospace">  print(&quot;data min, max = &quot; + ymin + &quot;, &quot; + ymax) </font></div><div class="gmail_default"><font face="monospace, monospace">  x = nice_mnmxintvl(ymin,ymax,16,False)</font></div><div class="gmail_default"><font face="monospace, monospace">  print(&quot;   levels min     = &quot; + x(0))</font></div><div class="gmail_default"><font face="monospace, monospace">  print(&quot;   levels max     = &quot; + x(1))</font></div><div class="gmail_default"><font face="monospace, monospace">  print(&quot;   levels spacing = &quot; + x(2))</font></div><div class="gmail_default"><font face="monospace, monospace">end</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">;---Print level min/max/spacing for various min/max values for data.</font></div><div class="gmail_default"><font face="monospace, monospace">print_levels(  0,  1)</font></div><div class="gmail_default"><font face="monospace, monospace">print_levels(  0,  2)</font></div><div class="gmail_default"><font face="monospace, monospace">print_levels(  0,  5)</font></div><div class="gmail_default"><font face="monospace, monospace">print_levels(  0, 10)</font></div><div class="gmail_default"><font face="monospace, monospace">print_levels(-10, 10)</font></div><div class="gmail_default"><font face="monospace, monospace">print_levels(0.1, 0.9)</font></div><div class="gmail_default"><br></div><div class="gmail_default">This results in:</div><div class="gmail_default"><br></div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace">data min, max = 0, 1</font></div><div class="gmail_default"><font face="monospace, monospace">   levels min     = 0</font></div><div class="gmail_default"><font face="monospace, monospace">   levels max     = 1</font></div><div class="gmail_default"><font face="monospace, monospace">   levels spacing = 0.1</font></div><div class="gmail_default"><font face="monospace, monospace">data min, max = 0, 2</font></div><div class="gmail_default"><font face="monospace, monospace">   levels min     = 0</font></div><div class="gmail_default"><font face="monospace, monospace">   levels max     = 2</font></div><div class="gmail_default"><font face="monospace, monospace">   levels spacing = 0.2</font></div><div class="gmail_default"><font face="monospace, monospace">data min, max = 0, 5</font></div><div class="gmail_default"><font face="monospace, monospace">   levels min     = 0</font></div><div class="gmail_default"><font face="monospace, monospace">   levels max     = 4.8</font></div><div class="gmail_default"><font face="monospace, monospace">   levels spacing = 0.4</font></div><div class="gmail_default"><font face="monospace, monospace">data min, max = 0, 10</font></div><div class="gmail_default"><font face="monospace, monospace">   levels min     = 0</font></div><div class="gmail_default"><font face="monospace, monospace">   levels max     = 10</font></div><div class="gmail_default"><font face="monospace, monospace">   levels spacing = 1</font></div><div class="gmail_default"><font face="monospace, monospace">data min, max = -10, 10</font></div><div class="gmail_default"><font face="monospace, monospace">   levels min     = -10</font></div><div class="gmail_default"><font face="monospace, monospace">   levels max     = 10</font></div><div class="gmail_default"><font face="monospace, monospace">   levels spacing = 2</font></div><div class="gmail_default"><font face="monospace, monospace">data min, max = 0.1, 0.9</font></div><div class="gmail_default"><font face="monospace, monospace">   levels min     = 0.15</font></div><div class="gmail_default"><font face="monospace, monospace">   levels max     = 0.85</font></div><div class="gmail_default"><font face="monospace, monospace">   levels spacing = 0.05</font></div></div><div class="gmail_default"><br></div><div class="gmail_default">You can set the levels to whatever values you want.  For example, the following will create levels starting at the minimum of your difference, and going to the maximum of your difference, in steps of 1:</div><div class="gmail_default"><br></div><div class="gmail_default"><font face="monospace, monospace">res@cnLevelSelectionMode = &quot;ExplicitLevels&quot;</font></div><div class="gmail_default"><font face="monospace, monospace">res@cnLevels             = ispan(toint(min(diff)),toint(max(diff)),</font>1)</div><div class="gmail_default"><br></div><div class="gmail_default">--Mary</div><div class="gmail_default"><br></div><div class="gmail_default"><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 3, 2017 at 9:43 AM, Laura Fowler <span dir="ltr">&lt;<a href="mailto:laura@ucar.edu" target="_blank">laura@ucar.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello:<br>
<br>
I am plotting a global map of the difference between two fields that<br>
are both integers. A printVarSummary inquiry also shows that the<br>
difference filed is also an integer. so, I am not iunderstanding why<br>
the color bar labels are actually real with decimals. Does this make<br>
sense? I would think that the color bar labels would also be integers?<br>
<br>
Thanks,<br>
Laura<br>
<br>
<br>
--<br>
!-----------------------------<wbr>------------------------------<wbr>------------------------------<wbr>--------------------<br>
Laura D. Fowler<br>
Mesoscale and Microscale Meteorology Division (MMM)<br>
National Center for Atmospheric Research<br>
P.O. Box 3000, Boulder CO 80307-3000<br>
<br>
e-mail: <a href="mailto:laura@ucar.edu">laura@ucar.edu</a><br>
phone: <a href="tel:303-497-1628" value="+13034971628">303-497-1628</a><br>
<br>
!-----------------------------<wbr>------------------------------<wbr>------------------------------<wbr>--------------------<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>
</blockquote></div><br></div>