[gradsusr] calculation using results of subwrd

sim.aberson sim.aberson at noaa.gov
Fri May 17 10:23:39 EDT 2019


I am trying to use grads to calculate a mean u and mean v over my 
domain, then convert the values to direction and speed.  Since speed is 
easier, I start with that:

'd aave(ave(ugrdprs,lev=925,lev=700),x=1,x=463,y=1,y=425)'
theline = sublin(result,2)
u850 = subwrd(theline,4)
'd aave(ave(vgrdprs,lev=925,lev=700),x=1,x=463,y=1,y=425)'
theline = sublin(result,2)
v850 = subwrd(theline,4)
say 'u850,v850= 'u850' 'v850
shearspd=mag(u850,v850)

u850,v850= -4.44537 -0.528102
Syntax Error:  Invalid Operand
   'u850' not a variable or function name
Operation Error:  Error from mag function
   Error ocurred at column 1

So, I get values for u850 and v850, but then the error that the results 
are not a "variable or function name."  I looked over the documentation 
at http://cola.gmu.edu/grads/gadoc/variable.html, but didn't find 
anything that would help.  The documentation page 
http://cola.gmu.edu/grads/gadoc/script.html has examples of using the 
results of subwrd in if constructs, but not in arithmetic calculations.

I also tried to define the variables, but that threw the error:

DEFINE error:  Invalid expression.
Syntax Error:  Invalid Operand
   'subwrd' not a variable or function name
   Error ocurred at column 1

I also looked through the archives here and didn't find anything helpful.

Is there a way to get the results to be a variable to do the calculation 
I want?

Thanks,
Sim


More information about the gradsusr mailing list