map layer visibility affects other layers/vnc server

Post any questions, ideas, or topics related to Jython and Python scripting.
User avatar
bobc
Posts: 990
Joined: Mon Nov 15, 2010 5:57 pm

Re: map layer visibility affects other layers/vnc server

Post by bobc »

Hi Joleen -

I just wanted to update you on some testing that I have been doing. I created a very basic script that tests eastl/fd.

Code: Select all

outDir = 'C:/Users/rcarp/test/'

addeParms = dict(
    server = 'eastl.ssec.wisc.edu',
    dataset = 'EASTL',
    descriptor = 'FD',
    band = 6,
    location = (40,-90),
    size = (300,300),
    coordinateSystem = LATLON,
    position = -1,
    unit = 'TEMP',
    )
   
data = loadADDEImage(**addeParms)

panel = buildWindow()
layer = panel[0].createLayer('Image Display',data)
layer.setLayerLabel(visible=False)

panel[0].setWireframe(False)

mapLayer = panel[0].getMapLayer()
mapLayer.setLayerVisible(False)

print layer.getLayerVisible()
panel[0].captureImage(outDir+'bg_allFalse_layerLabel_wireframe_map2.gif')

I tested this with every band of eastl. When running through the Jython Shell, everything seems to work fine and I always end up with good images. I can have all three of these turned off:
  1. The wireframe box
  2. The map layer
  3. The layer label

When running from the background, regardless of the band, if all three of these are turned off, then the output image is blank. If any one of these is turned on, then there is a good image. This includes setting setLayerLabel to an empty string with: ""... though this does show a period for the layer label. I'm trying various experiments such as changing the order that things are done in the script, adding pauses(), etc but thus far I haven't been successful at getting an image when all three items in the list above are set to false from the background. I've sent this off to a programmer for thoughts as well.

This goes to show that the blank image problem is not just an issue with certain bands of Himawari data, but I don't yet know why only a couple bands of Himawari data are producing blank images for you. I don't think this is the case, but you aren't doing anything different in your script/function(s) for bands 4 and 6 (the bands that produce blank images), correct?.

Also to note (if you didn't already know), using the nightly I did not have to pass accounting information for the server/dataset into loadADDEImage. This is because of a programming change in the 1.6beta1 nightly build that checks the ADDE Data Manager for accounting information if the server/dataset is specified there (if accounting= isn't passed through loadADDEImage). This could be helpful when passing scripts around to different users, so you don't have to remember to remove your own accounting info before sending it to others.

Thanks for your patience and for helping to test things out -
Bob
User avatar
joleenf
Posts: 1123
Joined: Mon Jan 19, 2009 7:16 pm

Re: map layer visibility affects other layers/vnc server

Post by joleenf »

Hi Bob,

Thank-you for the update. I also tried inverting the order and found the same as you. Another thing I noted, and was not sure why this was the case, when I tried using color='black' on the layer label that was '.', the color was ignored.

I am actually using test data for the ABI right now, and I am not doing anything differently for the first 6 bands. This is a very strange thing about this bug beyond the fact that everything seems fine when testing from the interactive jython shell, but not when run from the command line.

Also note,

I verified the image layer visibility when I could "see" the image versus when I could not, and both times, the visibility was set to True.
I verified that the file being used was the same in both the foreground and background
I used describe() and whatTypes() to verfiy that the general statistics and structure of the data was the same.

I am not sure if there are any other diagnostics which can or should be run.

Thanks for you help as well.
Joleen
User avatar
bobc
Posts: 990
Joined: Mon Nov 15, 2010 5:57 pm

Re: map layer visibility affects other layers/vnc server

Post by bobc »

Hi Joleen -

The color keyword not working in setLayerLabel is a known issue and is written up as Inquiry 2279. When running through the Jython Shell, you can use setLayerLabelColor(). For example, if your layer is referenced as satLayer, you can run: satLayer.setLayerLabelColor('green'). However, this function isn't working from the background and I've written up another inquiry for that.

I have a workaround that you can try for now for the blank images. It involves adding an annotation to your display, but it's not visible due to the line/element and alignment values. I was able to get images working on an OS X machine from the background with no map, wireframe box, or layer label if I included this line in my script:

Code: Select all

panel[0].annotate('.', line=0, element=0, alignment=('left', 'top')

Again, this isn't a real solution, but if you give this a try please let me know if it works.

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

Re: map layer visibility affects other layers/vnc server

Post by joleenf »

Hi Bob,

It seems that annotate has helped in this case. There was an additional command which I needed to change for everything to work correctly: I had tried to remove the unit of "1" from the visible data so that it would not appear on the color bar. Rather than removing the unit, I thought I could check for the unit of "1" and make sure that the showUnit option of the color bar formatting is False. All 16 bands display correctly now, I hope that remains consistent. However, it seems the showUnit=False still keeps the unit for the top level of the color bar. Normally, this is not an issue, but currently my visible color bar looks like it goes from 0-11, not 0-1. See attached example where this matters for visible but not as much for the ir brightness temperature.

Screen Shot 2016-04-20 at 12.42.09 PM.png
Screen Shot 2016-04-20 at 12.42.09 PM.png (10.57 KiB) Viewed 3471 times


Thanks for all of your help,
Joleen
User avatar
bobc
Posts: 990
Joined: Mon Nov 15, 2010 5:57 pm

Re: map layer visibility affects other layers/vnc server

Post by bobc »

Hi Joleen -

Using today's nightly I'm getting captureImage/writeImage to work correctly when i have showUnit/showunit set to false. The only way I'm able to get the display unit to appear is if I specifically use showUnit=true in captureImage or showunit=true in writeImage. Here's some sample code for the formatting of captureImage:

Code: Select all

imageFormatting = [
    Matte(
        space = '200',
        background = 'white',
        ),
    Colorbar(
        display = abiLayer,
        place = 'MR, -20, 0',
        anchor = 'MR',
        interval = '0.2',
        height = '600',
        width = '50',
        orientation = 'left',
        fontSize = 40,
        # showUnit = 'true',
        )
    ]
abiPanel[0].captureImage(outDir+'captureImageNoShowUnit.gif', formatting = imageFormatting)

In here, if I have showUnit set to false or not defined, then no display unit is attached to the enhancement. If I use showUnit=true, then the unit appears attached to the enhancement.

Here's some code I used for writeImage:

Code: Select all

writeImage(outDir+'writeImageNoShowUnit.gif', "matte background=white top=120; colorbar width=700 height=20 anchor=UM place=UM,0,30 interval=0.2" showunit=false)

Again, if showunit is set to false or not defined, then no display unit is attached to the enhancement. If I use showunit=true, then the unit appears attached to the enhancement.

I'm wondering if the problem is with how you are trying to catch the missing unit. If I have my layer defined as abiLayer, I can print out the unit in the Jython Shell with:

Code: Select all

print abiLayer.displayUnit

This returns 'None'. So, under the hood McIDAS-V is recognizing that you're working with a unit-less parameter, but the unit still shows up as '1' in the Layer Controls. Maybe you can change your script to check for 'None' instead of '1'?

If this doesn't work, can you please send me the part of your script/function that captures the images?

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

Re: map layer visibility affects other layers/vnc server

Post by joleenf »

Bob,

Did you try using

showUnit='false' ?

On my machine, this also produces a unit marker. Also, I did have a slight error, I was using the boolean showUnit=True and showUnit=False which don't throw a type error, rather, a unit is displayed.

I just checked the option of setting showUnit=None, rather than 'false', and this provides me with a color bar that has no label.

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

Re: map layer visibility affects other layers/vnc server

Post by bobc »

Hi Joleen -

Sorry about that, I'm not sure what happened during my testing yesterday, but today I'm replicating that specifying showUnit="false" does in fact add the unit to the colorbar. I'm able to get this working correctly with writeImage, where using showunit=false works and you don't get the unit on the colorbar. I wrote this up as Inquiry 2333. It seems like one thing that does work with captureImage is if you don't specify showUnit at all, then you don't get the unit on the colorbar. Could you give this a try and see if it can be used as a workaround until a fix is made for Inquiry 2333?

Thanks and sorry for the confusion -
Bob
User avatar
joleenf
Posts: 1123
Joined: Mon Jan 19, 2009 7:16 pm

Re: map layer visibility affects other layers/vnc server

Post by joleenf »

Hi Bob,

Leaving showUnit out of the ColorBar formatting or setting showUnit=None both work for me. Is this what you meant?

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

Re: map layer visibility affects other layers/vnc server

Post by bobc »

Hi Joleen -

I meant not referencing showUnit in Colorbar at all, but it's good to know that setting it as None works as well. I'll add note of this to the inquiry.

Thanks -
Bob
Post Reply