[gradsusr] Grads Bash scripting
Ricardo Hallak
hallak at model.iag.usp.br
Tue Aug 31 16:06:01 EDT 2010
Hi,
another suggestion is to call the shell command <date> directly from the grads
script:
'!date +%Y%m%d > date.txt'
rec=read('date.txt')
yyyy=sublin(rec,2)
say yyyy
The only inconvenience in this method is that you will create an additional
file called <date.txt> in your directory, although you can remove it after
using it:
'!rm -f date.txt'
There are other options, I guess, but it will depend on your specific needs.
Regards,
Ricardo
On Tue, 31 Aug 2010 17:02:24 -0400, Don.VanDyke wrote
> 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
Ricardo Hallak
Department of Atmospheric Sciences (DCA)
Institute of Astronomy, Geophysics and Atmospheric Sciences (IAG)
University of São Paulo (USP)
Rua do Matão, 1226 - Cidade Universitária - São Paulo SP 05508-900
Phone.: +55 (11) 3091-2850; 3091-4703
Fax: +55 (11) 3091-4714
More information about the gradsusr
mailing list