<div dir="ltr"><div><div>mnmxlvl = nice_mnmxintvl(min(data),max(d<wbr>ata),16,False)<br><br></div>Is a nice function, in particular for normally distributed data.<br><br></div>An alternative for non-normally distributed data is to use:<br><div><div><br><a target="_blank" href="https://www.ncl.ucar.edu/Document/Functions/Contributed/stat_dispersion.shtml">https://www.ncl.ucar.edu/<wbr>Document/Functions/<wbr>Contributed/stat_dispersion.<wbr>shtml</a><br><br></div><div><pre style="margin:0px;padding:0px;font-size:13.3333px;line-height:12pt;font-family:courier;border-style:solid;border-width:0px 0px 15px;border-color:transparent;text-indent:0px;color:rgb(0,0,0);font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:left;text-transform:none;word-spacing:0px;background-color:rgb(255,255,255)"> opt = True
;opt@PrintStat = True
statd = <strong style="margin:0px;padding:0px">stat_dispersion</strong>(data, opt )</pre></div><div><pre> res@cnLevelSelectionMode = "ManualLevels"<br></pre><pre> ; arbitrary <br> res@cnMinLevelValF = statd(5) ; lower sextile
res@cnMaxLevelValF = statd(11) ; upper sextile
res@cnLevelSpacingF = ...whatever...</pre><br><a href="https://www.ncl.ucar.edu/Applications/ESMF.shtml">https://www.ncl.ucar.edu/Applications/ESMF.shtml</a><br></div><div>Example 35<br><br></div><div>By looking at the output from stat_dispersion, one could manually set contour levels that maximize the <br>information. The data are clusterd at the 'low' end but have significantly larger values which are not artificial.<br></div><div><pre style="color:rgb(0,0,0);font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;word-spacing:0px;word-wrap:break-word;white-space:pre-wrap"> res@cnLevelSelectionMode = "ExplicitLevels"
res@cnLevels = (/0.001, 0.050, 0.060, 0.070, 0.080, 0.090, 0.100, 0.125, 0.150\
,0.200, 0.250, 0.50, 1, 5, 10, 15, 20, 25, 50 /)
</pre><br class="gmail-Apple-interchange-newline"><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 11, 2017 at 7:48 AM, 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">I usually end up increasing the levels too, simply by taking the "spacing" value and dividing it by a number, like 2 or 3 (for 2x or 3x as many contours).</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><div class="gmail_default"> res@cnLevelSelectionMode = "ManualLevels"</div><div class="gmail_default"> res@cnMinLevelValF = mnmxlvl(0)</div><div class="gmail_default"> res@cnMaxLevelValF = mnmxlvl(1)</div><div class="gmail_default"> res@cnLevelSpacingF = mnmxlvl(2) / 2. ; make the contour interval smaller for more contours</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 11, 2017 at 1:43 AM, Noelia otero <span dir="ltr"><<a href="mailto:noeli1680@gmail.com" target="_blank">noeli1680@gmail.com</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">Hi Mary,<div><br></div><div>Thanks a lot. I was trying to set min and max values, but I wasn't taking a good value for levelSpacing ..,I follow your suggestion, although I had to increase considerably the number of levels. Now it seems to work.</div><div><br></div><div>Many thanks again,</div><div><br></div><div>Best</div><span class="m_-5318926250297890625HOEnZb"><font color="#888888"><div><br></div><div>Noelia</div></font></span></div><div class="m_-5318926250297890625HOEnZb"><div class="m_-5318926250297890625h5"><div class="gmail_extra"><br><div class="gmail_quote">2017-04-11 7:47 GMT+02:00 Mary Haley <span dir="ltr"><<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>></span>:<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">Dear Noelia,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">When you are paneling a series of color contour plots and then paneling them later, you first want to be sure you use a fixed set of contour levels across all the plots, so you can then use a single labelbar in the final panel plot.</div><div class="gmail_default" style="font-size:small"><br></div>The function nice_mnmxintvl<div class="gmail_default" style="font-size:small;display:inline"> is what you can use to fix your contour levels</div><div><pre><div class="gmail_default" style="font-size:small;display:inline"> </div>mnmxlvl = nice_mnmxintvl(min(data),max(d<wbr>ata),16,False)<br>
res@cnLevelSelectionMode = "ManualLevels"
res@cnMinLevelValF = mnmxlvl(0)
res@cnMaxLevelValF = mnmxlvl(1)
res@cnLevelSpacingF = mnmxlvl(2)</pre><pre><font face="arial, helvetica, sans-serif">You will need to get the min and max of your data across all plots, and pass that to<br></font></pre><div><div class="gmail_default" style="font-size:small"><font face="arial, helvetica, sans-serif">The "min(data)" and "max(data)" are from another example. You will need to plug in the min/max of your own data across all plots.</font></div></div></div><div class="gmail_default" style="font-size:small"><font face="arial, helvetica, sans-serif"><br></font></div><div class="gmail_default" style="font-size:small"><font face="arial, helvetica, sans-serif">You now want to turn off the individual labelbar you're getting for each plot:</font></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace"> res@lbLabelBarOn = False</font></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">and then turn on the panel labelbar when you call gsn_panel:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">pres = True</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">pres@gsnPanelLabelBar = True</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">...</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">gsn_panel(...)</font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"><br></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif">You may want to see our "panel" examples page:</font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"><br></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"><a href="http://www.ncl.ucar.edu/Applications/panel.shtml" target="_blank">http://www.ncl.ucar.edu/Applic<wbr>ations/panel.shtml</a><br></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"><br></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif">I think panel_35.ncl uses the nice_mnmxintvl function.</font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"><br></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif">--Mary</font></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_-5318926250297890625m_-8385967273249843908h5">On Mon, Apr 10, 2017 at 11:37 AM, Noelia otero <span dir="ltr"><<a href="mailto:noeli1680@gmail.com" target="_blank">noeli1680@gmail.com</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="m_-5318926250297890625m_-8385967273249843908h5"><div dir="ltr">Hi!<div><br></div><div>I am plotting in a panel plots seasonal means from different models, and I got some "empty" plots for some specific models and seasons. My guess is that it is due to the large spread of values (or some outliers). Maybe, it's a simple question..but I don't know how to set the resources to get a good label bar. I attach the final plot that I got with my code (see a part of the code below):</div><div><br></div><div>; i= model ,s =season</div><div><br></div><div> model = addfile(fils(i), "r")</div><div> c=str_split(fils(i), "/")</div><div> nmod=str_split(c(6), "#")</div><div> mmod=nmod(0)</div><div> print(nmod)</div><div> sfile=systemfunc("ls " + dir2 + mmod +"*"+ season(s)+".nc")</div><div> smodel=addfile(sfile, "r") </div><div><br></div><div> svar = smodel ->$var$</div><div> svar!1="lat"</div><div> svar!2="lon" </div><div><br></div><div><div>;------Getting statistics for each grid point-------</div><div><br></div><div> stats_seas_var = new((/nlat,mlon/), typeof(svar),-9e+33)</div><div> </div><div>;-------get 95th possition 25 of statistics---------</div><div><br></div><div><br></div><div> opt=False</div><div> do nl=0,nlat-1</div><div> do ml=0,mlon-1</div><div> </div><div> seas_st_var = stat_dispersion( svar(:,nl,ml), opt)</div><div> stats_seas_var(nl,ml) = seas_st_var(0)</div><div><br></div><div> ;stat_dispersion: (0) mean, (1) std, (2), min, (14),max</div><div> end do </div><div> end do </div><div><br></div><div> </div><div> stats_seas_var@long_name = "mean"</div><div> stats_seas_var!0="lat"</div><div> stats_seas_var!1="lon"</div><div> stats_seas_var&lat = lat</div><div> stats_seas_var&lon = lon</div><div><br></div><div> res = True</div><div> res@gsnMaximize = True</div><div> res@cnFillOn = True</div><div> res@cnLinesOn = False</div><div> res@gsnAddCyclic = False</div><div> res@gsnDraw = False</div><div> res@gsnFrame = False</div><div> res@mpMinLonF = min(lon)</div><div> res@mpMinLatF = min(lat)</div><div> res@mpMaxLonF = max(lon)</div><div> res@mpMaxLatF = max(lat)</div><div> res@lbLabelAutoStride=True</div><div> res@cnLevelSelectionMode = "ManualLevels"</div><div> res@cnMinLevelValF = 0.</div><div> res@cnMaxLevelValF = 10.</div><div> res@cnLevelSpacingF = 5.</div><div> res@lbLabelBarOn = False</div><div> res@gsnCenterString =nmod(0)</div><div> res@gsnRightString =season(s)</div><div> plotseas = gsn_csm_contour_map(wks,stats_<wbr>seas_var,res)</div></div><div><br></div><div>I really appreciate any suggestion to improve it,</div><div><br></div><div>Many thanks in advance,</div><div><br></div><div>Noelia</div><div><br></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>
</blockquote></div><br></div>
</div></div></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>