<div dir="ltr"><div>I took a quick look at the code. As the errors indicate, it's happening in a function call get_bart_width(). The calculation of the variable "delta" is clearly wrong, and that sets off the warning, and triggers the error later in get_bar_arrays about non-monotonicity (it's actually not that the array is non-monotonic, it's that it has negative widths).</div><div><br></div><div>Beyond that, I can not tell why the calculation is wrong, particularly without the data. That part of the code hasn't changed in some years, so the v6.5.0 vs v6.6.2 difference is a mystery.</div><div><br></div><div>FWIW...</div><div>Rick</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jun 7, 2020 at 6:58 PM Andrew Kren - NOAA Affiliate via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I looked into these things.<font style="background-color:rgb(255,255,255)" face="arial, sans-serif" color="#000000"> My x_axis is simply created this way:</font><div><font style="background-color:rgb(255,255,255)" face="arial, sans-serif" color="#000000"><br></font></div><div>





<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures;background-color:rgb(255,255,255)"><font face="arial, sans-serif" color="#000000">x_axis = ispan(4,73,3)</font></span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures;background-color:rgb(255,255,255)"><font face="arial, sans-serif" color="#000000"><br></font></span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures;background-color:rgb(255,255,255)"><font face="arial, sans-serif" color="#000000">And the printed values are correct, increasing by 3 starting at 4, 7, etc.</font></span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures;background-color:rgb(255,255,255)"><font face="arial, sans-serif" color="#000000"><br></font></span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures;background-color:rgb(255,255,255)"><font face="arial, sans-serif" color="#000000">So this is still kinda confusing as to why.</font></span></p></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jun 7, 2020 at 5:41 PM Dave Allured - NOAA Affiliate <<a href="mailto:dave.allured@noaa.gov" target="_blank">dave.allured@noaa.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>It is only the horizontal axis that needs to be monotonically increasing.  That is probably what the error message is about.  Naturally, the vertical access may fluctuate anywhere.  You might want to check the values of x_axis in your code to see if they make sense.</div><div><br></div><div>Meanwhile, you should be able to insert a quick fix for x_axis with temporary arrays, something like this.  This assumes that x_axis is strictly decreasing rather than increasing.  If you change the order, then you must also change the order for the vertical axis data, in the same way.  X and Y values are supposed to form ordered pairs to make the bar chart.</div><div><br>xplot = x_axis(::-1)<br>yplot = tolong (temperature_top(i,23:0:-1))<br>plot = gsn_csm_xy (wks, xplot, yplot, res)</div><div><br></div><div>I have no idea what changed to cause a newer NCL version to change from the original behavior.</div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jun 7, 2020 at 1:57 PM Andrew Kren - NOAA Affiliate via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Dear ncl-talk,<div><br></div><div>I upgraded my NCL to the latest version. Previously I was using version 6.5. When I upgraded, one of my ncl codes no longer runs successfully but creates an error code. I am creating a bar chart with gsn_csm_xy. I originally did not get these errors so I am unsure what could be going on. I tried to debug the issue but to no avail. Here are my errors:</div><div><br></div><div>





<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">(0)<span style="white-space:pre-wrap">       </span>get_bar_widths: Warning: The bar width(s) you selected (0.75) is larger than the smallest delta (-11).</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">(0)<span style="white-space:pre-wrap">       </span>Defaulting to -11.</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">(0)<span style="white-space:pre-wrap">       </span>get_bar_arrays: Fatal: The array is not monotonically increasing.</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">(0)<span style="white-space:pre-wrap">       </span>Cannot draw a bar chart.</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">fatal:Illegal right-hand side type for assignment</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">I checked that my array I am plotting has all correct values, and it does. I didn't know a bar chart had to have monotonically increasing values. Is there a way around this? </span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">The code where it fails is below, in the call to plot.</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">





</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">plot = gsn_csm_xy(wks,x_axis,tolong(temperature_top(i,0:23)),res)</span></p></div><div><br></div><div>Thanks,</div><div><br>-- <br><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><font color="#000000">Andrew Kren</font><div><font color="#000000">Meteorologist<br></font></div><div><font color="#000000">US Dept of Commerce</font></div><div><font color="#000000">National Oceanic and Atmospheric Administration</font></div><div><font color="#000000">National Weather Service Raleigh, NC</font></div><div><font color="#000000">1005 Capability Drive, Suite 300</font></div><div><font color="#000000">Centennial Campus</font></div><div><font color="#000000">Raleigh, NC 27606-5226</font></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></blockquote></div></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><font color="#000000">Andrew Kren</font><div><font color="#000000">Meteorologist<br></font></div><div><font color="#000000">US Dept of Commerce</font></div><div><font color="#000000">National Oceanic and Atmospheric Administration</font></div><div><font color="#000000">National Weather Service Raleigh, NC</font></div><div><font color="#000000">1005 Capability Drive, Suite 300</font></div><div><font color="#000000">Centennial Campus</font></div><div><font color="#000000">Raleigh, NC 27606-5226</font></div></div><div dir="ltr"><img src="https://www.aoml.noaa.gov/pix/AOML/50th01.png" width="420" height="65"><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"><br></span></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>