[gradsusr] Grads Bash scripting

Meredith Croke mcroke at airdat.com
Wed Sep 1 12:30:40 EDT 2010


Thanks for everyones input.. Its somewhat working.  I say somewhat because it seems like grads is getting hung up, the bash script opens grads but then it just stops, I took it out of batch mode in the hopes of seeing more detail, but no luck.  I also tried it with the variables before and after the run command:

/export/grads/bin/gradsc -lc 'run /lustre-sas1/automate/RTFDDA_track.gs "${yyyy} | ${name}"'

And in my grads script I have at the very top:
pull data
YY=subwrd(data,1)
name=subwrd(data,2)
say 'heres my name and date: 'name' 'YY
'open /lustre-sata1/data/cycles/grib_output/'YY'/grads/tropfdda0/tropfdda0.ctl'

I'm not even seeing the say command. 

Thanks again for all your help.

Meredith

-----Original Message-----
From: gradsusr-bounces at gradsusr.org [mailto:gradsusr-bounces at gradsusr.org] On Behalf Of Goodson,Ron [Edm]
Sent: Wednesday, September 01, 2010 11:08 AM
To: GrADS Users Forum
Subject: Re: [gradsusr] Grads Bash scripting

in case not already answered... I would think you need

echo "blah blah blah" ... (add the quotes).  I haven't tried though as I just usually do

grads -blc "run script.gs blah blah blah" 


Ron Goodson		
Prairie and Northern Meteorological Service of Canada Science Section	Unité des Sciences, Région des Prairies et du Nord, Service Météorologique du Canada	
Environment Canada
Room 200 ; 4999 - 98 Avenue
Edmonton Alberta T6B 2X3	Environnement Canada
Pièce 200 ; 4999 - 98 Avenue
Edmonton Alberta T6B 2X3	
Telephone | Téléphone	780 951 8791	
Email | Courriel	ron.goodson at ec.gc.ca	



-----Original Message-----
From: gradsusr-bounces at gradsusr.org [mailto:gradsusr-bounces at gradsusr.org] On Behalf Of Don Van Dyke
Sent: August 31, 2010 8:53 PM
To: GrADS Users Forum
Subject: Re: [gradsusr] Grads Bash scripting

Hi Meredith,

Yeah, that should work.  What error did you get?  The only thing I see potentially wrong there is to check and make sure you have
lat=subwrd(data,3) and not Lat=subwrd(data,3) in your GrADS script.  :-)

Don Van Dyke
NWS Tallahassee, FL

Meredith Croke wrote:
> 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
>   


_______________________________________________
gradsusr mailing list
gradsusr at gradsusr.org
http://gradsusr.org/mailman/listinfo/gradsusr




More information about the gradsusr mailing list