my script error

Jeffrey Duda jdduda at IASTATE.EDU
Tue Nov 17 22:40:21 EST 2009


Antoy,
In your bold line (543), the variable "sig_waves" appears to have been
obtained using the subwrd statement from a line of text output from another
command.  Thus, the variable sig_waves is being stored as a string
(character/text) and not a number.  To get around this, simply put sig_waves
in single quotes in line 543.  See if that works.

Note also that if you do this anywhere else in the script, you'll need to
surround those variables with single quotes as well to avoid this same
problem.

Jeff

On Tue, Nov 17, 2009 at 9:11 PM, Antoy Chang <antoyc at yahoo.com> wrote:

> Dear Jeff,
>
> I manage to solve the error but another error is encountered :
>
> in my script ;
>
> 'd
> ave(wht,t='y',t='y+2')'
>
>
>
>
>
> sigwa=sublin(result,2)
>
>
> sig_waves=subwrd(sigwa,4)
>
>
> if
> sig_waves=9.999e+20
>
> SIG.incr="undefined"
>
> else
>
> fmt =
> '%4.1f'
>
> *SIG.incr=math_format(fmt,sig_waves)
> *SIG.incr=math_nint(sig_waves*10.0)  --------> line 543
> *
> if SIG.incr<3
> SIG.incr=3
> endif
> SIG.incr=math_format(fmt,SIG.incr/10)
> endif
>
> SIG=SIG%","%SIG.incr
>
>
>
> 'd ave(mpr,t='y',t='y+2')'
>
> wavper=sublin(result,2)
>
> wave_per.incr=subwrd(wavper,4)
>
> if
> wave_per.incr=9.999e+20
>
> PER.incr="undefined"
>
> else
>
> *
>
> PER.incr = math_nint(wave_per.incr)
> endif
>
> PER=PER%","%PER.incr
>
>
>
> with same error message as previous one.
>
> Thank you very much.
> Best Regards,
> Antoy
>
> --- On Wed, 11/18/09, Jeffrey Duda <jdduda at iastate.edu> wrote:
>
>
> From: Jeffrey Duda <jdduda at iastate.edu>
> Subject: Re: my script error
> To: antoyc at yahoo.com
> Date: Wednesday, November 18, 2009, 12:25 AM
>
>
>
> Try putting line 454 and the one after it in single quotes.  Since you're
> using these variables in a display command, they need to be defined outside
> the script.
>
> Jeff Duda
>
>
> On Tue, Nov 17, 2009 at 2:09 AM, Antoy Chang <antoyc at yahoo.com> wrote:
>
>
>
>
>
>
> Dear All,
> Can someone here help me this script error, my script is as below :
>
> 'd wdr'
> wind_dirn.incr=subwrd result,4)
> if wind_dirn.incr=9.999e+20
> wind_dirn.incr="undefined"
> else
> 'define wind_dirn.incr = math_nint(wind_dirn.incr)'
> endif
> *
>
> *
> *determine the resultant wind for three output times
> pi = 3.1415926
> d2r = pi/180
> r2d = 1/d2r
> fmt = '%-6.4f'
>
> wamv=cos(0.0174532*wdr)*w10 -----> Line 454
> wamu=sin(0.0174532*wdr)*w10
>
> 'd sum(wamu,t= 'y',t= 'y+2')'
> udirs=sublin(result,2)
> udir=subwrd(udirs,4)/3
>
>  The error message :
>
> DEFINE error: Name too long; missing '='
> Non numeric args to numeric operation
> Error occurred processing function arguments
>       Error occurred on line 454
>       In file E\KC\WORK\Adhoc_~1\Langkawi.gs
> ga->
>
>
>
>
> --
> Jeff Duda
> Iowa State University
> Meteorology Graduate Student
> 3134 Agronomy Hall
> www.meteor.iastate.edu/~jdduda <http://www.meteor.iastate.edu/%7Ejdduda>
>
>


--
Jeff Duda
Iowa State University
Meteorology Graduate Student
3134 Agronomy Hall
www.meteor.iastate.edu/~jdduda
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20091117/37961cfb/attachment.html 


More information about the gradsusr mailing list