[ncl-talk] sub: Second do loop

Dennis Shea shea at ucar.edu
Wed Dec 6 08:30:17 MST 2017


'dale zuri' ...

Please understand 'do loop's. The 'tt'.ncl' script is a nuisance to look
at. No indentation and many commented out lines. Please send  clean,
structured code. Out time is valuable too!

===
You must understand do loops.

At the top you have:

do i=0,st
nums1=k1(i:i+c,0);;;;;;;observtion

then within the same 'do lop' you have

[SNIP]
OrigMod=new(st+1,float,yu at _FillValue)
do i=0,st                                 :<=================
OrigMod(i)=arraycdfinverse
end do
end do

The 2nd do attempts to redefine th 'i' ... this is not allowed!!








On Tue, Dec 5, 2017 at 10:33 PM, Rick Brownrigg <brownrig at ucar.edu> wrote:

> 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
>>
>>
>
> _______________________________________________
> 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/20171206/e36b8d25/attachment.html>


More information about the ncl-talk mailing list