Thank you to both of you<div>Best Regards</div><div>Ipshita<span></span><br><br>On Tuesday, September 23, 2014, James T. Potemra <<a href="mailto:jimp@hawaii.edu">jimp@hawaii.edu</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
Ipshita,<br>
<br>
I think you need to remove the "_" (underscore) from your variable
name. So, month_ave will not work but monthave should be ok.<br>
<br>
Jim<br>
<br>
<div>On 9/23/14 9:25 AM, Ipshita Majhi
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Dear Grad users,<br>
<br>
I am trying to convert daily data to monthly data and I am
getting error which says unknown command for averaging. I will
attach the data file and ctl as well. It will be great if
someone could help me. Thank You<br>
*************************************************************************************************<br>
*Date 09/23/2014<br>
*This script is to convert daily values to monthly values for
different years which starts from 1901 <br>
* and ends in 2010<br>
**************************************************************************************************<br>
<br>
'reinit'<br>
mday = '31 28 31 30 31 30 31 31 30 31 30 31'<br>
month = 'jan feb mar apr may jun jul aug sep oct nov dec'<br>
<br>
'open prec.mean.imr'<br>
<br>
<br>
'set gxout fwrite'<br>
'set fwrite outputfile'<br>
<br>
yr1 = 1901<br>
yr2 = 2010<br>
<br>
yr = yr1<br>
while(yr<=yr2)<br>
<br>
leap = 0<br>
if(math_mod(yr,400) = 0 | math_mod(yr,4) = 0 &
math_mod(yr,100) != 0)<br>
<br>
leap = 1<br>
<br>
say yr' is a leap year.'<br>
endif<br>
<br>
imon = 1<br>
while(imon <= 12)<br>
md = subwrd(mday,imon)<br>
mc = subwrd(month,imon)<br>
if(imon = 2); md = md + leap; endif;<br>
time1 = '01'mc''yr<br>
time2 = md''mc''yr<br>
<br>
' month_avg= ave(p,time='time1',time='time2')'<br>
imon = imon + 1<br>
endwhile<br>
yr = yr + 1<br>
endwhile<br>
<br>
return(month_avg)<br>
<br>
<br>
</div>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
gradsusr mailing list
<a href="javascript:_e(%7B%7D,'cvml','gradsusr@gradsusr.org');" target="_blank">gradsusr@gradsusr.org</a>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a>
</pre>
</blockquote>
<br>
</div>
</blockquote></div>