[gradsusr] calculation using results of subwrd
Lopez, Hosmay
hlopez at rsmas.miami.edu
Fri May 17 10:48:06 EDT 2019
Hi Sim,
The GrADS function "mag" only works with GrADS graded data and not the u850 and v850 defined by subwrd
You can try this instead:
shearspd = math_sqrt(u50*u50 + v50*v50)
Best,
Hosmay
________________________________
From: gradsusr <gradsusr-bounces at gradsusr.org> on behalf of sim.aberson <sim.aberson at noaa.gov>
Sent: Friday, May 17, 2019 10:23 AM
To: GrADS Users Forum
Subject: [gradsusr] calculation using results of subwrd
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 https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcola.gmu.edu%2Fgrads%2Fgadoc%2Fvariable.html&data=02%7C01%7Chlopez%40rsmas.miami.edu%7C81756954ee1c4a76fb4708d6dad375a2%7C2a144b72f23942d48c0e6f0f17c48e33%7C0%7C0%7C636936999170974449&sdata=jA7sqknTzTeXCVtHlw%2BumL5iQhjHTD%2FFwHMyjbPRya4%3D&reserved=0, but didn't find
anything that would help. The documentation page
https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcola.gmu.edu%2Fgrads%2Fgadoc%2Fscript.html&data=02%7C01%7Chlopez%40rsmas.miami.edu%7C81756954ee1c4a76fb4708d6dad375a2%7C2a144b72f23942d48c0e6f0f17c48e33%7C0%7C0%7C636936999170974449&sdata=sStvsspuXHf7RUR1R9pVp94spNSJLMHt0RMa%2BYbh26Y%3D&reserved=0 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
_______________________________________________
gradsusr mailing list
gradsusr at gradsusr.org
https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgradsusr.org%2Fmailman%2Flistinfo%2Fgradsusr&data=02%7C01%7Chlopez%40rsmas.miami.edu%7C81756954ee1c4a76fb4708d6dad375a2%7C2a144b72f23942d48c0e6f0f17c48e33%7C0%7C0%7C636936999170974449&sdata=kP424jWj0fyYpt4f%2FWZ73TWFZLRu63ei%2FGwZhckCMxs%3D&reserved=0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gradsusr.org/pipermail/gradsusr/attachments/20190517/c63d3a1e/attachment.html>
More information about the gradsusr
mailing list