errors with ABI test data

Post any questions, ideas, or topics related to Jython and Python scripting.
Post Reply
User avatar
joleenf
Posts: 1120
Joined: Mon Jan 19, 2009 7:16 pm

errors with ABI test data

Post by joleenf »

Hi,

I received new test data for ABI. Using this new data, I started having problems with setting the projection of the image to the native projection when running from the command line script. This does not seem to happen when running in the Jython Shell, or when running through the normal point and click GUI controls. In trying to isolate the problem, I ran into a few errors even before I got to the point of resetting the projection.

The test script is this:

Code: Select all

filename='<path to DO3>/OR_ABI-L2-CMIPC-M3C03_G16_s20161101232415_e20161101235192_c20161101241235.nc'

params=dict(
       field='CMI',
       stride=1
       )

thisData=loadGrid(filename, **params)

panel = buildWindow()

thisLayer=panel[0].createLayer('Color-Shaded Plan View', thisData)
panel[0].setProjection(thisLayer)

panel[0].captureImage('/Users/joleenf/data/test.png')




1.) Start McV 1.6 beta 1 with an alternative userpath to ensure that no jython code is interfering with process (strange errors needed to be eliminated...more on this later).

2.) Check Non Power of Two, and fast rendering for layer in preferences

3.) Open the Jython shell and run code above. For me, there is no problem. An image is created.

mcidasv.scriptRunInJythonShell.log
(1.72 KiB) Downloaded 235 times


4.) Close McV and run the code above from the command line using the alternate user path. For me, I get an error in this process.
mcidasv.scriptRunAtCommandLine.log
(3.05 KiB) Downloaded 237 times


5.) Add some confusion to the errors: Start McIDAS-V with an alternate user path. Open the jython shell and test the following code

Code: Select all

with open('test.txt', 'r') as f:
    for i,line in enumerate(f):
       print line
print 'Done'

test.txt
(15 Bytes) Downloaded 247 times


This should run without errors.

6.) Close McIDAS-V and run the loadGrid script on the command line again, use the alternate user path. A new error appears in the mcidasv.log

mcidas.addWithOpenInLibraryAndRunonCommandLine.log
(1.78 KiB) Downloaded 264 times



Am I incorrect in using the with Open format for file i/o? As far as I can tell, that is okay in python even though "with" is a reserved keyword.

Sample file is at ftp://ftp.ssec.wisc.edu/pub/ssec/joleen ... 1241235.nc

Joleen
User avatar
bobc
Posts: 939
Joined: Mon Nov 15, 2010 5:57 pm

Re: errors with ABI test data

Post by bobc »

Hi Joleen -

Looking at your log files, when you are running from the foreground (mcidasv.scriptRunInJythonShell.log) you are using McV 1.6b1. When you are running from the background (mcidasv.scriptRunAtCommandLine) you are using McV 1.5. If I start up McV 1.5 and run your script through the Jython Shell I get the same "Number of ranges in section (2) must be = 0" error. This error comes at the loadGrid() step. Could you try running your script again from the background from your McIDAS-V-System directory where you have 1.6b1 installed and see if it works?

Thanks -
Bob Carp
User avatar
joleenf
Posts: 1120
Joined: Mon Jan 19, 2009 7:16 pm

Re: errors with ABI test data

Post by joleenf »

You are correct Bob, I was using the wrong installation of McIDAS-V when running on the command line. There are no errors when I run with the McV1.6 nightly at the command line. Sorry for that oversight.

Joleen
Post Reply