[ncl-talk] sub: Second do loop

Rick Brownrigg brownrig at ucar.edu
Tue Dec 5 22:33:12 MST 2017


Hi Dale,

I looked a few days ago at your original posting on this issue, and didn't
have a good solution to offer. The issue at hand is that each time through
the outer do-loop, the call to asciiwrite() completely overwrites the
contents of the file written during the previous iteration. This is by
design of the asciiwrite() function, for better or worse. That means you
either need to provision an array to collect all of the results you want
written and make one call to asciiwrite() at the end of your do loop. Or I
suppose there are some system/shell tricks you could employ, like writing
to a temporary file, during each iteration and then using NCL's system()
function to concatenate that to your accumulative file using I/O
redirection each time through the loop (e.g., cat temp
>>myIntendedOutputFile).   Not particularly elegant, but that would work.

Hope that helps...
Rick

On Tue, Dec 5, 2017 at 10:12 PM, dale zuri <dalezuri at gmail.com> wrote:

> Hi,
> I would like to write a result to an array. The new result is replaced by
> an existing one.
> And also I noticed that second do loop blocking the first do loop. I don't
> understand, why the second do loop does so?
> Could someone help me to fix this?
>
> Thanks
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171205/89ede900/attachment.html>


More information about the ncl-talk mailing list