[gradsusr] Daily data to monthly data
Ipshita Majhi
ipmajhi at alaska.edu
Tue Sep 23 15:25:15 EDT 2014
Dear Grad users,
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
*************************************************************************************************
*Date 09/23/2014
*This script is to convert daily values to monthly values for different
years which starts from 1901
* and ends in 2010
**************************************************************************************************
'reinit'
mday = '31 28 31 30 31 30 31 31 30 31 30 31'
month = 'jan feb mar apr may jun jul aug sep oct nov dec'
'open prec.mean.imr'
'set gxout fwrite'
'set fwrite outputfile'
yr1 = 1901
yr2 = 2010
yr = yr1
while(yr<=yr2)
leap = 0
if(math_mod(yr,400) = 0 | math_mod(yr,4) = 0 & math_mod(yr,100) != 0)
leap = 1
say yr' is a leap year.'
endif
imon = 1
while(imon <= 12)
md = subwrd(mday,imon)
mc = subwrd(month,imon)
if(imon = 2); md = md + leap; endif;
time1 = '01'mc''yr
time2 = md''mc''yr
' month_avg= ave(p,time='time1',time='time2')'
imon = imon + 1
endwhile
yr = yr + 1
endwhile
return(month_avg)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20140923/6303c228/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: prec.mean.imr
Type: application/octet-stream
Size: 160708 bytes
Desc: not available
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20140923/6303c228/attachment-0002.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: prec.mean.imr.ctl
Type: application/octet-stream
Size: 345 bytes
Desc: not available
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20140923/6303c228/attachment-0003.obj
More information about the gradsusr
mailing list