[gradsusr] Anyway to have a 'master' file that gets included before anything else in a .gs file?

Jennifer Adams jma at cola.iges.org
Sun Nov 1 11:40:59 EST 2015


Oops … there was one missing line in parseargs.gsf … it is now highlighted in red. 

On Oct 30, 2015, at 6:37 PM, Jennifer Adams <jma at cola.iges.org> wrote:

> > cat yourMainScript.gs
> function main(args)
> rc=gsfallow("on")
> parseargs(args) ;* parses the args
> myshades()      ;* defines colors
> 
> > cat myshades.gsf
> function myshades()
> 'set rgb 16  90   0   0'   ;* map color
> 'set rgb 17 100 100 100'   ;* dark grey
> 'set rgb 18 200 200 200'   ;* light grey
> 
> > cat parseargs.gsf
> function parseargs(args)
> a=1
> while (1)
>   _arg.a=subwrd(args,a)
>   if (_arg.a=''); break; endif
>   a=a+1
> endwhile
> _nargs=a-1
> 
> 
> 
> It is so much easier to explain by showing an example. 
> —Jennifer
> 
> 
> 
> On Oct 30, 2015, at 6:23 PM, Christopher Gilroy <chris.gilroy at gmail.com> wrote:
> 
>> Hey Jennifer,
>> 
>> Thanks for the reply. Yea I figured out how to partially get it to work. Since I have a function that reads command line arguments apparently that has to be the very first thing in the file or grads hangs. In other words it can't be in the "master" file, even if that's the first thing, on the first line, that grads does. The actual function that handles the command line argument needs to be the first thing (seemingly) in the actual grads script.
>> 
>> Am I missing something or is that normal?
>> 
>> On Fri, Oct 30, 2015 at 6:13 PM, Jennifer Adams <jma at cola.iges.org> wrote:
>> What you are talking about are GrADS script functions. http://iges.org/grads/gadoc/gsf.html
>> —Jennifer
>> 
>> On Oct 30, 2015, at 12:54 PM, Christopher Gilroy <chris.gilroy at gmail.com> wrote:
>> 
>>> So basically instead of having:
>>> 
>>> function map(arg)
>>> if (arg = '')
>>>    pull cmdline
>>> else
>>>    cmdline=arg
>>> endif
>>> 
>>> map=subwrd(cmdline,1)
>>> 
>>> if (map = 'conus')
>>>   latr='18 62'
>>>   lonr='-130 -58'
>>> endif
>>> 
>>> if (map = 'alaska')
>>>   latr='50 74'
>>>   lonr='-170 -135'
>>> endif
>>> 
>>> if (map = 'test')
>>>   latr='48 56'
>>>   lonr='-85 -63'
>>> endif
>>> 
>>> if (map = 'blah')
>>>   latr='62 70'
>>>   lonr='-162 -150'
>>> endif
>>> 
>>> 'open /gfsmodeldata/gfs.ctl'
>>> 'set dfile 1'
>>> 
>>> 'set mproj latlon'
>>> 'set display color white'
>>> 'set csmooth on'
>>> 'set grid off'
>>> 'set grads off'
>>> 'set mpdset hires'
>>> 'set map auto'
>>> 'set line 1'
>>> 'set csmooth on'
>>> 'set grads off'
>>> 'set gxout shaded'
>>> *PAGE SIZE
>>> 'set vpage 0.0 11.0 0.0 8.5'
>>> *PLOT SIZE
>>> 'set parea 0.4 10.3 0.4 7.9'
>>> 
>>> at the top of all of our gfs scripts, we can put that into a "gfs_master.gs" and just "include" that in at the very top of all of our gfs scripts? This way as we add more "defaults" to the configuration we just edit one file instead of every single script?
>>> _______________________________________________
>>> gradsusr mailing list
>>> gradsusr at gradsusr.org
>>> http://gradsusr.org/mailman/listinfo/gradsusr
>> 
>> --
>> Jennifer M. Adams
>> Center for Ocean-Land-Atmosphere Studies (COLA)
>> 111 Research Hall, Mail Stop 2B3
>> George Mason University
>> 4400 University Drive
>> Fairfax, VA 22030 
>> 
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>> 
>> 
>> 
>> 
>> -- 
>> -Chris A. Gilroy
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
> 
> --
> Jennifer M. Adams
> Center for Ocean-Land-Atmosphere Studies (COLA)
> 111 Research Hall, Mail Stop 2B3
> George Mason University
> 4400 University Drive
> Fairfax, VA 22030 
> 
> 
> 
> 
> 
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr

--
Jennifer M. Adams
Center for Ocean-Land-Atmosphere Studies (COLA)
111 Research Hall, Mail Stop 2B3
George Mason University
4400 University Drive
Fairfax, VA 22030 





-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20151101/da4d63da/attachment.html 


More information about the gradsusr mailing list