McIDAS-V Support Forums

Support and discussion of the McIDAS-V software package
Forum HomeMcIDAS-V Home
It is currently 26 Aug 2019, 02:54

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Error in Jython Shell
PostPosted: 16 Apr 2019, 15:07 
User avatar

Joined: 19 Jan 2009, 19:16
Posts: 1118
Hi,

I am using old code with a tempuserpath for runMcV:

Code:
panel=buildWindow()
theFile = "/Users/joleenf/data/CG_ABI-L2-CMIPM1-M6C01_G16_s20191060040287_e20191060040344_c20191060040542.nc"

d = loadGrid(filename=theFile, field='CMI')

panel[0].createLayer(‘Image Display’, d)


Fails for both a Full Disk and the meso referenced above which I just downloaded to my computer with java.lang.IllegalArgumentException: Cannot create PyString with non-byte value.
The failure occurs at the createLayer line.

Version: 1.9beta1 Build-date: 2019-04-15 09:30

This error is happening on my mac. I don't see the same problem on the lunix box that I am using.


Thanks,
Joleen


Top
 Profile  
 
 Post subject: Re: Error in Jython Shell
PostPosted: 16 Apr 2019, 17:10 
User avatar

Joined: 19 Jan 2009, 19:16
Posts: 1118
This seems to be due to a xRange value I used in an earlier statement. For some reason, that hung around to mess up the loadGrid which was run after.

Joleen


Top
 Profile  
 
 Post subject: Re: Error in Jython Shell
PostPosted: 17 Apr 2019, 15:30 
User avatar

Joined: 15 Nov 2010, 17:57
Posts: 879
Hi Joleen,

I'm glad that you were able to figure out how to get your script working.

I've been trying to simulate a case where I could replicate this problem, but I haven't been able to do so yet. If things with loadGrid are working correctly, xRange shouldn't have any default setting at all, so no xRange should be used by loadGrid unless it was passed directly through the function.

You mentioned that the xRange value was used in an earlier statement. Was this run in the same script, or was it run previously? If this is something you are still concerned about, could you please send me the part of your script where xRange was specified so I can check and see how this could've been passed to loadGrid?

Thanks,
Bob


Top
 Profile  
 
 Post subject: Re: Error in Jython Shell
PostPosted: 17 Apr 2019, 16:04 
User avatar

Joined: 19 Jan 2009, 19:16
Posts: 1118
Hi Bob,

This is a silly script, I am not sure it is working in the way I had hoped, I was working on finding xrange and yrange endpoints associated with lat/lon values. I needed to use these xRange and yRange values rather than the latLonBounds box because I wanted to keep the data in the fixed grid format.

Code:
lalo1 = [[14.4],[-84.0]]
lalo2 = [[-35], [-39]]

theFile = "/Users/joleenf/data/goes16/sand/CG_ABI-L2-CMIPF-M3C02_G16_s20190241700340_e20190241711110_c20190241711456.nc"

a=loadGrid(filename=theFile, field='CMI', stride=2)
targetSet = getDomainSet(a)
cs = targetSet.getCoordinateSystem()

ref1 =  cs.fromReference(lalo1)
gval1 = targetSet.valueToGrid([[ref1[0][0]], [ref1[1][0]]])

ref2 = cs.fromReference(lalo2)

gval2 = targetSet.valueToGrid([[ref2[0][0]], [ref2[1][0]]])


xval = (int(gval1[0][0]), int(gval2[0][0]))
yval = (int(gval1[1][0]), int(gval2[1][0]))

print xval, yval

d = loadGrid(filename=theFile, field='CMI', xRange = xval, yRange = yval)


Perhaps this replicates the error? I thought this problem was solved, but apparently I found the code where it was not solved.

Joleen


Top
 Profile  
 
 Post subject: Re: Error in Jython Shell
PostPosted: 17 Apr 2019, 17:29 
User avatar

Joined: 15 Nov 2010, 17:57
Posts: 879
Hi Joleen,

Thanks for the script. I've run it several times with different lat/lon values and I'm not getting the error to appear on my Windows 7 machine using today's nightly. I'll give this a try on a macOS machine shortly. One thing I noticed is that after I displayed the data the from the second loadGrid (data object "d") the corner points of the display didn't match the list values (lalo1 and lalo2) specified at the beginning of the script. In order to get the correct lat/lon corner points, I had to remove the stride=2 from your first loadGrid command. If you want to display the data with a stride of 2, you can add stride=2 to your second loadGrid command. This would make your script:

Code:
lalo1 = [[14.4],[-84.0]]
lalo2 = [[-35], [-39]]

theFile = "/Users/joleenf/data/goes16/sand/CG_ABI-L2-CMIPF-M3C02_G16_s20190241700340_e20190241711110_c20190241711456.nc"

a=loadGrid(filename=theFile, field='CMI')
targetSet = getDomainSet(a)
cs = targetSet.getCoordinateSystem()

ref1 =  cs.fromReference(lalo1)
gval1 = targetSet.valueToGrid([[ref1[0][0]], [ref1[1][0]]])

ref2 = cs.fromReference(lalo2)

gval2 = targetSet.valueToGrid([[ref2[0][0]], [ref2[1][0]]])


xval = (int(gval1[0][0]), int(gval2[0][0]))
yval = (int(gval1[1][0]), int(gval2[1][0]))

print xval, yval

d = loadGrid(filename=theFile, field='CMI', xRange = xval, yRange = yval, stride=2)

Bob


Top
 Profile  
 
 Post subject: Re: Error in Jython Shell
PostPosted: 18 Apr 2019, 17:06 
User avatar

Joined: 19 Jan 2009, 19:16
Posts: 1118
Hi Bob,

I can't reproduce this error today either.

Joleen


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group