local data entry

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

local data entry

Post by joleenf »

Hi,

I am trying to display a local AVHRR image, but I keep getting an error when using getADDEImage. It seems that I can list the data, but can't get the data for display. What am I missing?

Code: Select all

#setup
homeDir = expandpath('$HOME')   # or expandpath('~') if that does not work
myAccounting = ('YOU','9999')

fontName='MSReferenceSansSerif'

# site specific
centerLocation = (39.1,-87.0)
serverName = 'localhost'
groupName= 'AVHRR'
desc='Apr 08 Storms'
aDay='2015098'
dataSetEntry = getLocalADDEEntry(dataset=groupName, imageType=desc)

#directory = homeDir + '/data/synoptic/20150408storms/images/sandwich'+aDay+'/'
#dirChk(directory)

panel = buildWindow(height=900,width=1000)
firstRun = True

time1='22:02:00'
time2='22:05:00'
timeList = listADDEImageTimes(server=serverName, localEntry=dataSetEntry, day=(aDay), position='ALL', accounting=myAccounting, band=1)
parmsVIS = (listADDEImages(server=serverName, localEntry=dataSetEntry, accounting=myAccounting, position='ALL', unit='REFL', band=1))[1]

metaDataVIS, imgVIS = getADDEImage(**parmsVIS)


The data is posted to
ftp://ftp.ssec.wisc.edu/pub/ssec/joleenf/

The error is

Traceback (most recent call last):
File "<string>", line 26, in <module>
File "<string>", line 1179, in getADDEImage
File "<string>", line 1376, in _getADDEImage
org.python.proxies.__main__$AddeJythonError$68
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at java.lang.Class.newInstance(Class.java:374)
at org.python.core.PyObject.proxyInit(PyObject.java:137)
at org.python.core.Deriveds.dispatch__init__(Deriveds.java:24)
at org.python.core.PyBaseExceptionDerived.dispatch__init__(PyBaseExceptionDerived.java:1033)
at org.python.core.PyType.type___call__(PyType.java:1565)
at org.python.core.PyType.__call__(PyType.java:1548)
at org.python.core.PyObject.__call__(PyObject.java:387)
at org.python.core.PyObject.__call__(PyObject.java:391)
at org.python.pycode._pyx110._getADDEImage$71(<string>:1376)
at org.python.pycode._pyx110.call_function(<string>)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyBaseCode.call(PyBaseCode.java:301)
at org.python.core.PyFunction.function___call__(PyFunction.java:376)
at org.python.core.PyFunction.__call__(PyFunction.java:371)
at org.python.core.PyFunction.__call__(PyFunction.java:366)
at org.python.core.PyObject._callextra(PyObject.java:527)
at org.python.pycode._pyx110.getADDEImage$70(<string>:1179)
at org.python.pycode._pyx110.call_function(<string>)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyBaseCode.call(PyBaseCode.java:301)
at org.python.core.PyFunction.function___call__(PyFunction.java:376)
at org.python.core.PyFunction.__call__(PyFunction.java:371)
at org.python.core.PyFunction.__call__(PyFunction.java:366)
at org.python.core.PyObject._callextra(PyObject.java:527)
at org.python.pycode._pyx142.f$0(<string>:26)
at org.python.pycode._pyx142.call_function(<string>)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1261)
at org.python.core.Py.exec(Py.java:1305)
at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:206)
at ucar.unidata.idv.ui.JythonShell.eval(JythonShell.java:838)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at ucar.unidata.util.Misc$2.run(Misc.java:1217)
at ucar.unidata.util.Misc$3.run(Misc.java:1243)
__main__.AddeJythonError: Error Code: 0
User avatar
bobc
Posts: 990
Joined: Mon Nov 15, 2010 5:57 pm

Re: local data entry

Post by bobc »

Hi Joleen -

This looks like a bug where the dictionary returned from listADDEImages isn't including the band= information to pass to getADDEImage. I wrote this up as Inquiry 2022.

For now, a workaround is tacking the band= information before the dictionary in your getADDEImage call. For example:

Instead of: metaDataVIS, imgVIS = getADDEImage(**parmsVIS)
Use: metaDataVIS, imgVIS = getADDEImage(band=1,**parmsVIS)

Please let us know if this solution doesn't work for you.

Thanks for reporting this -
Bob Carp
User avatar
joleenf
Posts: 1123
Joined: Mon Jan 19, 2009 7:16 pm

Re: local data entry

Post by joleenf »

Yes, using band=1 in getADDEImage works.

Joleen
Post Reply