<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Sim,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
The GrADS function "mag" only works with GrADS graded data and not the u850 and v850 defined by subwrd</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
You can try this instead:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
shearspd = math_sqrt(u50*u50 + v50*v50)</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Best,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hosmay</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> gradsusr <gradsusr-bounces@gradsusr.org> on behalf of sim.aberson <sim.aberson@noaa.gov><br>
<b>Sent:</b> Friday, May 17, 2019 10:23 AM<br>
<b>To:</b> GrADS Users Forum<br>
<b>Subject:</b> [gradsusr] calculation using results of subwrd</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">I am trying to use grads to calculate a mean u and mean v over my
<br>
domain, then convert the values to direction and speed. Since speed is <br>
easier, I start with that:<br>
<br>
'd aave(ave(ugrdprs,lev=925,lev=700),x=1,x=463,y=1,y=425)'<br>
theline = sublin(result,2)<br>
u850 = subwrd(theline,4)<br>
'd aave(ave(vgrdprs,lev=925,lev=700),x=1,x=463,y=1,y=425)'<br>
theline = sublin(result,2)<br>
v850 = subwrd(theline,4)<br>
say 'u850,v850= 'u850' 'v850<br>
shearspd=mag(u850,v850)<br>
<br>
u850,v850= -4.44537 -0.528102<br>
Syntax Error: Invalid Operand<br>
'u850' not a variable or function name<br>
Operation Error: Error from mag function<br>
Error ocurred at column 1<br>
<br>
So, I get values for u850 and v850, but then the error that the results <br>
are not a "variable or function name." I looked over the documentation <br>
at <a href="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">
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</a>,
but didn't find <br>
anything that would help. The documentation page <br>
<a href="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">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</a>
has examples of using the <br>
results of subwrd in if constructs, but not in arithmetic calculations.<br>
<br>
I also tried to define the variables, but that threw the error:<br>
<br>
DEFINE error: Invalid expression.<br>
Syntax Error: Invalid Operand<br>
'subwrd' not a variable or function name<br>
Error ocurred at column 1<br>
<br>
I also looked through the archives here and didn't find anything helpful.<br>
<br>
Is there a way to get the results to be a variable to do the calculation <br>
I want?<br>
<br>
Thanks,<br>
Sim<br>
_______________________________________________<br>
gradsusr mailing list<br>
gradsusr@gradsusr.org<br>
<a href="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">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</a><br>
</div>
</span></font></div>
</body>
</html>