[gradsusr] Who can help me to fix that script: 3hourly data to multi-monthly

lily yang yangxiaolihhu at yahoo.cn
Wed Oct 23 21:55:03 EDT 2013


Hi all

I have 3 hourly data from 1948 to 2100 and I want to calculate
multi-monthly in 7 sub-regions. The script is attachment as follows. It
cannot work at all. I hope anyone can help me to modify it. Thank you very
much.

Best,

Xiaoli


function subset(args)

mods="MPI-ESM-LR "
vars="prec tas"
monstrs="JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC"
mds="31 28 31 30 31 30 31 31 30 31 30 31"

lat1=17.5; lat2=54.5
lon1=72.5; lon2=135.5

'open /home/xiaoliy/mask_0.5_8region.ctl'
'define msk1=re(data, 63, linear, 72.5, 1, 38, linear, 17.5, 1, vt, 0.2,
0.6)'

'close 1'
'set gxout grfill'

 mod=1
 while (mod<=1)

     model=subwrd(mods, mod)
     say model

     v=1
     while (v<=1)

        var=subwrd(vars, v)
        say var

        '!mkdir -p /home/xiaoliy/'model'/'var

             y1=1948
             y2=2100

             y=1948
              while (y<=y2)



            'open /home/xiaoliy/'model'/3hourly/'var'_'y'-'y'.ctl'


dout="/home/xiaoliy/"model"/china/"var"/"var"_"model"_multi_monthly_"y"-"y".dat"

             '!/bin/rm -f 'dout

            'set gxout fwrite'

             'set lat 'lat1' 'lat2
             'set lon 'lon1' 'lon2

             'set t 00z1jan1948 21z1dec2100'

               m=1
               while (m<=12)

                mmm=subwrd(monstrs, m)
                md=subwrd(mds, m)

                if (m=2&math_mod(y, 4)=0)

                  mmd=29
                endif





                 val=y" "mm

                time1="01"%mmm%y
                time2="31"%mmm%y

                'set time 00z1jan1948'


                 d=1
                    while (d<=d2)


                      r=1
                       while (r<=7)

                         'define a=ave(data, t=8*d-7, t=8*d)'


                         'd ave(aave(magcm/skout(a,
(msk1-'r-0.5')*('r+0.5'-msk1)), g), time=jan'y', time=dec'y')'

                          value=sublin(result,2)
                          pfiles=subwrd(value, 4)
                          val=val" "pfiles

                     r=r+1
                   endwhile


*                say "Extracting from step "d" to "d2

                 d=d+1
                 endwhile


               say val
               ret=write(dout, val, append)
               ret=close(dout)

             m=m+1
           endwhile

          y=y+1
         endwhile

       v=v+1
       endwhile
       'close 1'

   mod=mod+1
   endwhile






'quit'

return
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20131023/eb3d3378/attachment.html 


More information about the gradsusr mailing list