[gradsusr] mysterious scripting error

Love, Mr. Gary, Contractor, Code 7542 gary.love.ctr at nrlmry.navy.mil
Thu Dec 29 19:40:20 EST 2016


Jeff,

 

Thanks for the feedback. I have many workarounds to make a script work based on the grads context. I’ll keep this in mind when I encounter a similar problem.

 

Gary

 

From: gradsusr-bounces at gradsusr.org [mailto:gradsusr-bounces at gradsusr.org] On Behalf Of Jeff Duda
Sent: Thursday, December 29, 2016 1:21 PM
To: GrADS Users Forum
Subject: Re: [gradsusr] mysterious scripting error

 

Gary,

I decided to use the valnum() function to see what was going on. It confirmed that the values I was assigning to CpT.xx were not considered integers. I figured that might have been the result of using 'set gxout print' to obtain the values. While it doesn't make sense that the gxout setting should make the difference, I nonetheless tried using a different gxout setting and fixed the time so that displaying the field would still give me a printed value. For whatever reason, that worked. Seems really picky of the language, but I guess that's what you have to do.

Thanks for your guidance, sir. Helps to have someone to bounce ideas off of.

Jeff 

 

On Thu, Dec 29, 2016 at 2:19 PM, Love, Mr. Gary, Contractor, Code 7542 <gary.love.ctr at nrlmry.navy.mil> wrote:

Jeff,

 

I’m running version 2.1.a2 on Linux we compiled here at NRL.  Here are the stats:

grads: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped

 

I’d try another version of Grads, especially v1.9 since I have encountered bugs in v2.1.a2.  Grads creates link lists of variables when they are subscripted, i.e., CpT.nt.  There may be a problem following the links and retrieving the value.

 

Gary

 

From: gradsusr-bounces at gradsusr.org [mailto:gradsusr-bounces at gradsusr.org] On Behalf Of Jeff Duda
Sent: Thursday, December 29, 2016 11:52 AM
To: GrADS Users Forum
Subject: Re: [gradsusr] mysterious scripting error

 

Gary,

Thanks for your reply.

Yes, it is my own personal script. Here is the code for assigning the arrays:

'set gxout print'               
'set prnopts %g 1'
'd 2.5e6*qvapor'
tt = 1               
while (tt <= nt)   
 lvq.tt = sublin(result,blank_lines+tt)

 say tt" "lvq.tt" "nt

 tt = tt + 1   
endwhile           
'd 1005*(t+300)'
tt = 1
while (tt <= nt)
 CpT.tt = sublin(result,blank_lines+tt)

 say tt" "CpT.tt" "nt

 tt = tt + 1
endwhile          

Output from this portion is shown as:

1 43504.7  13
2 43400.9  13
3 44271.9  13
4 42382.9  13
5 42426  13
6 40946.4  13
7 37313.4  13
8 32887.1  13
9 30245.9  13
10 30008.8  13
11 28724.1  13
12 29439.1  13
13 28436.3  13
1 302984  13
2 303499  13
3 304544  13
4 306799  13
5 307953  13
6 309824  13
7 311769  13
8 313546  13
9 314621  13
10 315541  13
11 316056  13
12 316285  13
13 316526  13

so in this script instance, nt is set to 13 (and I checked the code to make sure nt doesn't get changed later on in the script, and it doesn't), and CpT.nt = CpT.13 = 316526. I added

say CpT.nt

just before the code line where the crash is occurring. It prints accurately. However, the very next line...Grads just doesn't like it.

I'm running the pre-compiled version 2.1.a3 on Linux. Not sure if it's the CentOS5.9 or the i686 compilation, though.

Jeff

 

On Thu, Dec 29, 2016 at 1:35 PM, Love, Mr. Gary, Contractor, Code 7542 <gary.love.ctr at nrlmry.navy.mil> wrote:

Hi Jeff,

 

Your script must be local to you. I could not find it at ftp://cola.gmu.edu/grads/scripts/

 

Anyway I made a simple test script shown below that works fine, so there must be an assignment problem in you script probably with CpT.1 or CpT.nt.

 

function main()

nt=10

CpT.1=302984

CpT.nt=316526

a=CpT.1

b=CpT.nt

say a

say b

deltatheta=b-a

say deltatheta

return

 

Gary

 

From: gradsusr-bounces at gradsusr.org [mailto:gradsusr-bounces at gradsusr.org] On Behalf Of Jeff Duda
Sent: Thursday, December 29, 2016 10:55 AM
To: GrADS Users Forum
Subject: [gradsusr] mysterious scripting error

 

I have this snippet of code:

a = CpT.1                
b = CpT.nt         
say a              
say b
deltatheta = b-a
say deltatheta

where CpT.1 and CpT.nt have been previously defined.  When I run the script, I get this output

302984 
316526 
Non-numeric args to numeric operation
  Error occurred on line 62
  In file mixing_diagram.gs

Line 62 is underlined and in bold in the code above. Why is this error occurring?

Jeff Duda



-- 

Jeff Duda
Post-doctoral research fellow
University of Oklahoma School of Meteorology


_______________________________________________
gradsusr mailing list
gradsusr at gradsusr.org
http://gradsusr.org/mailman/listinfo/gradsusr




-- 

Jeff Duda
Post-doctoral research fellow
University of Oklahoma School of Meteorology


_______________________________________________
gradsusr mailing list
gradsusr at gradsusr.org
http://gradsusr.org/mailman/listinfo/gradsusr




-- 

Jeff Duda
Post-doctoral research fellow
University of Oklahoma School of Meteorology

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20161230/8535b1b9/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5433 bytes
Desc: not available
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20161230/8535b1b9/attachment-0001.bin 


More information about the gradsusr mailing list