<html><body><div style="color:#000; background-color:#fff; font-family:bookman old style, new york, times, serif;font-size:16px"><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr"><span style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;" class="" id="yui_3_16_0_1_1435570581462_4776">Hi grad users I want to calculate the monthly averages from the daily average data I have found a script in the grads users blog.</span></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr"><span style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;" class="" id="yui_3_16_0_1_1435570581462_4817">I tried to correct the script based on my data, but when I run the script it gives me the .nc file with constant number and with only one time step, the length of my daily data is from t=1 (st January 1998) to t=5632(May 2013) days?</span></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr"><span style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;" class="" id="yui_3_16_0_1_1435570581462_4840">Is their any one can help to see where is the problem </span></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr"><br></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr"><span style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;" class="" id="yui_3_16_0_1_1435570581462_5181">Here is the the script? </span></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><br></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class="" id="yui_3_16_0_1_1435570581462_5183"><span style="font-size: 13px;" class="" id="yui_3_16_0_1_1435570581462_5191"> 'reinit'</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class="" id="yui_3_16_0_1_1435570581462_5192"><span style="font-size: 13px;" class="" id="yui_3_16_0_1_1435570581462_5193">mday = '31 28 31 30 31 30 31 31 30 31 30 31'</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class="" id="yui_3_16_0_1_1435570581462_5194"><span style="font-size: 13px;" class="" id="yui_3_16_0_1_1435570581462_5195">month = 'jan feb mar apr may jun jul aug sep oct nov dec'</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class=""><br class=""></span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class="" id="yui_3_16_0_1_1435570581462_5196"><span style="font-size: 13px;" class="" id="yui_3_16_0_1_1435570581462_5197"> 'sdfopen C:/Users/laptop/Documents/Work/datatrim/data_trim.nc'</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class=""> 'set x 1 136 '</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class=""> 'set y 1 144'</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class=""> 'set t 1 5630'</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class="">* 'set z 1'</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class=""> </span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class=""> yr1 = 1998</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class=""> yr2 = 2012</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class=""><br class=""></span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class=""> yr = yr1</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class=""> while(yr<=yr2)</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class=""> leap = 0</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class=""> if(math_mod(yr,400) = 0 | math_mod(yr,4) = 0 & math_mod(yr,100) != 0)</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class=""> leap = 1</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class="">* say yr' is a leap year.'</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class=""> endif</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class=""> imon = 1</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class=""> while(imon <= 12)</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class=""> md = subwrd(mday,imon)</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class=""> mc = subwrd(month,imon)</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class=""> if(imon = 2); md = md + leap; endif;</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class=""> time1 = '01'mc''yr</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class=""> time2 = md''mc''yr</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class="">* say time1' 'time2</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class=""> 'define aveprecip= ave(precipitation,time='time1',time='time2')'</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class="">* 'set gxout sdfwrite'</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class=""> 'set sdfwrite C:/Users/laptop/Documents/Work/datatrim/monthly_trim.nc'</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class=""> 'sdfwrite aveprecip'</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class=""> imon = imon + 1</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class=""> endwhile</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class=""> yr = yr + 1</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class=""> endwhile</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class="">'c'</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class=""><span style="font-size: 13px;" class="">regaeds</span></font></div><div id="yui_3_16_0_1_1435570581462_4744" dir="ltr" class=""><font face="Helvetica Neue, Segoe UI, Helvetica, Arial, Lucida Grande, sans-serif" class="" id="yui_3_16_0_1_1435570581462_5225"><span style="font-size: 13px;" class="" id="yui_3_16_0_1_1435570581462_5224">kaikombo</span></font></div></div></body></html>