<div dir="ltr">Rick,<div><br></div><div>Thank you for the help. Using sprintf fixed the problem. I'll let my group here know that decimalPlaces may be considered deprecated and thus suggest that they don't use it.</div><div><br></div><div>Cheers,<br>Tanya</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 16, 2018 at 2:50 PM, Rick Brownrigg <span dir="ltr"><<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@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><div>Hi Tanya,<br><br></div>It appears the warning about floats exceeding INT_MAX are coming from the function decimalPlaces(). That function was modifed in 2016, but I'm having trouble determining what got modified and how/whether that introduced the error you are seeing. Nonetheless, the comments in the code for decimalPlaces() suggest its perhaps considered deprecated, and that sprintf() is what should be used instead:<br><br><a href="http://ncl.ucar.edu/Document/Functions/Built-in/sprintf.shtml" target="_blank">http://ncl.ucar.edu/Document/<wbr>Functions/Built-in/sprintf.<wbr>shtml</a><br><br></div>Rick<br><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Fri, Mar 16, 2018 at 2:08 PM, Tanya Peevey <span dir="ltr"><<a href="mailto:trpeevey@gmail.com" target="_blank">trpeevey@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="h5"><div dir="ltr">NCL-Talk,<br><br>I'm running some code that works with version 6.3.0 of NCL but not with the 6.4.0 version. The issue happens in one or two functions: tofloat (or stringtofloat) and decimalPlaces. I looked online and there is no mention of these functions being removed or changed for the newer version of NCL. I'm wondering if there is a bug in the 6.4.0 version of NCL. Any assistance would be appreciated.<br><br>Below is some text showing what happens and a snippet of the code. If needed I'll send more information but I'm hoping that this will be enough.<br><br>The 'cost,grad,step ...' line is obtained from a file that is generated by a model.<br>Here is the code that gets that line and then tries to get information from the 5th and 6th column of that line.<br><br>filename2 =<br>/scratch4/BMC/qosap/ptmp/Andre<wbr>w.Kren/par/prCTL_2_noAMV/gsist<wbr>at.gdas.<a href="tel:(201)%20608-2200" value="+12016082200" target="_blank">2016082200</a><br><br>error occurs at first 'if statement'<br><br><b><u>*CODE*:</u></b><br>; Default background color of Main Table (not Header) is white.<br>; If num assimilated (ratio) doesn't increase (decrease) then the color is changed so<br>; that the user can quickly see the issue.<br>default_table_fillcolor = "white"<br>flag_table_fillcolor = "palegreen"<br>delim1 = " "<br>delim2 = "_"<br><br>; system calls to linux to get necessary data<br>cost_grad = systemfunc("grep cost, " + filename2)<br>print(cost_grad)<br>print("Reading Cost and Gradient...")<br><br>cost_value_1 =<br>tostring(decimalPlaces(tofloat<wbr>(str_get_field(cost_grad(0),5,<wbr>delim1)),4,True))<br>cost_value_2 =<br>tostring(decimalPlaces(tofloat<wbr>(str_get_field(cost_grad(201),<wbr>5,delim1)),4,True))<br><br>grad_value_1 =<br>tostring(decimalPlaces(tofloat<wbr>(str_get_field(cost_grad(0),6,<wbr>delim1)),4,True))<br>grad_value_2 =<br>tostring(decimalPlaces(tofloat<wbr>(str_get_field(cost_grad(201),<wbr>6,delim1)),4,True))<br><br>print(str_get_field(cost_grad(<wbr>0),5,delim1))<br>print(str_get_field(cost_grad(<wbr>201),5,delim1))<br>print(stringtofloat(str_get_fi<wbr>eld(cost_grad(0),5,delim1)))<br>print(stringtofloat(str_get_fi<wbr>eld(cost_grad(201),5,delim1)))<br>print(decimalPlaces(tofloat(st<wbr>r_get_field(cost_grad(0),5,del<wbr>im1)),4,True))<br>print(decimalPlaces(tofloat(st<wbr>r_get_field(cost_grad(201),5,<wbr>delim1)),4,True))<br>print(cost_value_1)<br>print(cost_value_2)<br><br>dayfile_name = str_get_field(inFile1,7,"/")<br>if (tofloat(cost_value_1) .lt. tofloat(cost_value_2)) then<br> cost_value_flag = flag_table_fillcolor<br><br> write_table(textfile,"a",[/"X"<wbr>," "," "," "," "," "," "," "/], \<br> "%12s%10s%12s%10s%10s%10s%10s<wbr>%10s")<br>end if<br>if (tofloat(grad_value_1) .lt. tofloat(grad_value_2)) then<br> grad_value_flag = flag_table_fillcolor<br>end if<br><br><u><b>*OUTPUT with 6.4.0*:</b></u><div><p class="m_6843114881586951379m_-7938100242779599864gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal">(0) cost,grad,step,b,step? = 1 0 1.498929611143528717E+06 2.048988964546030616E+02 1.211877385244983785E+00 0.000000000000000000E+00 good<br>......<br>(201) cost,grad,step,b,step? = 2 150 1.131911262744225329E+06<br>5.6766037650629<b><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:normal;background-color:rgb(255,255,255)">47227E-02 1.791057212970216916E+00 9.879673418565034781E-01</span><br></b></p>good<br>(0) Reading Cost and Gradient...<br>warning:toint: there are 1 float(s) larger than INT_MAX, which have been flagged missing.<br>warning:toint: there are 1 float(s) larger than INT_MAX, which have been flagged missing.<br>(0) 1.498929611143528717E+06<br>(0) 1.131911262744225329E+06<br>(0) 1498930<br>(0) 1131911<br>warning:toint: there are 1 float(s) larger than INT_MAX, which have been flagged missing.<br><br>Variable: unnamed (return)<br>Type: float<br>Total Size: 4 bytes<br> 1 values<br>Number of Dimensions: 1<br>Dimensions and sizes: [1]<br>Coordinates:<br>Number Of Attributes: 1<br> _FillValue : -2.147484e+09<br>(0) -2.147484e+09<br><br>warning:toint: there are 1 float(s) larger than INT_MAX, which have been flagged missing.<br><br>Variable: unnamed (return)<br>Type: float<br>Total Size: 4 bytes<br> 1 values<br>Number of Dimensions: 1<br>Dimensions and sizes: [1]<br>Coordinates:<br>Number Of Attributes: 1<br> _FillValue : -2.147484e+09<br>(0) -2.147484e+09<br><br>Variable: cost_value_1<br>Type: string<br>Total Size: 8 bytes<br> 1 values<br>Number of Dimensions: 1<br>Dimensions and sizes: [1]<br>Coordinates:<br>Number Of Attributes: 1<br> _FillValue : -<a href="tel:(214)%20748-3648" value="+12147483648" target="_blank">2147483648</a>.000000<br>(0) -2147483648.000000<br><br>Variable: cost_value_2<br>Type: string<br>Total Size: 8 bytes<br> 1 values<br>Number of Dimensions: 1<br>Dimensions and sizes: [1]<br>Coordinates:<br>Number Of Attributes: 1<br> _FillValue : -<a href="tel:(214)%20748-3648" value="+12147483648" target="_blank">2147483648</a>.000000<br>(0) -2147483648.000000<br><br>fatal:The result of the conditional expression yields a missing value. NCL can not determine branch, see ismissing function<br><br>fatal:["Execute.c":8640]:Execu<wbr>te: Error occurred at or near line 92 in file<br>/scratch4/BMC/qosap/noscrub/VE<wbr>RIF_PKG/anl_monitor/gsi_stats/<wbr>scripts/create_minimization_<wbr>data.ncl<br><br><u><b>*OUTPUT with 6.3.0*:</b></u><br><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">(0) cost,grad,step,b,step? = 1 0 1.498929611143528717E+06 2.048988964546030616E+02 1.211877385244983785E+00 0.000000000000000000E+00 good</span><br style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">......</span><br></div><div>(201) cost,grad,step,b,step? = 2 150 1.131911262744225329E+06<br>5.676603765062947227E-02 1.791057212970216916E+00 9.879673418565034781E-01<br> good<br>(0) Reading Cost and Gradient...<br>(0) 1.498929611143528717E+06<br>(0) 1.131911262744225329E+06<br>(0) 1498930<br>(0) 1131911<br><br>Variable: unnamed (return)<br>Type: float<br>Total Size: 4 bytes<br> 1 values<br>Number of Dimensions: 1<br>Dimensions and sizes: [1]<br>Coordinates:<br>(0) 1498930<br><br>Variable: unnamed (return)<br>Type: float<br>Total Size: 4 bytes<br> 1 values<br>Number of Dimensions: 1<br>Dimensions and sizes: [1]<br>Coordinates:<br>(0) 1131911<br><br>Variable: cost_value_1<br>Type: string<br>Total Size: 8 bytes<br> 1 values<br>Number of Dimensions: 1<br>Dimensions and sizes: [1]<br>Coordinates:<br>(0) 1498929.625000<br><br>Variable: cost_value_2<br>Type: string<br>Total Size: 8 bytes<br> 1 values<br>Number of Dimensions: 1<br>Dimensions and sizes: [1]<br>Coordinates:<br>(0) 1131911.250000<br><br><br>Thank you,<br>Tanya<br><br><br>--<br>Tanya R. Peevey, PhD<br>Research Scientist I, Global Observing Systems Analysis (GOSA) Group<br>NOAA ESRL Global Systems Division<br><a href="https://maps.google.com/?q=325+Broadway,+Boulder,+CO+80305&entry=gmail&source=g">325 Broadway, Boulder, CO 80305</a><br><a href="tel:(303)%20497-5847" value="+13034975847" target="_blank">(303) 497-5847</a><br><div>
</div></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><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Tanya R. Peevey, PhD</div><div dir="ltr">Research Scientist I, Global Observing Systems Analysis (GOSA) Group</div><div dir="ltr">NOAA ESRL Global Systems Division</div><div dir="ltr">325 Broadway, Boulder, CO 80305</div></div><div dir="ltr">(303) 497-5847</div></div></div></div></div></div></div>
</div>