Page 1 of 1

using the colorbar options from writeImage

Posted: Tue Feb 09, 2016 5:51 pm
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

Re: using the colorbar options from writeImage

Posted: Tue Feb 09, 2016 6:02 pm
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

Re: using the colorbar options from writeImage

Posted: Tue Jul 25, 2017 5:27 pm
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

Re: using the colorbar options from writeImage

Posted: Tue Jul 25, 2017 7:51 pm
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