using the colorbar options from writeImage

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

using the colorbar options from writeImage

Post by joleenf »

Hi,

I am writing a script where the users in my group have asked for a number of options. They don't want an external setup file, so the options need to come through command line parameters. The problem I have run into is that they want to access the options from the writeImage formatting in captureImage. Perhaps they will set interval, tickmarks and transparency or none of those. I wrote the following code...


useWidth = 500
useHeight = 25
labelColor='Yellow'
anchor = "UM"
place = "UM,0,10"
showUnit=False
tickMarks=3
interval=None
transparency=None

Code: Select all

myFormatting = [
           Colorbar(
              width=str(useWidth),
              height=str(useHeight),
              anchor=anchor,
              place=place,
              showUnit=showUnit,
              color=labelColor,
              lineColor=labelColor,
              ),
              ]
        for object in myFormatting:
            if isinstance(object,Colorbar):
                  colorBarObject=object
        if (transparency):
           myFormatting.append(TransparentBackground())
        if (interval is not None):
                  colorBarObject.interval=interval
        if (tickMarks is not None):
                  colorBarObject.tickMarks=str(tickMarks))
        logger.debug('Colorbar settings: {0}'.format(colorBarObject.__dict__))


It seems that tickMarks gets assigned correctly by grabbing the object and then setting tickMarks independently. However, this method does not get interpreted correctly when the object.toIsl() method is used. Unfortunately, this means that the captureImage then fails. Any suggestions on how to approach this? (When the toIsl() method is used, for some reason the tickMarks get tacked onto the height value).

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

Re: using the colorbar options from writeImage

Post by joleenf »

Hi,

I just figured out I can set my default for tickMarks="0" so that it aligns with the McIDAS-V default and then the user can set otherwise. However, I still don't understand why it gets interpreted incorrectly when the toIsl() method is used.

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

Re: using the colorbar options from writeImage

Post by joleenf »

Hi,

The documentation for Colorbar options of captureImage has the word "tickmarks" as an option. However, I am finding that using that spelling returns an __init__ error. I found that "tickMarks" still works.

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

Re: using the colorbar options from writeImage

Post by bobc »

Hi Joleen -

Thanks for bringing this up. I'm replicating that "tickmarks" gives an error, but "tickMarks" works. I've updated the User's Guide included in the nightly.

Thanks again -
Bob
Post Reply