[gradsusr] Grads script won't run (out of ideas)

Michael Biggs gradsuser at doubleplum.net
Tue Nov 8 13:48:36 EST 2011


Hi Rowell,

Very interesting.. Your script gives a "Syntax Error" because it uses the
Tab character, rather than spaces.  GrADS does not seem to be able to handle
the Tabs.  So please replace your indentations with spaces instead.  This
should mostly solve your problem.  Also make sure that you find and remove
the trailing tab character that is at the end of line 21, which looks like:
     'd skip(UGRDprs,3,3);VGRDprs;mag(UGRDprs,VGRDprs)'

(The hidden tab isn't in this email, but your text-editor should be able to
find it in your script.)

Once that's fixed, you still have to fix your mistmatched quotes near the
end of your script.  This is another confusing thing about GrADS.  In the
last lines of your loop you have:
     'printim 19981218_'tt.png x800 y600'
     'clear
What you want instead is:
     'printim 19981218_'tt'.png x800 y600'
     'clear'

That is, the command for printim is in a string which will be interpreted by
grads.  You drop out of the string to insert the variable 'tt' (which will
be the number you want in the filename), and then go back into the string to
finish the printim commands with its options, and then finally you must
terminate the string.

Similarly, "clear" is a "real" GrADS command, so you have to have it
contained in single-quotes so that it will run.

I recommend you get a text-editor that has syntax highlighting for GrADS
which can help to point out the weird GrADS-script-quoting mechanism;
otherwise it would have been difficult for me to find the problem.  And same
goes for treating Tab-characters and Space-characters differently.  vim does
this for me on my machine.

Anyway, I have attached my version of your script.  Hope this helps,

__
Michael Biggs


On Tue, 8 Nov 2011, Rowell, Mason D. wrote:
> All,
>
> I tried some fixes suggested by Jeffery Duda. This script still fails at the while loop. Can anyone see what the problem is? See the attached.
>
> Mason
-------------- next part --------------
'open wrfprs_d02_000.ctl'
'set lev 850'
'set lat 34 46'
'set lon -114 -97'
tt = 1
while (tt <= 2)
    'set mpdset hires'
    'set background 1'
    'set display color white'
    'set map 0 0 0'
    'set t 'tt
    'set cint 10'
    'set ccolor 0'
    'd HGTprs'
    'set clab %.0f`3.`1C'
    'set cint 2'
    'set cstyle 2'
    'set ccolor 2'
    'd (TMPprs - 273)'
    'set gxout barb'
    'd skip(UGRDprs,3,3);VGRDprs;mag(UGRDprs,VGRDprs)'
    'printim 19981218_'tt'.png x800 y600'
    'clear'
    tt = tt + 1
endwhile


More information about the gradsusr mailing list