[gradsusr] Grads Bash scripting

Gregory Clarke gsclarke at emirates.net.ae
Tue Aug 31 22:32:42 EDT 2010


Meredith,

Place the arguments behind your script name; i.e. 

/export/grads/bin/gradsc -blc "run gs.sf.surface.wind_mps ${yyyy} ${name}
${lat}"

then use similar commands at the top of your script as before using "args"
instead of "data":

yyyy=subwrd(args,1)
name=subwrd(args,2)
Lat=subwrd(args,3)


Greg

-----Original Message-----
From: gradsusr-bounces at gradsusr.org [mailto:gradsusr-bounces at gradsusr.org]
On Behalf Of Meredith Croke
Sent: Wednesday, 01 September, 2010 05:54
To: GrADS Users Forum
Subject: Re: [gradsusr] Grads Bash scripting

Thank you very much for your suggestion, this did work.  Now if I want
to pass multipe varibale(ie lat/lon, name) can I do it the same way
listing them before the export?  Ie:
echo ${yyyy} ${name} ${lat} | /export/grads/bin/gradsc -blc "run
gs.sf.surface.wind_mps"

yyyy=subwrd(data,1)
name=subwrd(data,2)
Lat=subwrd(data,3)

I am getting an error when I do it this way.

Thanks.

Meredith

-----Original Message-----
From: gradsusr-bounces at gradsusr.org
[mailto:gradsusr-bounces at gradsusr.org] On Behalf Of Don.VanDyke at noaa.gov
Sent: Tuesday, August 31, 2010 5:02 PM
To: GrADS Users Forum
Subject: Re: [gradsusr] Grads Bash scripting

Hi Meredith,

To go from bash to GrADS, try doing something like this.  In your bash
script, add a line like this....

echo ${yyyy} | /export/grads/bin/gradsc -blc "run
gs.sf.surface.wind_mps"

In your gs.sf.surface.wind_mps script, at the very top, add these
lines....

pull data
yyyy=subwrd(data,1)

Then you can reference the yyyy in the rest of the GrADS script like
this....
'draw title Testing 'yyyy' year'

Hope this helps some.

Don Van Dyke
NWS Tallahassee, FL

----- Original Message -----
From: Meredith Croke <mcroke at airdat.com>
Date: Tuesday, August 31, 2010 4:39 pm
Subject: [gradsusr] Grads Bash scripting
To: gradsusr at gradsusr.org


> Hi,
>  
> I am trying to write a bash script that will read values from a
> tc-vitals file and feed it into my grads script.   Can anyone give me
> tips on how to do this?  I'm not sure how to feed the varibales from
> bash into grads.   I have tried doing this in a bunch of different
ways
> and searched the users forum but I can't find any good examples.  
> Here's one example, trying to have the date read in grads:
> in bash:
>  
> yyyy=$(date +%Y%m%d$hh)
> /export/grads/bin/gradsc -blc 'run gs.sf.surface.wind_mps'
>  
> in grads
> date= yyyy
> (i've tried 'yyyy' and $yyyy)
>  
> what else do I need to put in bash or in my grads script to recognize 
> that yyyy= 2010083112 ?
>  
> Any help is greatly appreciated.
>  
> Meredith
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> 
_______________________________________________
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




More information about the gradsusr mailing list