[gradsusr] looping program

Jeff Duda jeffduda319 at gmail.com
Fri Dec 14 12:24:54 EST 2012


Wendi,
Assuming your radar data are available at the same time every day, create
an overall average and add daily averages to it.  Then take the average of
the averages at the end.  If you have differing numbers of radar valid
times each day, you should take a weighted average based on the number of
data slices available each day.

Do you plan to access each day's radar data using a separate control file
or using a single control file?  This distinction makes a difference in how
best to code your script.  You could either do it one day at a time, or sum
all days in one line.  That is, you could do it like this:

'reinit'
'sumaverage = 0'
dd = 1
while (dd <= 10)
'open [DAY dd CONTROL FILE]'
'set grads off'
'set mproj latlon'
'set mpdset hires'
'set gxout shaded'
'set lon 100  100.82'
'set lat -0.7  0'
'set z 3600'
'set parea 1 7.5 2.8 8.3'
'set clevs 0 5 10 15 20 25 30 35 40 45 50 55 60'
'set ccols 9 14 4 11 5 13 3 10 7 12 8 2 6'
'set t 1 3600'
'R=pow(10, ref/10)'

day = dd + 9
'R1=ave(R,time=13Z'dd'APR2004,time=22Z'dd'APR2004)'
'sumaverage = sumaverage + R1'
dd = dd + 1
endwhile
'average = sumaverage / 10'
...color table options...
...map options...
'd average'
'printim try.gif white'

OR like this

'reinit'
'open [ALL INCLUSIVE CONTROL FILE]'
'set grads off'
'set mproj latlon'
'set mpdset hires'
'set gxout shaded'
'set lon 100  100.82'
'set lat -0.7  0'
'set z 3600'
'set parea 1 7.5 2.8 8.3'
'set clevs 0 5 10 15 20 25 30 35 40 45 50 55 60'
'set ccols 9 14 4 11 5 13 3 10 7 12 8 2 6'
'set t 1 3600'
'R=pow(10, ref/10)'
'R1=ave(R,time=13Z10APR2004,time=22Z10APR2004)+ave(R,time=13Z11APR2004,time=22Z11APR2004)+ave(R,time=13Z12APR2004,time=22Z12APR2004)+ave(R,time=13Z13APR2004,time=22Z13APR2004)+ave(R,time=13Z14APR2004,time=22Z14APR2004)+ave(R,time=13Z15APR2004,time=22Z15APR2004)+ave(R,time=13Z16APR2004,time=22Z16APR2004)+ave(R,time=13Z17APR2004,time=22Z17APR2004)+ave(R,time=13Z18APR2004,time=22Z18APR2004)+ave(R,time=13Z19APR2004,time=22Z19APR2004)'
...color table options...
...map options...
'd R1/10'
'printim try.gif white'

Jeff

On Fri, Dec 14, 2012 at 12:20 AM, wendi harjupa <wendiharjupa at gmail.com>wrote:

> Dear Jeff
>
> Thank you very much for your solution,
>
> I need to make average for 10 days, how to make loop for the next day
> (same time/13-22)??
>
> Best regards,
> On Fri, Dec 14, 2012 at 1:06 PM, Jeff Duda <jeffduda319 at gmail.com> wrote:
>
>> Change the line
>> 'R1=ave(R, t=1, t=3600)'
>>
>> to
>>
>> 'R1=ave(R,time=13Z10APR2004,time=22Z10APR2004)'
>>
>> Jeff Duda
>>
>>  On Thu, Dec 13, 2012 at 8:42 PM, wendi harjupa <wendiharjupa at gmail.com>wrote:
>>
>>>  Dear Sir/Madam
>>>
>>> Please I need your help.
>>> I have one set data (10 days data)
>>>
>>> How to make looping to make reflectivity average for only 10 hours on
>>> every day (13hrs-22hrs only)??
>>>
>>> Below is my ctl and gs script
>>>
>>> try.ctl
>>>
>>> DSET
>>> /misc/home/wendi/data1/radar/kototabang/XDR/data/%y4%m2%d2/%d2%h2.dat
>>> TITLE  RADAR
>>> OPTIONS  TEMPLATE LITTLE_ENDIAN
>>> UNDEF  -1000
>>> XDEF    321 LINEAR    99.688120996    0.004492369
>>> YDEF    321 LINEAR    -1.083708891    0.004522556
>>> ZDEF    39  LINEAR   1.0 0.5
>>> TDEF    3600 LINEAR 00:00Z10apr2004  4mn
>>> VARS    2
>>> ref 39  99  Reflectivity(dBZ)
>>> vel 39  99  Doppler Velocity(m/s)
>>> ENDVARS
>>>
>>>
>>> script.gs
>>>
>>> 'reinit'
>>> 'open try.ctl'
>>> 'set grads off'
>>> 'set mproj latlon'
>>> 'set mpdset hires'
>>> 'set gxout shaded'
>>> 'set lon 100  100.82'
>>> 'set lat -0.7  0'
>>> 'set z 3600'
>>> 'set parea 1 7.5 2.8 8.3'
>>> 'set clevs 0 5 10 15 20 25 30 35 40 45 50 55 60'
>>> 'set ccols 9 14 4 11 5 13 3 10 7 12 8 2 6'
>>> 'set t 1 3600'
>>> 'R=pow(10, ref/10)'
>>>
>>> 'R1=ave(R, t=1, t=3600)'
>>> 'set t 1'
>>> 'R2=log10 (R1)'
>>> 'd 10*R2'
>>> 'run /misc/home/wendi/grads-2.0.1/cbarn 0.7 0.7 7.4 5.5'
>>> 'draw string  7.2 8.1 [dBz]'
>>> 'draw xlab longitude'
>>> 'draw ylab latitude'
>>> 'set mproj latlon'
>>> 'set mpdset hires'
>>> 'set grid off'
>>>
>>> 'close 1'
>>>
>>> 'printim try.gif white'
>>> 'disable print'
>>>
>>> 'close 1'
>>>
>>> Thank you very much for your help
>>>
>>> Best regards,
>>> wendi
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> -------------
>>> Wendi Harjupa. ST
>>> Shimane University Graduate School of Engineering Sciences
>>> Department of Electronic Control Systems
>>> Remote Sensing Laboratory
>>> s119447
>>> Cellphone : +81-080-4268-6676
>>> email : wendi at rslab.riko.shimane-u.ac.jp
>>>
>>>
>>> _______________________________________________
>>> gradsusr mailing list
>>> gradsusr at gradsusr.org
>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>
>>>
>>
>>
>> --
>> Jeff Duda
>> Graduate research assistant
>> University of Oklahoma School of Meteorology
>> Center for Analysis and Prediction of Storms
>>
>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>>
>>
>
>
> --
> -------------
> Wendi Harjupa. ST
> Shimane University Graduate School of Engineering Sciences
> Department of Electronic Control Systems
> Remote Sensing Laboratory
> s119447
> Cellphone : +81-080-4268-6676
> email : wendi at rslab.riko.shimane-u.ac.jp
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>


-- 
Jeff Duda
Graduate research assistant
University of Oklahoma School of Meteorology
Center for Analysis and Prediction of Storms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20121214/a280f005/attachment-0003.html 


More information about the gradsusr mailing list