[gradsusr] looping program

Muhammad Yunus Ahmad Mazuki ukm.yunus at gmail.com
Tue Dec 18 01:33:16 EST 2012


Alright. that means your template option would have considered all files in
...XDR/data/. Thats a lot of files, and lots of time points. So your 'time'
starts from the earliest date file until the latest date file. so that
number '300' in you tdef only refers to first 300 data starting from
'1001.dat', means 0000 hour until 1956 hour (?, I think the 300th point is
1956), definitely not what you want. That is why when you use
'time=22Z11apr2004', that time does not exist in GrADS.

When you use 'TDEF    300 LINEAR 13:00Z10apr2004  4mn', GrADS would assign
time=1  to 1300,   time=150 to 2156 , time=151  to 2200, and t=300 to 0756
the next day (my understanding). So thats why 'time=22Z11apr2004' does not
exists.

Your tdef needs to be the cumulative of all the dates in the files you are
templating, that means 1 folder have 360 data (24 hours divide by 4
minutes). That is just one day. I will take it that you have 10 days (or 10
folders). So for 10 days you will use 3600. Use 'TDEF    3600 LINEAR
00:00Z10apr2004  4mn' instead. That means the first folder have to be 10
April, and your time in grads start at 0000 hour. then when you use
'ave(R,time=13Z10apr2004, time=22Z10apr2004' it will properly corresponds
to 1300 10 April 2004 until 2200 10 April 2004'.  You can for example, copy
only 10 days folders that you need to a temporary place for you to run your
analysis in GrADS.

For my statement of 'R1=ave(R,time=1,time=150)+ave(R,time=151,time=300)',
this is when I assumed you only have 10 hours data in one day folder. So
you can ignore it.

I have only one question, is 'ave(R,time=13Z10apr2004,time=22Z10apr2004'
correct?, the part 'time=13Z10apr2004'. I know for monthly data, I can use
time=sep97 or time=sep1997. You data is not days, but 4 minutes, so maybe
'hh:mmZddmmmyyyy' or '21:56Z10apr2004'. I hope someone else can answer this.

I hope I have helped answering your questions. This is a matter of
correctly 'template'ing in GrADS.

Yunus



On Tue, Dec 18, 2012 at 1:36 PM, wendi harjupa <wendiharjupa at gmail.com>wrote:

> Dear Mr Yunus
>
> Thank you very much for your detail explanation
> Let me tells more about my data :
>
> On Tue, Dec 18, 2012 at 1:32 PM, Muhammad Yunus Ahmad Mazuki <
> ukm.yunus at gmail.com> wrote:
>
>> >>I would like to raise a question. You used "TDEF    300 LINEAR
>> >>13:00Z10apr2004  4mn". Every 4 minutes means, there's 150 data >>point
>> for 10 hours for one day. How many file are you templating? >>What are the
>> times in the files? If you said 10 days, that means 1500 >>data point for
>> for 10 hours for 10 days.
>>
>> *my file data consist of day and hour (one day folder consist 24 hours
> data)*
> *For example : 20040410 (folder) consist (1000.dat, 1001.dat,...1023.dat)*
> *now the set of data consist of 29 days data in the different month (from
> 10 april until 9 may)*
>
>  >>But if your files are hours and minutes, and jumps from 2200 day 1 to
> >>1300 day 2, if I'm not wrong, that 1300 day 2 will be registered as
> >>2300 day 1 in GrADS. You can check by typing "set t 150" and "set t
> >>151" to see the date registered to it. You can also use
>
>>
>> >>'R1=ave(R,time=1,time=150)+ave(R,time=151,time=300)'
>>
>> *The time from 1 - 150 is means from 00 am - 10 am right??*
> *and the time from 151 - 300 is 11 am - 21 pm right?? *
>
> >>I believe you intend to only template 2 files, and your tdef is correct.
>> >>But are there only two file in the folder you're working on?, if
>> >>there's more, that might be a problem.
>
>
> I think I have to use more time in tdef (maybe 600??)..
> in one folder day data contain 24 hours data, so maybe I have to tdef
> around 3600, for making average for 10 days data, because one day data will
> contain 360 time??
>
> Please explain me more Mr. Yunus.
>
> Thank you very much
>
> Best regards,
> wendi
>
>
>>
>>
>> Yunus
>>
>>
>>
>> On Tue, Dec 18, 2012 at 10:03 AM, wendi harjupa <wendiharjupa at gmail.com>wrote:
>>
>>> Dear Jennifer
>>>
>>> Thank you very much for your detail explanation.
>>> It help me much.
>>>
>>> Best regards,
>>> wendi
>>>
>>> On Tue, Dec 18, 2012 at 3:46 AM, Jennifer Adams <jma at cola.iges.org>wrote:
>>>
>>>>
>>>> On Dec 17, 2012, at 1:13 PM, Jeff Duda wrote:
>>>>
>>>> Remove LITTLE_ENDIAN from your options line.  There's no such option.
>>>>
>>>> This statement is incorrect. "Little endian" is a perfectly acceptable
>>>> keyword for the OPTIONS entry.
>>>> Please consult the documentation before making declarations like this
>>>> in the forum!!!
>>>>
>>>>
>>>>
>>>> On Mon, Dec 17, 2012 at 5:13 AM, wendi harjupa <wendiharjupa at gmail.com>wrote:
>>>>
>>>>> Dear Mr. Jeff
>>>>>
>>>>> I have tried the script that you sent but, still I could not do this
>>>>> would you please help me more.
>>>>>
>>>>> Here some question
>>>>> 1. Is my control file ok?
>>>>>     I want to use single control file
>>>>>
>>>> You didn't mention what your file names look like. Do they match your
>>>> template substitution strings?
>>>> The way you have it set up, the file 20040410/1013.dat should contain
>>>> 15 grids, one for every 4 minutes. If not, then something is wrong with the
>>>> way you've set it up but you need to tell us more about your data files
>>>> first.
>>>>
>>>>
>>>> 2. base on my gs and control file below, I got error message
>>>>>    'Cannot contour grid - all undefined values'
>>>>>
>>>> This means there is no data file for the time specified in your
>>>> dimension environment, or else (if the file exists) all the data in that
>>>> file are the same as the missing value.
>>>>
>>>>
>>>>    'Cannot plot color bar: No shading information'
>>>>>
>>>> If you try to query the shade levels when no plot has been drawn (due
>>>> to error mentioned above), then this is the error message you will get.
>>>>
>>>>    'No hardcopy metafile open'
>>>>>
>>>> This is because you have use the 'disable print' command without using
>>>> 'enable print' first. If all you want is the image output from the printim
>>>> command, then remove the 'disable print' from your script.
>>>>
>>>> --Jennifer
>>>>
>>>>
>>>>    what the meaning of error message??
>>>>>
>>>>> below is control file (*try.ctl)* file
>>>>>
>>>>> 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    300 LINEAR 13:00Z10apr2004  4mn
>>>>> VARS    2
>>>>> ref 39  99  Reflectivity(dBZ)
>>>>> vel 39  99  Doppler Velocity(m/s)
>>>>> ENDVARS
>>>>>
>>>>> this is my gs file (averaging for 2 days only)
>>>>>
>>>>> '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 5'
>>>>> '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 300'
>>>>> 'R=pow(10, ref/10)'
>>>>>
>>>>> 'R1=ave(R,time=13Z10apr2004,time=22Z10apr2004)+ave(R,time=13Z11apr2004,time=22Z11apr2004)'
>>>>> 'R2=R1/2'
>>>>> 'R3=log10 (R2)'
>>>>> 'd 10*R3'
>>>>> '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 baru.gif white'
>>>>> 'disable print'
>>>>>
>>>>> 'close 1'
>>>>>
>>>>> Thank you very much for your help
>>>>> best regards,
>>>>> wendi
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Sun, Dec 16, 2012 at 7:03 PM, wendi harjupa <wendiharjupa at gmail.com
>>>>> > wrote:
>>>>>
>>>>>> Dear Mr. Jeff
>>>>>>
>>>>>> Thank you very much for your detail explanation
>>>>>> I will try it.
>>>>>>
>>>>>> Best regards,
>>>>>> wendi
>>>>>>
>>>>>>
>>>>>> On Sat, Dec 15, 2012 at 2:24 AM, Jeff Duda <jeffduda319 at gmail.com>wrote:
>>>>>>
>>>>>>> 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
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> 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
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> -------------
>>>>> 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
>>>>
>>>>
>>>>  --
>>>> Jennifer M. Adams
>>>> IGES/COLA
>>>> 4041 Powder Mill Road, Suite 302
>>>> Calverton, MD 20705
>>>> jma at cola.iges.org
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> 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
>>>
>>>
>>
>> _______________________________________________
>> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20121218/66ab4206/attachment-0003.html 


More information about the gradsusr mailing list