<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial, helvetica, sans-serif;font-size:12pt"><DIV></DIV>
<DIV>Dear Ricardo,</DIV>
<DIV>Thank you very much for this helpful advice. I am gulity of trying to make the simple to be complex. Everything works properly now.</DIV>
<DIV>Sincerely,</DIV>
<DIV>teddy <BR>&nbsp;</DIV>
<P><A href="http://www.teddyallen.com/" rel=nofollow target=_blank>http://www.teddyallen.com</A></P>
<P>"To move quickly, go alone. To move far, go <FONT color=#ff0000><EM><STRONG>together</STRONG></EM></FONT>." </P>
<P>African Proverb</P>
<DIV><BR></DIV>
<DIV style="FONT-FAMILY: arial, helvetica, sans-serif; FONT-SIZE: 12pt"><BR>
<DIV style="FONT-FAMILY: arial, helvetica, sans-serif; FONT-SIZE: 10pt"><FONT size=2 face=Tahoma>
<HR SIZE=1>
<B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> Ricardo Hallak &lt;hallak@model.iag.usp.br&gt;<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> GrADS Users Forum &lt;gradsusr@gradsusr.org&gt;<BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Fri, March 26, 2010 10:02:47 AM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> Re: [gradsusr] time mean zonal mean meridional wind for 12 vertical levels<BR></FONT><BR>Hi Teddy,<BR><BR>when you define a new variable inside a while structure, the new variable is<BR>rewritten at each interaction, and the previous define setting (the previous<BR>level in your case) is deleted to save machine memory. As a result, your new<BR>variable is "known" only for the level 12 (the last interaction inside the<BR>while structure).<BR><BR>Use 'set z 1 12' before the define commands if you need a new variable be<BR>available for all levels (of course, omit the while structure). The define<BR>function will
 automatically set the new variable for all "open" dimensions at<BR>the moment of definitions (as an example, the new variable could also&nbsp; be set<BR>for 'set lat initlat endlat'; set lon initlon endlon'; and so on). So, just use:<BR><BR>'set z 1 12'<BR>'define timeaveV = ave(v, t=1, t=120)'<BR>'define zonalAVGV = ave(timeaveV, lon=0, lon=360)'<BR><BR>After that, you can set z for a specific level and display the new var.<BR><BR>Hope this helps,<BR>Ricardo <BR><BR>On Thu, 25 Mar 2010 22:43:51 -0700 (PDT), Teddy Allen wrote<BR>&gt; Dear GrADS users,<BR>&gt; I am&nbsp;relatively new to writing GrADS loops and wanted to know if <BR>&gt; anybody could provide pointers to my simple script below:<BR>&gt; <BR>&gt; * create zonal time average for meridional wind<BR>&gt; iz = 1<BR>&gt; while (iz&lt;13)<BR>&gt; 'set z ' iz<BR>&gt; 'define timeaveV = ave(v, t=1, t=120)'<BR>&gt; 'define zonalAVGV = ave(timeaveV, lon=0, lon=360)'<BR>&gt; iz = iz+1<BR>&gt;
 endwhile<BR>&gt; &nbsp;<BR>&gt; Basically, I have a monthly mean meridional wind file with 10 years <BR>&gt; of monthly data (12 months x 10 years = 120 time steps) for 12 <BR>&gt; vertical levels. I would like to calculate the time mean zonal mean <BR>&gt; value for each of the 12 vertical levels. For some reason when I <BR>&gt; execute this script I get the same&nbsp;line plot&nbsp;for each level. I was <BR>&gt; hoping to get 12 unique&nbsp;line plots or curves&nbsp;for zonalAVGV, one for <BR>&gt; each vertical level. Does anybody notice the error in the script <BR>&gt; that prevents this? If it matters, I am using GrADS version 2.0.a7 <BR>&gt; on a windows XP system. &nbsp; Sincerely, teddy allen &nbsp; <A href="http://www.teddyallen.com/" target=_blank>http://www.teddyallen.com</A><BR>&gt; "To move quickly, go alone. To move far, go together." <BR>&gt; African Proverb<BR><BR>_______________________________________________<BR>gradsusr mailing
 list<BR><A href="mailto:gradsusr@gradsusr.org" ymailto="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</A><BR><A href="http://gradsusr.org/mailman/listinfo/gradsusr" target=_blank>http://gradsusr.org/mailman/listinfo/gradsusr</A><BR></DIV></DIV></div><br>

      </body></html>