<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> </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 <hallak@model.iag.usp.br><BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> GrADS Users Forum <gradsusr@gradsusr.org><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 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>> Dear GrADS users,<BR>> I am relatively new to writing GrADS loops and wanted to know if <BR>> anybody could provide pointers to my simple script below:<BR>> <BR>> * create zonal time average for meridional wind<BR>> iz = 1<BR>> while (iz<13)<BR>> 'set z ' iz<BR>> 'define timeaveV = ave(v, t=1, t=120)'<BR>> 'define zonalAVGV = ave(timeaveV, lon=0, lon=360)'<BR>> iz = iz+1<BR>>
endwhile<BR>> <BR>> Basically, I have a monthly mean meridional wind file with 10 years <BR>> of monthly data (12 months x 10 years = 120 time steps) for 12 <BR>> vertical levels. I would like to calculate the time mean zonal mean <BR>> value for each of the 12 vertical levels. For some reason when I <BR>> execute this script I get the same line plot for each level. I was <BR>> hoping to get 12 unique line plots or curves for zonalAVGV, one for <BR>> each vertical level. Does anybody notice the error in the script <BR>> that prevents this? If it matters, I am using GrADS version 2.0.a7 <BR>> on a windows XP system. Sincerely, teddy allen <A href="http://www.teddyallen.com/" target=_blank>http://www.teddyallen.com</A><BR>> "To move quickly, go alone. To move far, go together." <BR>> 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>