<div dir="ltr">Hi Mary,<div>thank you very much, now there is no problem with the filling!</div><div><br></div><div>Have you notice (and it happened to me before) that in the light blue you can see the world coast-line? (In the figure you sent me there is in the bottom right corner a part of Africa and Madagascar).. I wasn't able to do anything to remove them (without removing the coordinates..)</div><div><br></div><div>Thank you very much again</div><div><br></div><div>Cheers</div><div><br></div><div>Arianna</div></div><br><div class="gmail_quote"><div dir="ltr">Il giorno gio 19 gen 2017 alle ore 22:20 Mary Haley <<a href="mailto:haley@ucar.edu">haley@ucar.edu</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg"><div class="gmail_default gmail_msg" style="font-size:small">Hi Arianna,</div><div class="gmail_default gmail_msg" style="font-size:small"><br class="gmail_msg"></div><div class="gmail_default gmail_msg" style="font-size:small">NCL does its contouring by filling the contours based on what values fall above or below a contour level, and not exactly equal to a contour level. This causes confusion when your data is all integers.</div><div class="gmail_default gmail_msg" style="font-size:small"><br class="gmail_msg"></div><div class="gmail_default gmail_msg" style="font-size:small">If you specify contour levels of 1,2,3,4,5, then NCL is going to create a contour plot with *6* colors, where the colors represent the following:</div><div class="gmail_default gmail_msg" style="font-size:small"><br class="gmail_msg"></div><div class="gmail_default gmail_msg" style="font-size:small"> color 1 - all values < 1</div><div class="gmail_default gmail_msg" style="font-size:small"> color 2 - all values >= 1 and < 2</div><div class="gmail_default gmail_msg" style="font-size:small"> color 3 - all values >= 2 and < 3</div><div class="gmail_default gmail_msg" style="font-size:small"> color 4 - all values >= 3 and < 4</div><div class="gmail_default gmail_msg" style="font-size:small"> color 5 - all values >= 4 and < 5</div><div class="gmail_default gmail_msg" style="font-size:small"> color 6 - all values >= 5</div><div class="gmail_default gmail_msg" style="font-size:small"><br class="gmail_msg"></div><div class="gmail_default gmail_msg" style="font-size:small">This is why you see the extra "Label_1", because NCL only expects (n-1) labels if you have n colors, because it's assuming you are labelling *between* values. When you tell it to center the labels, then suddenly you are one label short, and hence NCL gives you the "Label_1" label.</div><div class="gmail_default gmail_msg" style="font-size:small"><br class="gmail_msg"></div><div class="gmail_default gmail_msg" style="font-size:small">Back to your contour levels:</div><div class="gmail_default gmail_msg" style="font-size:small"><br class="gmail_msg"></div><div class="gmail_default gmail_msg" style="font-size:small">In your code, you set the first contour level to 1, so this means that the first color (darkgreen) is going to represent all values < 1, which means any value equal to 0, since you only have integer values.</div><div class="gmail_default gmail_msg" style="font-size:small"><br class="gmail_msg"></div><div class="gmail_default gmail_msg" style="font-size:small">Then, then next color, "forestgreen" is going to represent all values >=1 and < 2, which, again, in your case, since you just have integers, is going to be all colors equal to 1.</div><div class="gmail_default gmail_msg" style="font-size:small"><br class="gmail_msg"></div><div class="gmail_default gmail_msg" style="font-size:small">If you want the first color to represent all values equal to 1, and the second color all values equal to 2, and you want twenty colors total, where the last color represents values equal to 20, then you need to create 19 contour levels that start just slightly higher than 1, 2, 3, 4, etc:</div><div class="gmail_default gmail_msg" style="font-size:small"><br class="gmail_msg"></div><div class="gmail_default gmail_msg" style="font-size:small">This is one way of doing it, by adding 0.1 to the levels:</div><div class="gmail_default gmail_msg"><div class="gmail_default gmail_msg">
<p class="m_6658929288320496613gmail-p1 gmail_msg"><span class="m_6658929288320496613gmail-s1 gmail_msg"></span>
</p><p class="m_6658929288320496613gmail-p1 gmail_msg"><span class="m_6658929288320496613gmail-s1 gmail_msg"> res@</span><span class="m_6658929288320496613gmail-s2 gmail_msg">cnLevels</span><span class="m_6658929288320496613gmail-s1 gmail_msg"> = </span><span class="m_6658929288320496613gmail-s3 gmail_msg">(/</span><span class="m_6658929288320496613gmail-s1 gmail_msg">1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12,13,14, 15,16,17,18,19</span><span class="m_6658929288320496613gmail-s3 gmail_msg">/)</span><span class="m_6658929288320496613gmail-s1 gmail_msg">+0.1</span></p><p class="m_6658929288320496613gmail-p1 gmail_msg">I see you are using cnFillPalette, which is okay, but it's better to use cnFillColors when you have a specific color for each contour level. This way you don't need to mess with gsnSpreadColors:</p><p class="m_6658929288320496613gmail-p1 gmail_msg">
</p><p class="m_6658929288320496613gmail-p1 gmail_msg"><span class="m_6658929288320496613gmail-s1 gmail_msg"> res@</span><span class="m_6658929288320496613gmail-s2 gmail_msg">cnFillColors</span><span class="m_6658929288320496613gmail-s1 gmail_msg"> = colorscheme </span><span class="m_6658929288320496613gmail-s3 gmail_msg">; distinct colors for categories<br class="gmail_msg"> ; res@gsnSpreadColors = False ; comment this or remove it</span></p><p class="m_6658929288320496613gmail-p1 gmail_msg">If you are trying to plot this data over a map, you generally want to use wrf_contour *and* wrf_map_overlays. But, your XLAT and XLONG on the file do not have a time dimension, which is going to cause problems for wrf_map_overlays.</p><p class="m_6658929288320496613gmail-p1 gmail_msg">So, I modified your code to use gsn_csm_contour_map instead, but I used the map projection defined on the file.</p><p class="m_6658929288320496613gmail-p1 gmail_msg">I've attached the modified script and a new PNG.</p><p class="m_6658929288320496613gmail-p1 gmail_msg"><br class="gmail_msg"></p><p class="m_6658929288320496613gmail-p1 gmail_msg">--Mary</p></div></div><div class="gmail_default gmail_msg" style="font-size:small"><br class="gmail_msg"></div></div><div class="gmail_extra gmail_msg"><br class="gmail_msg"><div class="gmail_quote gmail_msg"></div></div><div class="gmail_extra gmail_msg"><div class="gmail_quote gmail_msg">On Thu, Jan 19, 2017 at 10:57 AM, Arianna Valmassoi <span dir="ltr" class="gmail_msg"><<a href="mailto:arianna.valmassoi@gmail.com" class="gmail_msg" target="_blank">arianna.valmassoi@gmail.com</a>></span> wrote:<br class="gmail_msg"></div></div><div class="gmail_extra gmail_msg"><div class="gmail_quote gmail_msg"><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg">Hi all,<div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">I'm working with WRF and it's landuse representation. In the plot output I have the following problems:</div><div class="gmail_msg"><ul class="gmail_msg"><li class="gmail_msg">label: there is one more tic in the label with the first color, and has a name I did not put.</li><li class="gmail_msg">assign color to discrete numbers: I had to impose to the landcat to start with zero, not as one as it is, otherwise the first level will not match</li><li class="gmail_msg">Domain visualization: I can't use the model coordinates (even using other plot option) </li></ul><div class="gmail_msg"><br class="gmail_msg"></div></div><div class="gmail_msg">I attach here both the code and the .nc file, in order to help the debug category 13 should be red and category 17 light blue.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Thank a lot for any help and sorry if it's a duplicate problem!</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Cheers,</div><div class="gmail_msg">Arianna Valmassoi</div></div><span class="m_6658929288320496613HOEnZb gmail_msg"><font color="#888888" class="gmail_msg"><div dir="ltr" class="gmail_msg">-- <br class="gmail_msg"></div><div data-smartmail="gmail_signature" class="gmail_msg"><div dir="ltr" class="gmail_msg">Arianna Valmassoi</div></div>
</font></span><br class="gmail_msg"></blockquote></div></div><div class="gmail_extra gmail_msg"><div class="gmail_quote gmail_msg"><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">_______________________________________________<br class="gmail_msg">
ncl-talk mailing list<br class="gmail_msg">
<a href="mailto:ncl-talk@ucar.edu" class="gmail_msg" target="_blank">ncl-talk@ucar.edu</a><br class="gmail_msg">
List instructions, subscriber options, unsubscribe:<br class="gmail_msg">
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" class="gmail_msg" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br class="gmail_msg">
<br class="gmail_msg"></blockquote></div><br class="gmail_msg"></div>
</blockquote></div><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature"><div dir="ltr">Arianna Valmassoi</div></div>