<div dir="ltr"><div><div><div>Guido's comment about a space between 'end' and 'do ' is correct.<br></div><div>Further, you can not change the do loop index values within the do loop.<br></div><div>There are other errors. <br><br>It is best to use print statements to follow the execution of your code.<br><br></div><div>A code segment that should worl is:<br></div><div><br> Tpj=new((/31,37,73,144/),float)<br> tStrt = 0<br> tLast = 3<br> do j=0,30<br> print("jday="+(j+1))<br> Tpj(j,:,:,:)=dim_avg_n(T(tStrt:tLast,:,:,:),0)<br> tStrt = tStrt+4<br> tLast = tLast+4<br> end do<br><br><br></div><div><br>--<br></div>If you are new to NCL *please* read the documentation. <br><br><a href="http://www.ncl.ucar.edu/Document/Manuals/">http://www.ncl.ucar.edu/Document/Manuals/</a><br><br></div> Mini-Reference Manual<br><br></div>A pair of tutorials created by <b>Karin Meier-Fleischer</b> and <b>Michael
Böttinger</b> of <a href="https://www.dkrz.de/">DKRZ</a>
(Deutsches Klimarechenzentrum) are also available.<br><br>====<br><br><br> <br><div><div><br><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 6, 2016 at 1:59 AM, Guido Cioni <span dir="ltr"><<a href="mailto:guidocioni@gmail.com" target="_blank">guidocioni@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi,<div>as stated in the guide (<a href="http://www.ncl.ucar.edu/Document/Language/loops.shtml" target="_blank">http://www.ncl.ucar.edu/Document/Language/loops.shtml</a>) <b style="margin:0px;padding:0px;font-family:verdana,sans-serif;font-size:13.3333px;line-height:16px;background-color:rgb(255,255,255)">Note: there is a space between the "end" and the "do" in NCL:</b><span style="font-family:verdana,sans-serif;font-size:13.3333px;line-height:16px;background-color:rgb(255,255,255)"> </span><em style="margin:0px;padding:0px;font-family:verdana,sans-serif;font-size:13.3333px;line-height:16px;background-color:rgb(255,255,255)">(end do)</em><span style="font-family:verdana,sans-serif;font-size:13.3333px;line-height:16px;background-color:rgb(255,255,255)">! </span></div><div><span style="font-family:verdana,sans-serif;font-size:13.3333px;line-height:16px;background-color:rgb(255,255,255)">Check your script. </span></div><div><div>
<div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br>Guido Cioni</div><div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="http://guidocioni.altervista.org" target="_blank">http://guidocioni.altervista.org</a> </div>
</div>
<br><div><blockquote type="cite"><div><div class="h5"><div>On 06 May 2016, at 09:57, WIND <<a href="mailto:954051157@qq.com" target="_blank">954051157@qq.com</a>> wrote:</div><br></div></div><div><div><div class="h5"><div>Dear all,</div><div>I'm dealing with the JRA four times per day grib data. And I want to average the four times data to get a daily data.</div><div>My script is listed below</div><div><div><b>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</b></div><div><b>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"</b></div><div><b>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"</b></div><div><b>fa=addfile("t.grib","r")</b></div><div><span style="line-height:1.5"><b>T=fa->TMP_GDSO_ISBL ;T(123,37,73,144) </b></span></div><div><b>Tpj=new((/31,37,73,144/),float)</b></div><div><b>do j=0,30 </b></div><div><b> do i=0,123 </b></div><div><b> Tpj(j,:,:,:)=(T(i,:,:,:)+T(i+1,:,:,:)+T(i+2,:,:,:)+T(i+3,:,:,:))/4</b></div><div><b> i=i+4</b></div><div><b> j=j+1</b></div><div><b> enddo;</b></div><div><b>enddo;</b></div></div><div> the error goes synatx error and error in statement. How should I do to get the daily average?</div><div>Any help would be appreciated!</div><div>Sincerely,</div><div>Yan</div></div></div>_______________________________________________<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" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br></div></blockquote></div><br></div></div><br>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">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/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>