simple script problem

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


Diane

I forgot to mention- the ps output type actually DOES
work and so does eps! At least, xv is reading my output
as postscript- the real test will be in trying to print it.

Anyway, thanks again.

Barr

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