#Sample GrADS script to plot a variable at irregular time intervals, then average the result #SMcMillan 5/17/2011 'reinit' n=5;#number of times times='00Z01FEB2009 00Z01JUL2009 00Z29JUL2009 00Z25SEP2009 00Z30OCT2009' 'sdfopen h:/cdf/4xdailymeans/uwnd.sig995.2009.nc' 'sdfopen h:/cdf/4xdailymeans/vwnd.sig995.2009.nc' 'set lon 35 68';'set lat 0 75' ts=1 while(ts<=n);#plot for each time 'c' tim=subwrd(times,ts);#get time from list 'define u=uwnd(time='tim')' 'define v=vwnd.2(time='tim')' 'd u;v';#DISPLAY SINGLE-TIME WIND 'draw title Wind at 'tim if(ts=1);#sum u and v values 'define usum=u';'define vsum=v' else 'define usum=usum+u';'define vsum=vsum+v' endif prompt 'Continue (y/n)?' pull cont if(cont='n');break;endif ts=ts+1 endwhile #get average u and v: 'define uavg=usum/'n 'define vavg=vsum/'n 'c' 'd uavg;vavg';#DISPLAY AVERAGE WIND OF ALL TIMES 'draw title Average Wind of 'n' Times'