[ncl-talk] buffer overflow detected

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Fri Sep 24 11:40:55 MDT 2021


Notwithstanding Rick's question, try using a simple large string array,
instead of the large list constructor for this particular application.
Then avoid the extra and mostly redundant formatting stage in write_table.
Complete your own formatting in smaller pieces.  Something like:

do ...
   latString(...) = sprintf ("%6.3f",latPoints(...))
   lonString(...) = sprintf ("%6.3f",lonPoints(...))
end do

alist = latString + lonString + hsString + ... \
   ... + ptpwindString
asciiwrite ("outf_data.txt", alist)

You could also merge these last two statements, thereby reducing memory
demand somewhat.


On Fri, Sep 24, 2021 at 10:18 AM Rick Brownrigg via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:

> Hi,
>
> I can't find anywhere in the source code where such an error message would
> arise. Is that a literal copy/paste of the error?
>
> Rick
>
>
> On Fri, Sep 24, 2021 at 10:03 AM Micah Sklut via ncl-talk <
> ncl-talk at mailman.ucar.edu> wrote:
>
>> Hi NCL Talk,
>>
>> I'm using write_table to output a large amount of data to file.
>> Here's the output statement:
>>
>> alist =
>> [/latPoints,lonPoints,hsString,perString,dirString,winduString,windvString,phs1String,phs2String,phs3String,phs4String,phs5String,phswindString,pdir1String,pdir2String,pdir3String,pdir4String,pdir5String,pdirwindString,ptp1String,ptp2String,ptp3String,ptp4String,ptp5String,ptpwindString/]
>>
>>
>> write_table("outf_data.txt","w",alist,"%6.3f,%6.3f,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s");
>>
>> I'm getting the following message:
>>
>> *** buffer overflow detected ***: ncl terminated
>> Aborted
>>
>> When I reduce the string lengths of the variables, then I don't get this
>> error, so I"m guessing I"m running into an NCL string length maximum?
>>
>> Any suggestions on how to get around this problem?
>>
>> Thank you.
>>
>> --
>> Micah Sklut
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210924/fdf9e9ac/attachment.html>


More information about the ncl-talk mailing list