iconsistent results in scripting

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

iconsistent results in scripting

Post by joleenf »

Hi,

Attached are two scripts. First, I tried using 4 windows to display four different satellite images. I wanted to view simultaneously. However, the results were inconsistent. The labels were not plotting in correct window or the viewpoint was not getting set correctly.


The second script worked, but the logo which I have set in my preferences was partially duplicated in the image. (see example).

ahi_vs_mtsat.py
(2.57 KiB) Downloaded 341 times


h8band3_2015025_023000.png


There was other inconsistent behavior and main.xml was expanding on each attempt to run the script.

Color Bar is at ftp://ftp.ssec.wisc.edu/pub/ssec/joleenf/310-200MMG.xml
I am not sure how to provide the AHI viewpoint. It would be fine to display around 36.4, 130.6.

Data is also at ftp://ftp.ssec.wisc.edu/pub/ssec/joleenf/

McIDAS-V 1.5beta2 Build Date: 2015-02-03
Joleen
Attachments
didnotworkMultiplePanels.py
(2.61 KiB) Downloaded 315 times
Last edited by joleenf on Tue Feb 10, 2015 2:43 pm, edited 1 time in total.
User avatar
joleenf
Posts: 1123
Joined: Mon Jan 19, 2009 7:16 pm

Re: iconsistent results in scripting

Post by joleenf »

Hi,

Just a note, writeImage saves the image without the slightly duplicated logo. In addition it is possible to use the interactive image save sequence to save the image with the correct logo style.

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

Re: iconsistent results in scripting

Post by bobc »

Hi Joleen -

On my Windows 7 machine, I'm able to replicate your problem from the first script, but not the second problem with the duplicate logo. I tried on our OS X machine, and I could replicate both problems. Both of these sound like bugs to me, so I will write up a couple inquiries if they don't already exist. I did, however, come up with a script that seems to do what you want. It creates 4 separate display windows (1 for each image), and captures an image of each without showing the duplicate logo problem.

To fix your first script, I basically just changed the order that things were done in the script. Originally, you did the following.
    1. build all 4 display windows
    2. display data for the different bands in each window
    3. set the viewpoint in all 4 display windows
    4. add annotation, set enhancement, capture image of all 4 windows

Instead of doing this, I broke everything apart for each band.
First image:
    1. build 1 display window
    2. display first image
    3. set viewpoint
    4. turn off layer label
    5. annotate
    6. capture image
Second image:
    - repeat steps 1-6 above
Third image:
    - repeat steps 1-6 above
Fourth image:
    - repeat steps 1-6 above

To solve the duplicate logo on the first captured image on OS X, I added a pause() right after buildWindow before doing createLayer.

I'm attaching my version of the script.
MultiplePanels.py
(2.91 KiB) Downloaded 326 times

If you have any questions about this, or if you run into any other problems, please let me know.

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

Re: iconsistent results in scripting

Post by joleenf »

Hi Bob,

I am able to repeat the logo problem without any build window, or any other scripting commands performed just by using activeDisplay().captureImage('/home/test.jpg').

I tried the following combinations:
1.) Logo set in default preferences
2.) Logo set only in the window preferences
3.) Logo moved to a different location

All produced a double logo when using capture image. I am running the beta2 nightly from 2015-02-10. This double logo does not get produced with writeImage or the capture of the image from the gui.

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

Re: iconsistent results in scripting

Post by bobc »

Hi Joleen -

Thanks for the description. I was having a hard time seeing the shift of the logo on my machine since the logo I was using had a solid color on the bottom, so the shift/duplicated logo wasn't really noticeable. Testing with a different logo file, I can definitely replicate the problem on Windows 7 now. I wrote this up as Inquiry 1943.

Thanks again for reporting this bug -
Bob
Post Reply