<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.19328">
<STYLE>
<!--
 /* Font Definitions */
 @font-face
        {font-family:宋体;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@宋体";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        text-align:justify;
        text-justify:inter-ideograph;
        font-size:10.5pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:Verdana;
        color:windowtext;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
 /* Page Definitions */
 @page Section1
        {size:595.3pt 841.9pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;
        layout-grid:15.6pt;}
div.Section1
        {page:Section1;}
-->
</STYLE>
</HEAD>
<BODY>
<DIV><FONT color=#0000ff size=2 face=Verdana>Thanks, David.</FONT></DIV>
<DIV><FONT color=#0000ff size=2 face=Verdana></FONT>&nbsp;</DIV>
<DIV><FONT color=#0000ff size=2 face=Verdana>I think I understand now. It seems 
the the stride should always be positive. But when execute NCL can automatically 
determine to increase or to decrease the loop indentifier by the stride 
depending on whether the start index is smaller than the end index or the start 
index is greater than the end index.</FONT></DIV>
<DIV><FONT color=#0000ff size=2 face=Verdana></FONT>&nbsp;</DIV>
<DIV><FONT color=#0000ff size=2 face=Verdana>Thanks again and all my 
best!</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=#0000ff size=2 face=Verdana></FONT>&nbsp;</DIV>
<DIV><FONT color=#0000ff size=2 face=Verdana>Shawn</FONT></DIV>
<DIV><FONT size=2 face=Verdana></FONT>&nbsp;</DIV>
<DIV align=left>
<DIV align=left><FONT size=2 face=Verdana>
<HR style="WIDTH: 122px; HEIGHT: 2px" SIZE=2>
</FONT></DIV>
<DIV><FONT color=#c0c0c0><FONT size=2 face=Verdana>Wen.J.Qu</FONT></DIV>
<DIV><FONT size=2 face=Verdana>2012-10-22</FONT></FONT></DIV></DIV>
<DIV><FONT size=2 face=Verdana>
<HR>
</FONT></DIV>
<DIV><FONT face=Verdana><FONT size=2><STRONG>发件人:</STRONG> David 
Brown</FONT></FONT></DIV>
<DIV><FONT face=Verdana><FONT size=2><STRONG>发送时间:</STRONG> 
2012-10-22&nbsp;17:36:28</FONT></FONT></DIV>
<DIV><FONT face=Verdana><FONT size=2><STRONG>收件人:</STRONG> 
Wen.J.Qu@gmail.com</FONT></FONT></DIV>
<DIV><FONT face=Verdana><FONT size=2><STRONG>抄送:</STRONG> 
ncl-talk</FONT></FONT></DIV>
<DIV><FONT face=Verdana><FONT size=2><STRONG>主题:</STRONG> Re: [ncl-talk] How to 
accomplish a loop with negative stride?</FONT></FONT></DIV>
<DIV><FONT size=2 face=Verdana></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face=Verdana>See the reference manual at&nbsp;<A 
href="http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclStatements.shtml#Loops">http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclStatements.shtml#Loops</A>
<DIV><BR></DIV>
<DIV>Here's what it says about looping backwards:</DIV>
<DIV><BR></DIV>
<DIV><SPAN 
style="LINE-HEIGHT: 16px; FONT-FAMILY: verdana, sans-serif; FONT-SIZE: 13px" 
class=Apple-style-span>
<UL 
style="LIST-STYLE-POSITION: inside; PADDING-BOTTOM: 0px; MARGIN: 0px 0px 5px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">
  <P 
  style="PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; FONT-VARIANT: normal; MARGIN: 10px 0px 20px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; FONT-FAMILY: verdana, sans-serif; COLOR: rgb(51,51,51); FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 0px">The 
  following shows how to specify a loop with an explicit stride. The following 
  form is also necessary to loop backwards. With this form, if start is greater 
  than end, then the identifier is decremented by the stride value, which must 
  always be positive. If the start is less than the end, then the identifier is 
  incremented by the stride value.</P>
  <DIV 
  style="PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; FONT-VARIANT: normal; MARGIN: 10px 0px 20px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; FONT-FAMILY: verdana, sans-serif; COLOR: rgb(51,51,51); FONT-SIZE: 10pt; FONT-WEIGHT: normal; PADDING-TOP: 0px"><BR 
  class=webkit-block-placeholder></DIV><PRE style="BORDER-BOTTOM: transparent 15px solid; BORDER-LEFT: transparent 0px solid; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; TEXT-INDENT: 0em; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; FONT-FAMILY: courier; FONT-SIZE: 10pt; BORDER-TOP: transparent 0px solid; BORDER-RIGHT: transparent 0px solid; PADDING-TOP: 0px">    do <I style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">loop_identifier</I> = <I style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">scalar_start_expr</I> , <I style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">scalar_end_expr</I> , <I style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"> scalar_stride_expr</I>
        <I style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"> statement list </I>
    end do</PRE></UL></SPAN>
<DIV><BR></DIV></DIV>
<DIV><BR>
<DIV>
<DIV>On Oct 22, 2012, at 4:15 PM, Wen.J.Qu wrote:</DIV><BR 
class=Apple-interchange-newline>
<BLOCKQUOTE type="cite">
  <META name=GENERATOR content="MSHTML 8.00.6001.19328">
  <DIV>
  <DIV><FONT face=Verdana><FONT size=2>Hi, all</FONT></FONT></DIV>
  <DIV><FONT size=2 face=Verdana></FONT>&nbsp;</DIV>
  <DIV><FONT size=2 face=Verdana>Would you please give some suggestions on how 
  to accomplish a loop with negative stride? Just as below?</FONT></DIV>
  <DIV><FONT size=2 face=Verdana></FONT>&nbsp;</DIV>
  <DIV><FONT size=2 face=Verdana>Thanks a lot.</FONT></DIV>
  <DIV><FONT size=2 face=Verdana></FONT>&nbsp;</DIV>
  <DIV>Shawn</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=Verdana><FONT size=2></FONT></FONT>&nbsp;</DIV>
  <DIV><FONT face=Verdana><FONT 
  size=2>**************************************************</FONT></FONT></DIV>
  <DIV>&nbsp;&nbsp;&nbsp;do 
  i=lon90,lon180<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  n588(year_index,day_index,i)=0.0<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  do 
  j=lat80,lat10,-1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  if((h(year_index,day_index,j,i)/10.0 .le. 588.0) .and. 
  (h(year_index,day_index,j-1,i)/10.0 .le. 
  588.0))then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;n588(year_index,day_index,i)=j<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;break<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  end if<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;end do<BR>&nbsp;&nbsp;&nbsp;end do</DIV>
  <DIV><FONT face=Verdana><FONT 
  size=2>**************************************************</FONT></FONT></DIV><FONT 
  face=Verdana>
  <DIV><FONT size=2></FONT>&nbsp;</DIV>
  <DIV align=left><FONT size=2>
  <HR style="WIDTH: 122px; HEIGHT: 2px" SIZE=2>
  </FONT></DIV>
  <DIV><FONT color=#c0c0c0><FONT size=2>Wen.J.Qu</FONT></FONT></DIV><FONT 
  color=#c0c0c0></FONT>
  <DIV><FONT color=#c0c0c0><FONT 
  size=2>2012-10-22</FONT></FONT></DIV></FONT></DIV>_______________________________________________<BR>ncl-talk 
  mailing list<BR>List instructions, subscriber options, unsubscribe:<BR><A 
  href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</A><BR></BLOCKQUOTE></DIV><BR></DIV></FONT></DIV></BODY></HTML>