Passing arguments to Grads script
Daniel.Leins at NOAA.GOV
Tue Feb 1 00:34:29 EST 2005
Ok, this works fine. Now, what if I get greedy and want to pass an "AM"
or "PM" timestamp to the title as well, i.e. I've passed a "3", now I
want to pass "PM"
so the title reads "Current Temperatures as of 3 PM. Or, what if I want
to pass the month/day/year and add that into the title as well. I've
been successful in getting this data into the script and getting it to
display in the title, however, how do I add spaces between these
arguments? Right now, it's coming out like this:
Current Temps as of 10:00PM020105
What if I wanted a space between the PM and the 02? What's the best way
to accomplish this?
Ben-Jei Tsuang wrote:
> Dear Dan:
> You can put the following script in the top of the script
> function main(args)
> say "temps.gs " args
> * Get arguments
> if (args='?')
> say 'temps.gs requires 1 argument: hh'
> say 'hh = local time'
> 'draw title Current Temperatures as of 'hh
> Ben-Jei Tsuang, Prof
> Nat'l Chung-Hsing Univ.
> Dept. of Environmental Engineering
> email: tsuang at nchu.edu.tw
> ----- Original Message -----
> From: "Daniel Leins" <daniel.leins at NOAA.GOV>
> To: <GRADSUSR at LIST.CINECA.IT>
> Sent: Tuesday, February 01, 2005 9:37 AM
> Subject: Passing arguments to Grads script
>> I have written a script to plot temperatures across a given area.
>> When it
>> comes to titling the images, I would like to pass the current time to
>> script, then have this argument displayed through 'draw title'. For
>> If it is 15:00, I would like to pass the time to my script, and do
>> draw title Current Temperatures as of @ARGV
>> where @ARGV comes from gradsdods -l -b -c "run temps.gs 15:00"
>> (i am aware that @ARGV is not correct, I am simply using this
>> syntax as
>> an example).
>> If I wanted to pass the title itself to the script instead of the time,
>> draw title @ARGV
>> where @ARGV comes from gradsdods -l -b -c "run temps.gs Dewpoints"
>> I've looked through several scripts online which involve passed
>> however I haven't been able to find anything that pertains to this. I
>> need to perform any sort of calculations on the passed argument, I
>> need to pass it into the script, and have it passed back out in the
>> section. What is the best way to accomplish this?
>> Dan Leins
More information about the gradsusr