[gradsusr] Problem calculating max temp in loop

Jeff Duda jeffduda319 at gmail.com
Sat Jan 24 18:00:55 EST 2015


Oh, you need to put single quotes around that command, and all other
commkands that you could run from the command prompt. The only script lines
that do not need to be surrounded by single quotes are commands unique to
the Grads scripting language, such as if statements, while loops, setting
script variables, and calling other functions.

Jeff

On Sat, Jan 24, 2015 at 1:52 PM, Renée C. Elder <renee.c.elder at gmail.com>
wrote:

> Thanks for your help Jeff. Unfortunately, I get the same error by using
> t=t-0. I really meant to just put t and not t=t but that wouldn't matter.
> It seems that it doesn't like the max function. It says Function not
> found: max.
>
> Is there an alternate way to create a file with only the max temperatures?
>
> Thanks, Renée
>
>
> Message: 2
> Date: Fri, 23 Jan 2015 17:40:11 -0600
> From: Jeff Duda <jeffduda319 at gmail.com>
> Subject: Re: [gradsusr] Problem calculating max temp in loop
> To: GrADS Users Forum <gradsusr at gradsusr.org>
> Message-ID:
>         <CAAig09Be-eiSWYPYaMdqgpMh5HqKH6oXZ2k=
> qcBL0Pn7o0GSfQ at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Replace t=t with t=t-0 in your max function.
>
> Jeff Duda
>
> On Fri, Jan 23, 2015 at 4:55 PM, Ren?e C. Elder <renee.c.elder at gmail.com>
>
> wrote:
>
> > 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
> >
> > _______________________________________________
> > gradsusr mailing list
> > gradsusr at gradsusr.org
> > http://gradsusr.org/mailman/listinfo/gradsusr
> >
> >
>
>
> --
> Jeff Duda
> Graduate research assistant
> University of Oklahoma School of Meteorology
> Center for Analysis and Prediction of Storms
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://gradsusr.org/pipermail/gradsusr/attachments/20150123/3067bda9/attachment-0001.html
>
> Renée C. Elder
> PhD Student
> Geography (Meteorology-Climatology)
> Arizona State University
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>


-- 
Jeff Duda
Graduate research assistant
University of Oklahoma School of Meteorology
Center for Analysis and Prediction of Storms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20150124/70517f28/attachment.html 


More information about the gradsusr mailing list