[gradsusr] Daily data to monthly data

Ipshita Majhi ipmajhi at alaska.edu
Tue Sep 23 17:34:23 EDT 2014


Thank you to both of you
Best Regards
Ipshita

On Tuesday, September 23, 2014, James T. Potemra <jimp at hawaii.edu> wrote:

>  Ipshita,
>
> I think you need to remove the "_" (underscore) from your variable name.
> So, month_ave will not work but monthave should be ok.
>
> Jim
>
> On 9/23/14 9:25 AM, Ipshita Majhi wrote:
>
> 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)
>
>
>
>
> _______________________________________________
> gradsusr mailing listgradsusr at gradsusr.org <javascript:_e(%7B%7D,'cvml','gradsusr at gradsusr.org');>http://gradsusr.org/mailman/listinfo/gradsusr
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20140923/b48663dd/attachment.html 


More information about the gradsusr mailing list