[gradsusr] Problem calculating max temp in loop

Renée C. Elder renee.c.elder at gmail.com
Fri Jan 23 17:55:47 EST 2015


Hello grads users,

I'm trying to create a file that has the daily maximum values from my
hourly wrf output. I'm using grads2.0.a8.

Below is the script that I've written and the error messages I get after
running the script. I'm not certain if there is a particular maximum value
function necessary when using a script but hopefully someone can help.

In this script I did not put the line: define tmax=max(t2, t=t, t+23) in
quotes and there seems to be an issue with the 'max' function. In the
second script, I put that line in quotes resulting in a couple syntax
errors so I'm not certain if the quotes are necessary.

'open Piarco_may1_hrly.ctl'

'set gxout fwrite'
'set fwrite tmaxtest.dat'

t=1
while (t<=25)
    'set t ' t

    say t

    define tmax=max(t2, t=t, t+23)

    'd tmax'
    t = t+24
endwhile
'disable fwrite'

ERROR MESSAGE FOR ABOVE SCRIPT
Function not found: max
  Error occurred on line 11
  In file tmax.gs

'open Piarco_may1_hrly.ctl'

'set gxout fwrite'
'set fwrite tmaxtest.dat'

t=1
while (t<=25)
    'set t ' t

    say t

    'define tmax=max(t2, t=t, t+23)'

    'd tmax'
    t = t+24
endwhile
'disable fwrite'

ERROR MESSAGE FOR ABOVE SCRIPT
Syntax Error:  Invalid dimension expression
  Dimension value missing or invalid
Error from MAX:  1st dimension expression invalid
Operation Error:  Error from max function
  Error ocurred at column 1
DEFINE error:  Invalid expression.
Syntax Error:  Invalid Operand
  'tmax' not a variable or function name
  Error ocurred at column 1
DISPLAY error:  Invalid expression
  Expression = tmax
25
Syntax Error:  Invalid dimension expression
  Dimension value missing or invalid
Error from MAX:  1st dimension expression invalid
Operation Error:  Error from max function
  Error ocurred at column 1
DEFINE error:  Invalid expression.
Syntax Error:  Invalid Operand
  'tmax' not a variable or function name
  Error ocurred at column 1
DISPLAY error:  Invalid expression
  Expression = tmax


Renée C. Elder
PhD Student
Geography (Meteorology-Climatology)
Arizona State University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20150123/d4cee3cb/attachment.html 


More information about the gradsusr mailing list