simple script problem

Barry Barry.E.Schwartz at NOAA.GOV
Fri Oct 20 01:20:28 EDT 2006


Hey Diane

Your fix fixed my script- thanks!
Yes, the blanks do create a problem, but I wasn't getting
my "substitution" for the variable hr without the ";" between
the "if" and expression. I misread the documentation thinking
I didn't need the ";".

How ya doing? I'm such an old man I am retired but doing stuff
part time for NOAA and working for free for Bill Gray.

Hope you are OK! As you can see I'm new to Grads. Some of the doc
is not great but I need to be more careful

Thanks again!

Barry

Diane Stokes wrote:
> Hey, Barry.
>
> In addition to Dave's comments:
>
> Your if-statements need a semi-colon after the condition, eg:
>
> if (hr = 1); hour = "00Z" ; endif
>
> Your "full sky" label will lead to the same filename problem Dave
> mentions.  Perhaps "full_sky" will help.
>
> Also, printim won't yield a post script file.  It will produce png or
> gif.  For postscript, you want something along the lines of:
>
> 'enable print filename.gm'
> 'print'
> 'disable print'
> Then, outside of grads, use gxps to convert the grads metafile to
> postscript.  Or you can use the bang command to call the gxps from
> inside the script, eg:
> '! gxps -i filname.gm -o >> 'stat'_'season'_'hour'_'type'.ps'
>
> I don't know if that will cover everything, so write back if you have
> further problems.
>
>    Cheers!
>      Diane
>
>
>
> Dave Allured wrote:
>> Barry,
>>
>> For one thing, your use of spaces in the printim command is
>> incorrect.  Spaces are significant *inside* the quote marks, but not
>> *outside*.  Look closely.  As written, each underscore will have
>> spaces around it before the printim command is executed.  This does
>> not construct a very nice filename, and I would expect Grads to gag
>> here.  HTH.
>>
>> --Dave
>>
>> Barry wrote:
>>> HI all
>>>
>>> I'm having another (what must be) simple problem;
>>> I am attempting my first grads script (.gs) and I can't
>>> seem to get the script to interpret my alphanumeric
>>> assignments.
>>>
>>> What I am trying to do is run a plot 9 times- the binary
>>> file has 9 times of day in it (ignore the commented out statements)...
>>> I simply want to write a title for each one and create a postscript
>>> output file with a unique name indicating what the plot is.
>>>
>>> Can someone tell me what is wrong- again, the documentation on scripts
>>> has nothing like what I am trying to do.
>>>
>>> Thanks folks!
>>>
>>> barry
>>>
>>> 'open test.ctl'
>>> 'set display grey white'
>>> 'set lat 15 40'
>>> 'set lon -180 -140'
>>> 'set cint 5'
>>> stat = "average"
>>> season = "winter"
>>> type = "full sky"
>>> *s = 1
>>> *while (s < 6)
>>>
>>> *if (s = 1) season = winter ; endif
>>> *if (s = 2) season = spring ; endif
>>> *if (s = 3) season = summer ; endif
>>> *if (s = 4) season = fall   ; endif
>>> *if (s = 5) season = year   ; endif
>>>
>>> hr = 1
>>> while (hr < 10)
>>>
>>> if (hr = 1) hour = "00Z" ; endif
>>> if (hr = 2) hour = "03Z" ; endif
>>> if (hr = 3) hour = "06Z" ; endif
>>> if (hr = 4) hour = "09Z" ; endif
>>> if (hr = 5) hour = "12Z" ; endif
>>> if (hr = 6) hour = "15z" ; endif
>>> if (hr = 7) hour = "18z" ; endif
>>> if (hr = 8) hour = "21z" ; endif
>>> if (hr = 9) hour = "day" ; endif
>>>
>>> *'set t 's' '
>>> 'set lev 'hr' '
>>> 'display stat'
>>> 'draw title 'stat'  'season'  'hour'  'type''
>>> 'printim 'stat' _ 'season' _ 'hour' _ 'type' .ps'
>>> 'clear'
>>> *'close 1'
>>>
>>> hr = hr + 1
>>> endwhile
>>>
>>> *s = s + 1
>>> *endwhile
>
> --
> Diane Stokes
> Environmental Modeling Center
> National Weather Service/NOAA



More information about the gradsusr mailing list