Prioblem for display data with the method getADDEImage

Cool displays
Post Reply
User avatar
glez_b
Posts: 87
Joined: Thu May 05, 2011 9:19 pm
Contact:

Prioblem for display data with the method getADDEImage

Post by glez_b »

I'm downloading data of unidata2.ssec.wissc.edu. Data are satellite GOES10 and GOES12, with the following format:


200408012345.goes12ir

Now I create a local database to access the infrared image, the parameters provided can be seen in the image1.

My next step is to load and display the data from a script, for this I have studied the Basic Script Tutorial and reviewed some comments McIDAS-V Support Forums, the code is as follows:

Code: Select all

panel=buildWindow(height=600,width=900)
adde_parms = dict(
    debug=True,
    server='localhost:8112',
    dataset='GOES12',
    size=(2600, 1732),
    mag=(1, 1),
    band=4,
    time=('23:45:00', '23:45:00'),
    day=('2004214'),
    unit='BRIT',
)
ir_metadata,ir_data = getADDEImage(descriptor='8F1ADEB3', **adde_parms)
ir_layer = panel[0].createLayer('Image Display', ir_data)



Descriptor and parameters were obtained in the properties of data(see image2)

After running the script as follows:

[mcidas@localhost McIDAS-V-System]$ ./runMcV -script /home/mcidas/jython/scripts/adde-request.py

I get the following error
Reading system configuration...
sys mem: 3778
mcv flags: -Dvisad.java3d.textureNpot=false -Dvisad.java3d.imageByRef=true -Dvisad.java3d.geometryByRef=true -Didv.3d=true -Didv.sysmem=3778
./jre/bin/java -XX:MaxPermSize=128m -Xmx3022M -XX:MaxPermSize=128m -Djava.ext.dirs="/home/mcidas/McIDAS-V-System/javaextdir":"/home/mcidas/McIDAS-V-System/jre/lib/ext":"/home/mcidas/Library/Java/Extensions" -Dlogback.configurationFile="edu/wisc/ssec/mcidasv/resources/logback.xml" -Dmcv.userpath="/home/mcidas/McIDAS-V" -Dpython.security.respectJavaAccessibility=false -classpath ".:./rsyntaxtextarea-2.0.2.jar:./sysout-over-slf4j-1.0.2.jar:./commons-math-2.2.jar:./mcv_userguide.jar:./log4j-over-slf4j-1.6.1.jar:./logback-classic-0.9.29.jar:./logback-core-0.9.29.jar:./miglayout-4.0-swing.jar:./slf4j-api-1.6.1.jar:./jython.jar:./eventbus-1.3.jar:./mcidasv.jar:./auxdata.jar:./external.jar:./local-idv.jar:./idv.jar:./local-visad.jar:./ncIdv.jar:./visad.jar" -da edu.wisc.ssec.mcidasv.McIDASV -Dvisad.java3d.textureNpot=false -Dvisad.java3d.imageByRef=true -Dvisad.java3d.geometryByRef=true -Didv.3d=true -Didv.sysmem=3778 -userpath "/home/mcidas/McIDAS-V" -script /home/mcidas/jython/scripts/adde-request.py
Traceback (most recent call last):
File "<string>", line 34, in <module>
File "<string>", line 509, in getADDEImage
File "<string>", line 509, in getADDEImage
at visad.data.mcidas.AreaAdapter.<init>(AreaAdapter.java:395)
at visad.data.mcidas.AreaAdapter.<init>(AreaAdapter.java:66)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.python.core.PyReflectedConstructor.constructProxy(PyReflectedConstructor.java:210)

visad.VisADException: visad.VisADException: Problem with McIDAS AREA file: edu.wisc.ssec.mcidas.AreaFileException: Error opening URL for AreaFile:java.net.ConnectException: Connection refused

How I can fix this error?

Some of the parameters wrong?

If the descriptor is the one that fails, how to obtain the descriptor for this data source?
Attachments
adde-request.py
(1.09 KiB) Downloaded 567 times
imagen2.png
imagen1.png
Boris_MCS
User avatar
jayh
Posts: 415
Joined: Thu Jan 15, 2009 10:34 pm

Re: Prioblem for display data with the method getADDEImage

Post by jayh »

Hi Boris-

I took a look at your script and I think you should use the getDescriptor() function to get the descriptor for the data source. This is outlined in step 15 of the Basic Scripting tutorial.

In your script you posted, I changed this line:

ir_metadata,ir_data = getADDEImage(descriptor='8F1ADEB3', **adde_parms)

to this:

desc=getDescriptor('GOES12','01-AGO-04 GOES')
ir_metadata,ir_data = getADDEImage(descriptor=desc, **adde_parms)

And my script worked. Hopefully this will work for you.

Thanks, Jay
McIDAS User Services
User avatar
glez_b
Posts: 87
Joined: Thu May 05, 2011 9:19 pm
Contact:

Re: Prioblem for display data with the method getADDEImage

Post by glez_b »

Hello jayh:

I followed your suggestion and the script did not show any errors. The only detail I see when I run the script from the console of linux is that I can not display the image in the window McIDAS-V. The script is as follows:

Code: Select all


adde_parms = dict(
    debug=True,
    server='localhost:8112',
    dataset='GOES12',
    size=(2600, 1732),
    mag=(1, 1),
    band=4,
    time=('23:45:00', '23:45:00'),
    day=('2004214'),
    unit='BRIT',
)

desc=getDescriptor('GOES12','01-AGO-04 GOES')
ir_metadata,ir_data = getADDEImage(descriptor=desc, **adde_parms)

panel=buildWindow(height=600,width=900,panelTypes=MAP)
panel[0].setWireframe(False)
ir_layer=panel[0].createLayer('Image Display', ir_data)



When I run the program the following happens
[mcidas@localhost McIDAS-V-System]$ ./runMcV -script /home/mcidas/jython/scripts/adde-request.py

Reading system configuration...
sys mem: 3778
mcv flags: -Dvisad.java3d.textureNpot=false -Dvisad.java3d.imageByRef=true -Dvisad.java3d.geometryByRef=true -Didv.3d=true -Didv.sysmem=3778
./jre/bin/java -XX:MaxPermSize=128m -Xmx3022M -XX:MaxPermSize=128m -Djava.ext.dirs="/home/mcidas/McIDAS-V-System/javaextdir":"/home/mcidas/McIDAS-V-System/jre/lib/ext":"/home/mcidas/Library/Java/Extensions" -Dlogback.configurationFile="edu/wisc/ssec/mcidasv/resources/logback.xml" -Dmcv.userpath="/home/mcidas/McIDAS-V" -Dpython.security.respectJavaAccessibility=false -classpath ".:./rsyntaxtextarea-2.0.2.jar:./sysout-over-slf4j-1.0.2.jar:./commons-math-2.2.jar:./mcv_userguide.jar:./log4j-over-slf4j-1.6.1.jar:./logback-classic-0.9.29.jar:./logback-core-0.9.29.jar:./miglayout-4.0-swing.jar:./slf4j-api-1.6.1.jar:./jython.jar:./eventbus-1.3.jar:./mcidasv.jar:./auxdata.jar:./external.jar:./local-idv.jar:./idv.jar:./local-visad.jar:./ncIdv.jar:./visad.jar" -da edu.wisc.ssec.mcidasv.McIDASV -Dvisad.java3d.textureNpot=false -Dvisad.java3d.imageByRef=true -Dvisad.java3d.geometryByRef=true -Didv.3d=true -Didv.sysmem=3778 -userpath "/home/mcidas/McIDAS-V" -script /home/mcidas/jython/scripts/adde-request.py
url: adde://localhost:8112/imagedata?&PORT=1 ... &SIZE=2600 1732&UNIT=BRIT&MAG=1 1&SPAC=4&NAV=X&AUX=YES&DOC=X&DAY=2004214&TIME=23:45:00 23:45:00 I&POS=0&TRACK=0
lines=2600 elements=1732


and does not generate the panel to display the image. However, if evaluated the code from the jython shell, it creates the panel and I can see the satellite image.

Something I did wrong? o not possible to do this from linux console?

Thanks for your ideas
Boris_MCS
User avatar
bobc
Posts: 939
Joined: Mon Nov 15, 2010 5:57 pm

Re: Prioblem for display data with the method getADDEImage

Post by bobc »

Hi Boris -

When you run this script from the background, it does not open up any McIDAS-V display windows that are visible. If you want to create a display in the background and then view it, you will have to do something like captureImage for a single image or writeMovie for a loop of images.

For example, you can add a captureImage line to the end of your script that can create a .jpg, .gif, or .png image:
panel[0].captureImage('/home/rcarp/McIDAS-V/satelliteImage.png')

I tried this out on one of our Linux machines, and it created an image called satelliteImage.png in my McIDAS-V directory. Hopefully this works for you.

User's Guide page for captureImage:
http://www.ssec.wisc.edu/mcidas/doc/mcv ... ptureImage

Thanks -
Bob Carp
McIDAS User Services
User avatar
glez_b
Posts: 87
Joined: Thu May 05, 2011 9:19 pm
Contact:

Re: Prioblem for display data with the method getADDEImage

Post by glez_b »

Thanks Bob:

My script worked correctly:

Code: Select all

myUser='mcidas'
imageDir=('/home/'+myUser+'/jython/imagenes/')

adde_parms = dict(
    debug=True,
    server='localhost:8112',
    dataset='GOES12',
    size=(2600, 1732),
    mag=(1, 1),
    band=4,
    time=('23:45:00', '23:45:00'),
    day=('2004214'),
    unit='BRIT',
]

desc=getDescriptor('GOES12','01-AGO-04 GOES')
ir_metadata,ir_data = getADDEImage(descriptor=desc, **adde_parms)

ir_label = '%s %s' % (
    ir_metadata['sensor-type'],
    ir_metadata['nominal-time']
    )

bwLines=ir_metadata['lines']/2
bwEles=ir_metadata['elements']/2
panel=buildWindow(height=bwLines,width=bwEles)

ir_layer=panel[0].createLayer('Image Display', ir_data)
panel[0].setProjection('Mexico')
panel[0].setWireframe(False)
panel[0].setCenter(22.3,-101.0, scale=1.0)
panel[0].annotate('<b>Mexico</b>', size=20, font='SansSerif.bold', lat=22.4, lon=-101.2, color='Green')
ir_layer.setLayerLabel(label=ir_label, size=14)
ir_layer.setEnhancement('CIRA IR Default')
ir_layer.setColorScale(visible=True, placement='Left', font='Dialog', style='BOLD', size=15, color='Green')
panel[0].captureImage(imageDir+'mexico.jpg')



After running the script, I get the attached image. My question now is: is possible to add any instruction to the script to get only the image with the coordinates of Mexico?
Attachments
boris7.jpg
Boris_MCS
User avatar
bobc
Posts: 939
Joined: Mon Nov 15, 2010 5:57 pm

Re: Prioblem for display data with the method getADDEImage

Post by bobc »

Hi Boris -

I was able to create an image centered over Mexico with data only over that region by using a combination of size, coordinateSystem, place, and location in my adde_parms dictionary that goes into getADDEImage.

What I used was:

Code: Select all

adde_parms = dict(
    debug=True,
    server='localhost:8112',
    dataset='AREA',
    mag=(1,1),
    band=3,
    time=('05:45:00', '05:45:00'),
    day=('2013225'),
    unit='BRIT',
    size=(250,500),
    coordinateSystem=LATLON,
    place=ULEFT,
    location=(34,-120)
)


The coordinateSystem, place, and location keywords specify the upper left lat/lon coordinates of the display. I centered this just off the coast of southern California. The size keyword is used to specify the size of the image, which I worked with until I got the satellite image to stretch out over all of Mexico.

Note that you may need to adjust the keyword values to get an image that you want, but hopefully a combination of these 4 keywords will work for you.

Thanks -
Bob Carp
Post Reply